diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/CHANGELOG.md b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/CHANGELOG.md index 91e1831b5c44..3243b4791c0b 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/CHANGELOG.md +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/CHANGELOG.md @@ -1,5 +1,49 @@ # Release History +## 2.0.0 (2025-04-10) +### Breaking Changes + +- Type of `ErrorAdditionalInfo.Info` has been changed from `any` to `*ErrorAdditionalInfoInfo` +- `ManagedServiceIdentityTypeSystemAssignedUserAssigned` from enum `ManagedServiceIdentityType` has been removed +- Function `*FleetMembersClient.BeginUpdate` has been removed +- Function `*FleetsClient.BeginCreateOrUpdate` has been removed +- Function `*FleetsClient.BeginUpdate` has been removed + +### Features Added + +- New value `ManagedServiceIdentityTypeSystemAndUserAssigned` added to enum type `ManagedServiceIdentityType` +- New value `NodeImageSelectionTypeCustom` added to enum type `NodeImageSelectionType` +- New enum type `AutoUpgradeLastTriggerStatus` with values `AutoUpgradeLastTriggerStatusFailed`, `AutoUpgradeLastTriggerStatusSucceeded` +- New enum type `AutoUpgradeNodeImageSelectionType` with values `AutoUpgradeNodeImageSelectionTypeConsistent`, `AutoUpgradeNodeImageSelectionTypeLatest` +- New enum type `AutoUpgradeProfileProvisioningState` with values `AutoUpgradeProfileProvisioningStateCanceled`, `AutoUpgradeProfileProvisioningStateFailed`, `AutoUpgradeProfileProvisioningStateSucceeded` +- New enum type `UpgradeChannel` with values `UpgradeChannelNodeImage`, `UpgradeChannelRapid`, `UpgradeChannelStable` +- New function `NewAutoUpgradeProfileOperationsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AutoUpgradeProfileOperationsClient, error)` +- New function `*AutoUpgradeProfileOperationsClient.BeginGenerateUpdateRun(context.Context, string, string, string, *AutoUpgradeProfileOperationsClientBeginGenerateUpdateRunOptions) (*runtime.Poller[AutoUpgradeProfileOperationsClientGenerateUpdateRunResponse], error)` +- New function `NewAutoUpgradeProfilesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*AutoUpgradeProfilesClient, error)` +- New function `*AutoUpgradeProfilesClient.BeginCreateOrUpdate(context.Context, string, string, string, AutoUpgradeProfile, *AutoUpgradeProfilesClientBeginCreateOrUpdateOptions) (*runtime.Poller[AutoUpgradeProfilesClientCreateOrUpdateResponse], error)` +- New function `*AutoUpgradeProfilesClient.BeginDelete(context.Context, string, string, string, *AutoUpgradeProfilesClientBeginDeleteOptions) (*runtime.Poller[AutoUpgradeProfilesClientDeleteResponse], error)` +- New function `*AutoUpgradeProfilesClient.Get(context.Context, string, string, string, *AutoUpgradeProfilesClientGetOptions) (AutoUpgradeProfilesClientGetResponse, error)` +- New function `*AutoUpgradeProfilesClient.NewListByFleetPager(string, string, *AutoUpgradeProfilesClientListByFleetOptions) *runtime.Pager[AutoUpgradeProfilesClientListByFleetResponse]` +- New function `*ClientFactory.NewAutoUpgradeProfileOperationsClient() *AutoUpgradeProfileOperationsClient` +- New function `*ClientFactory.NewAutoUpgradeProfilesClient() *AutoUpgradeProfilesClient` +- New function `*FleetMembersClient.BeginUpdateAsync(context.Context, string, string, string, FleetMemberUpdate, *FleetMembersClientBeginUpdateAsyncOptions) (*runtime.Poller[FleetMembersClientUpdateAsyncResponse], error)` +- New function `*FleetsClient.BeginCreate(context.Context, string, string, Fleet, *FleetsClientBeginCreateOptions) (*runtime.Poller[FleetsClientCreateResponse], error)` +- New function `*FleetsClient.BeginUpdateAsync(context.Context, string, string, FleetPatch, *FleetsClientBeginUpdateAsyncOptions) (*runtime.Poller[FleetsClientUpdateAsyncResponse], error)` +- New struct `AutoUpgradeNodeImageSelection` +- New struct `AutoUpgradeProfile` +- New struct `AutoUpgradeProfileListResult` +- New struct `AutoUpgradeProfileProperties` +- New struct `AutoUpgradeProfileStatus` +- New struct `ErrorAdditionalInfoInfo` +- New struct `FleetMemberStatus` +- New struct `FleetStatus` +- New field `EnableVnetIntegration`, `SubnetID` in struct `APIServerAccessProfile` +- New field `Status` in struct `FleetMemberProperties` +- New field `Status` in struct `FleetProperties` +- New field `CustomNodeImageVersions` in struct `NodeImageSelection` +- New field `AutoUpgradeProfileID` in struct `UpdateRunProperties` + + ## 1.3.0-beta.1 (2024-10-25) ### Features Added diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/README.md b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/README.md index a843abf84181..7a038e1bd065 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/README.md +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/README.md @@ -18,7 +18,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure Kubernetes Fleet module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/v2 ``` ## Authorization @@ -55,7 +55,7 @@ clientFactory, err := armcontainerservicefleet.NewClientFactory( see https://aka.ms/autorest - -``` yaml -azure-arm: true -require: -- https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/readme.go.md -license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.3.0-beta.1 -tag: package-2024-05-preview -``` \ No newline at end of file diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/autoupgradeprofileoperations_client.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/autoupgradeprofileoperations_client.go new file mode 100644 index 000000000000..51b754224123 --- /dev/null +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/autoupgradeprofileoperations_client.go @@ -0,0 +1,122 @@ +// 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 armcontainerservicefleet + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AutoUpgradeProfileOperationsClient contains the methods for the AutoUpgradeProfileOperations group. +// Don't use this type directly, use NewAutoUpgradeProfileOperationsClient() instead. +type AutoUpgradeProfileOperationsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAutoUpgradeProfileOperationsClient creates a new instance of AutoUpgradeProfileOperationsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAutoUpgradeProfileOperationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AutoUpgradeProfileOperationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AutoUpgradeProfileOperationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginGenerateUpdateRun - Generates an update run for a given auto upgrade profile. +// 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. +// - fleetName - The name of the Fleet resource. +// - autoUpgradeProfileName - The name of the AutoUpgradeProfile resource. +// - options - AutoUpgradeProfileOperationsClientBeginGenerateUpdateRunOptions contains the optional parameters for the AutoUpgradeProfileOperationsClient.BeginGenerateUpdateRun +// method. +func (client *AutoUpgradeProfileOperationsClient) BeginGenerateUpdateRun(ctx context.Context, resourceGroupName string, fleetName string, autoUpgradeProfileName string, options *AutoUpgradeProfileOperationsClientBeginGenerateUpdateRunOptions) (*runtime.Poller[AutoUpgradeProfileOperationsClientGenerateUpdateRunResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.generateUpdateRun(ctx, resourceGroupName, fleetName, autoUpgradeProfileName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AutoUpgradeProfileOperationsClientGenerateUpdateRunResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AutoUpgradeProfileOperationsClientGenerateUpdateRunResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// GenerateUpdateRun - Generates an update run for a given auto upgrade profile. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-03-01 +func (client *AutoUpgradeProfileOperationsClient) generateUpdateRun(ctx context.Context, resourceGroupName string, fleetName string, autoUpgradeProfileName string, options *AutoUpgradeProfileOperationsClientBeginGenerateUpdateRunOptions) (*http.Response, error) { + var err error + const operationName = "AutoUpgradeProfileOperationsClient.BeginGenerateUpdateRun" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.generateUpdateRunCreateRequest(ctx, resourceGroupName, fleetName, autoUpgradeProfileName, 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 +} + +// generateUpdateRunCreateRequest creates the GenerateUpdateRun request. +func (client *AutoUpgradeProfileOperationsClient) generateUpdateRunCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, autoUpgradeProfileName string, _ *AutoUpgradeProfileOperationsClientBeginGenerateUpdateRunOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName}/generateUpdateRun" + 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 fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if autoUpgradeProfileName == "" { + return nil, errors.New("parameter autoUpgradeProfileName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{autoUpgradeProfileName}", url.PathEscape(autoUpgradeProfileName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, 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 +} diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/autoupgradeprofileoperations_client_example_test.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/autoupgradeprofileoperations_client_example_test.go new file mode 100644 index 000000000000..78eceaaf7ae6 --- /dev/null +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/autoupgradeprofileoperations_client_example_test.go @@ -0,0 +1,38 @@ +// 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 armcontainerservicefleet_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/v2" + "log" +) + +// Generated from example definition: 2025-03-01/AutoUpgradeProfileOperations_GenerateUpdateRun_MaximumSet_Gen.json +func ExampleAutoUpgradeProfileOperationsClient_BeginGenerateUpdateRun() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewAutoUpgradeProfileOperationsClient().BeginGenerateUpdateRun(ctx, "rgfleets", "fleet1", "aup1", 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 = armcontainerservicefleet.AutoUpgradeProfileOperationsClientGenerateUpdateRunResponse{ + // } +} diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/autoupgradeprofiles_client.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/autoupgradeprofiles_client.go index 27009b4cf858..33e95572b4d0 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/autoupgradeprofiles_client.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/autoupgradeprofiles_client.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // 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) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armcontainerservicefleet @@ -28,7 +24,7 @@ type AutoUpgradeProfilesClient struct { } // NewAutoUpgradeProfilesClient creates a new instance of AutoUpgradeProfilesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAutoUpgradeProfilesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AutoUpgradeProfilesClient, error) { @@ -46,7 +42,7 @@ func NewAutoUpgradeProfilesClient(subscriptionID string, credential azcore.Token // BeginCreateOrUpdate - Create a AutoUpgradeProfile // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fleetName - The name of the Fleet resource. // - autoUpgradeProfileName - The name of the AutoUpgradeProfile resource. @@ -60,8 +56,7 @@ func (client *AutoUpgradeProfilesClient) BeginCreateOrUpdate(ctx context.Context return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AutoUpgradeProfilesClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -74,7 +69,7 @@ func (client *AutoUpgradeProfilesClient) BeginCreateOrUpdate(ctx context.Context // CreateOrUpdate - Create a AutoUpgradeProfile // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 func (client *AutoUpgradeProfilesClient) createOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, autoUpgradeProfileName string, resource AutoUpgradeProfile, options *AutoUpgradeProfilesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "AutoUpgradeProfilesClient.BeginCreateOrUpdate" @@ -120,7 +115,7 @@ func (client *AutoUpgradeProfilesClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-02-preview") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.IfMatch != nil { @@ -129,6 +124,7 @@ func (client *AutoUpgradeProfilesClient) createOrUpdateCreateRequest(ctx context if options != nil && options.IfNoneMatch != nil { req.Raw().Header["If-None-Match"] = []string{*options.IfNoneMatch} } + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } @@ -138,7 +134,7 @@ func (client *AutoUpgradeProfilesClient) createOrUpdateCreateRequest(ctx context // BeginDelete - Delete a AutoUpgradeProfile // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fleetName - The name of the Fleet resource. // - autoUpgradeProfileName - The name of the AutoUpgradeProfile resource. @@ -151,8 +147,7 @@ func (client *AutoUpgradeProfilesClient) BeginDelete(ctx context.Context, resour return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AutoUpgradeProfilesClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -165,7 +160,7 @@ func (client *AutoUpgradeProfilesClient) BeginDelete(ctx context.Context, resour // Delete - Delete a AutoUpgradeProfile // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 func (client *AutoUpgradeProfilesClient) deleteOperation(ctx context.Context, resourceGroupName string, fleetName string, autoUpgradeProfileName string, options *AutoUpgradeProfilesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "AutoUpgradeProfilesClient.BeginDelete" @@ -211,7 +206,7 @@ func (client *AutoUpgradeProfilesClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-02-preview") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.IfMatch != nil { @@ -223,7 +218,7 @@ func (client *AutoUpgradeProfilesClient) deleteCreateRequest(ctx context.Context // Get - Get a AutoUpgradeProfile // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fleetName - The name of the Fleet resource. // - autoUpgradeProfileName - The name of the AutoUpgradeProfile resource. @@ -251,7 +246,7 @@ func (client *AutoUpgradeProfilesClient) Get(ctx context.Context, resourceGroupN } // getCreateRequest creates the Get request. -func (client *AutoUpgradeProfilesClient) getCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, autoUpgradeProfileName string, options *AutoUpgradeProfilesClientGetOptions) (*policy.Request, error) { +func (client *AutoUpgradeProfilesClient) getCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, autoUpgradeProfileName string, _ *AutoUpgradeProfilesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -274,7 +269,7 @@ func (client *AutoUpgradeProfilesClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-02-preview") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -291,7 +286,7 @@ func (client *AutoUpgradeProfilesClient) getHandleResponse(resp *http.Response) // NewListByFleetPager - List AutoUpgradeProfile resources by Fleet // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fleetName - The name of the Fleet resource. // - options - AutoUpgradeProfilesClientListByFleetOptions contains the optional parameters for the AutoUpgradeProfilesClient.NewListByFleetPager @@ -320,7 +315,7 @@ func (client *AutoUpgradeProfilesClient) NewListByFleetPager(resourceGroupName s } // listByFleetCreateRequest creates the ListByFleet request. -func (client *AutoUpgradeProfilesClient) listByFleetCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, options *AutoUpgradeProfilesClientListByFleetOptions) (*policy.Request, error) { +func (client *AutoUpgradeProfilesClient) listByFleetCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, _ *AutoUpgradeProfilesClientListByFleetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -339,7 +334,7 @@ func (client *AutoUpgradeProfilesClient) listByFleetCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-02-preview") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/autoupgradeprofiles_client_example_test.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/autoupgradeprofiles_client_example_test.go index 8df2d8b615d0..bd6ef68c8543 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/autoupgradeprofiles_client_example_test.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/autoupgradeprofiles_client_example_test.go @@ -1,172 +1,420 @@ -//go:build go1.18 -// +build go1.18 - // 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) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armcontainerservicefleet_test import ( "context" - "log" - "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/containerservicefleet/armcontainerservicefleet" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/AutoUpgradeProfiles_ListByFleet.json -func ExampleAutoUpgradeProfilesClient_NewListByFleetPager() { +// Generated from example definition: 2025-03-01/AutoUpgradeProfiles_CreateOrUpdate.json +func ExampleAutoUpgradeProfilesClient_BeginCreateOrUpdate_createAnAutoUpgradeProfile() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewAutoUpgradeProfilesClient().NewListByFleetPager("rg1", "fleet1", 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.AutoUpgradeProfileListResult = armcontainerservicefleet.AutoUpgradeProfileListResult{ - // Value: []*armcontainerservicefleet.AutoUpgradeProfile{ - // { - // Name: to.Ptr("autoupgradeprofile1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets/autoUpgradeProfiles"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/autoUpgradeProfiles/autoupgradeprofile1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // CreatedBy: to.Ptr("@contoso.com"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // LastModifiedBy: to.Ptr("@contoso.com"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // ETag: to.Ptr("\"EtagValue\""), - // Properties: &armcontainerservicefleet.AutoUpgradeProfileProperties{ - // Channel: to.Ptr(armcontainerservicefleet.UpgradeChannelStable), - // ProvisioningState: to.Ptr(armcontainerservicefleet.AutoUpgradeProfileProvisioningStateSucceeded), - // }, - // }}, - // } + poller, err := clientFactory.NewAutoUpgradeProfilesClient().BeginCreateOrUpdate(ctx, "rg1", "fleet1", "autoupgradeprofile1", armcontainerservicefleet.AutoUpgradeProfile{ + Properties: &armcontainerservicefleet.AutoUpgradeProfileProperties{ + Channel: to.Ptr(armcontainerservicefleet.UpgradeChannelStable), + }, + }, 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 = armcontainerservicefleet.AutoUpgradeProfilesClientCreateOrUpdateResponse{ + // AutoUpgradeProfile: &armcontainerservicefleet.AutoUpgradeProfile{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/autoUpgradeProfiles/autoupgradeprofile1"), + // Name: to.Ptr("autoupgradeprofile1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/autoUpgradeProfiles"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("@contoso.com"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // LastModifiedBy: to.Ptr("@contoso.com"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // }, + // Properties: &armcontainerservicefleet.AutoUpgradeProfileProperties{ + // ProvisioningState: to.Ptr(armcontainerservicefleet.AutoUpgradeProfileProvisioningStateSucceeded), + // Channel: to.Ptr(armcontainerservicefleet.UpgradeChannelStable), + // }, + // ETag: to.Ptr("\"EtagValue\""), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/AutoUpgradeProfiles_Get.json -func ExampleAutoUpgradeProfilesClient_Get() { +// Generated from example definition: 2025-03-01/AutoUpgradeProfiles_CreateOrUpdate_MaximumSet_Gen.json +func ExampleAutoUpgradeProfilesClient_BeginCreateOrUpdate_createAnAutoUpgradeProfileGeneratedByMaximumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewAutoUpgradeProfilesClient().Get(ctx, "rg1", "fleet1", "autoupgradeprofile1", nil) + poller, err := clientFactory.NewAutoUpgradeProfilesClient().BeginCreateOrUpdate(ctx, "rgfleets", "fleet1", "autoupgradeprofile1", armcontainerservicefleet.AutoUpgradeProfile{ + Properties: &armcontainerservicefleet.AutoUpgradeProfileProperties{ + Channel: to.Ptr(armcontainerservicefleet.UpgradeChannelStable), + UpdateStrategyID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.ContainerService/fleets/fleet1/updateStrategies/strategy1"), + NodeImageSelection: &armcontainerservicefleet.AutoUpgradeNodeImageSelection{ + Type: to.Ptr(armcontainerservicefleet.AutoUpgradeNodeImageSelectionTypeLatest), + }, + Disabled: to.Ptr(true), + AutoUpgradeProfileStatus: &armcontainerservicefleet.AutoUpgradeProfileStatus{ + LastTriggerError: &armcontainerservicefleet.ErrorDetail{}, + }, + }, + }, &AutoUpgradeProfilesClientBeginCreateOrUpdateOptions{ + ifMatch: to.Ptr("teikqmg"), + ifNoneMatch: to.Ptr("ghfmmyrekxincsxklbldnvhqd")}) 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.AutoUpgradeProfile = armcontainerservicefleet.AutoUpgradeProfile{ - // Name: to.Ptr("autoupgradeprofile1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets/autoUpgradeProfiles"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/autoUpgradeProfiles/autoupgradeprofile1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // CreatedBy: to.Ptr("@contoso.com"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // LastModifiedBy: to.Ptr("@contoso.com"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // ETag: to.Ptr("\"EtagValue\""), - // Properties: &armcontainerservicefleet.AutoUpgradeProfileProperties{ - // Channel: to.Ptr(armcontainerservicefleet.UpgradeChannelStable), - // ProvisioningState: to.Ptr(armcontainerservicefleet.AutoUpgradeProfileProvisioningStateSucceeded), + // res = armcontainerservicefleet.AutoUpgradeProfilesClientCreateOrUpdateResponse{ + // AutoUpgradeProfile: &armcontainerservicefleet.AutoUpgradeProfile{ + // Properties: &armcontainerservicefleet.AutoUpgradeProfileProperties{ + // Channel: to.Ptr(armcontainerservicefleet.UpgradeChannelStable), + // ProvisioningState: to.Ptr(armcontainerservicefleet.AutoUpgradeProfileProvisioningStateSucceeded), + // UpdateStrategyID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.ContainerService/fleets/fleet1/updateStrategies/strategy1"), + // NodeImageSelection: &armcontainerservicefleet.AutoUpgradeNodeImageSelection{ + // Type: to.Ptr(armcontainerservicefleet.AutoUpgradeNodeImageSelectionTypeLatest), + // }, + // Disabled: to.Ptr(true), + // AutoUpgradeProfileStatus: &armcontainerservicefleet.AutoUpgradeProfileStatus{ + // LastTriggeredAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-27T02:49:14.736Z"); return t}()), + // LastTriggerStatus: to.Ptr(armcontainerservicefleet.AutoUpgradeLastTriggerStatusSucceeded), + // LastTriggerError: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("mohtaimtrqkhivtsopwiuveg"), + // Message: to.Ptr("t"), + // Target: to.Ptr("axgswjixhofej"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("oorrhg"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // LastTriggerUpgradeVersions: []*string{ + // to.Ptr("twqzpwqov"), + // }, + // }, + // }, + // ETag: to.Ptr("\"EtagValue\""), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/autoUpgradeProfiles/autoupgradeprofile1"), + // Name: to.Ptr("autoupgradeprofile1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/autoUpgradeProfiles"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("someUser"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // LastModifiedBy: to.Ptr("someOtherUser"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/AutoUpgradeProfiles_CreateOrUpdate.json -func ExampleAutoUpgradeProfilesClient_BeginCreateOrUpdate() { +// Generated from example definition: 2025-03-01/AutoUpgradeProfiles_Delete.json +func ExampleAutoUpgradeProfilesClient_BeginDelete_deleteAnAutoUpgradeProfileResource() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewAutoUpgradeProfilesClient().BeginCreateOrUpdate(ctx, "rg1", "fleet1", "autoupgradeprofile1", armcontainerservicefleet.AutoUpgradeProfile{ - Properties: &armcontainerservicefleet.AutoUpgradeProfileProperties{ - Channel: to.Ptr(armcontainerservicefleet.UpgradeChannelStable), - }, - }, &armcontainerservicefleet.AutoUpgradeProfilesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: nil, - }) + poller, err := clientFactory.NewAutoUpgradeProfilesClient().BeginDelete(ctx, "rg1", "fleet1", "autoupgradeprofile1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - res, err := poller.PollUntilDone(ctx, nil) + _, err = poller.PollUntilDone(ctx, nil) if err != nil { log.Fatalf("failed to pull the result: %v", err) } +} + +// Generated from example definition: 2025-03-01/AutoUpgradeProfiles_Delete_MaximumSet_Gen.json +func ExampleAutoUpgradeProfilesClient_BeginDelete_deleteAnAutoUpgradeProfileResourceGeneratedByMaximumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewAutoUpgradeProfilesClient().BeginDelete(ctx, "rgfleets", "fleet1", "autoupgradeprofile1", &AutoUpgradeProfilesClientBeginDeleteOptions{ + ifMatch: to.Ptr("qmdsmmawj")}) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: 2025-03-01/AutoUpgradeProfiles_Get.json +func ExampleAutoUpgradeProfilesClient_Get_getsAnAutoUpgradeProfileResource() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAutoUpgradeProfilesClient().Get(ctx, "rg1", "fleet1", "autoupgradeprofile1", 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.AutoUpgradeProfile = armcontainerservicefleet.AutoUpgradeProfile{ - // Name: to.Ptr("autoupgradeprofile1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets/autoUpgradeProfiles"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/autoUpgradeProfiles/autoupgradeprofile1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // CreatedBy: to.Ptr("@contoso.com"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // LastModifiedBy: to.Ptr("@contoso.com"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // ETag: to.Ptr("\"EtagValue\""), - // Properties: &armcontainerservicefleet.AutoUpgradeProfileProperties{ - // Channel: to.Ptr(armcontainerservicefleet.UpgradeChannelStable), - // ProvisioningState: to.Ptr(armcontainerservicefleet.AutoUpgradeProfileProvisioningStateSucceeded), + // res = armcontainerservicefleet.AutoUpgradeProfilesClientGetResponse{ + // AutoUpgradeProfile: &armcontainerservicefleet.AutoUpgradeProfile{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/autoUpgradeProfiles/autoupgradeprofile1"), + // Name: to.Ptr("autoupgradeprofile1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/autoUpgradeProfiles"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("@contoso.com"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // LastModifiedBy: to.Ptr("@contoso.com"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // }, + // Properties: &armcontainerservicefleet.AutoUpgradeProfileProperties{ + // ProvisioningState: to.Ptr(armcontainerservicefleet.AutoUpgradeProfileProvisioningStateSucceeded), + // Channel: to.Ptr(armcontainerservicefleet.UpgradeChannelStable), + // }, + // ETag: to.Ptr("\"EtagValue\""), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/AutoUpgradeProfiles_Delete.json -func ExampleAutoUpgradeProfilesClient_BeginDelete() { +// Generated from example definition: 2025-03-01/AutoUpgradeProfiles_Get_MaximumSet_Gen.json +func ExampleAutoUpgradeProfilesClient_Get_getsAnAutoUpgradeProfileResourceGeneratedByMaximumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewAutoUpgradeProfilesClient().BeginDelete(ctx, "rg1", "fleet1", "autoupgradeprofile1", &armcontainerservicefleet.AutoUpgradeProfilesClientBeginDeleteOptions{IfMatch: nil}) + res, err := clientFactory.NewAutoUpgradeProfilesClient().Get(ctx, "rgfleets", "fleet1", "autoupgradeprofile1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + // 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 = armcontainerservicefleet.AutoUpgradeProfilesClientGetResponse{ + // AutoUpgradeProfile: &armcontainerservicefleet.AutoUpgradeProfile{ + // Properties: &armcontainerservicefleet.AutoUpgradeProfileProperties{ + // Channel: to.Ptr(armcontainerservicefleet.UpgradeChannelStable), + // ProvisioningState: to.Ptr(armcontainerservicefleet.AutoUpgradeProfileProvisioningStateSucceeded), + // UpdateStrategyID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.ContainerService/fleets/fleet1/updateStrategies/strategy1"), + // NodeImageSelection: &armcontainerservicefleet.AutoUpgradeNodeImageSelection{ + // Type: to.Ptr(armcontainerservicefleet.AutoUpgradeNodeImageSelectionTypeLatest), + // }, + // Disabled: to.Ptr(true), + // AutoUpgradeProfileStatus: &armcontainerservicefleet.AutoUpgradeProfileStatus{ + // LastTriggeredAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-27T02:49:14.736Z"); return t}()), + // LastTriggerStatus: to.Ptr(armcontainerservicefleet.AutoUpgradeLastTriggerStatusSucceeded), + // LastTriggerError: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("mohtaimtrqkhivtsopwiuveg"), + // Message: to.Ptr("t"), + // Target: to.Ptr("axgswjixhofej"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("oorrhg"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // LastTriggerUpgradeVersions: []*string{ + // to.Ptr("twqzpwqov"), + // }, + // }, + // }, + // ETag: to.Ptr("\"EtagValue\""), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/autoUpgradeProfiles/autoupgradeprofile1"), + // Name: to.Ptr("autoupgradeprofile1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/autoUpgradeProfiles"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("someUser"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // LastModifiedBy: to.Ptr("someOtherUser"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-03-01/AutoUpgradeProfiles_ListByFleet.json +func ExampleAutoUpgradeProfilesClient_NewListByFleetPager_listsTheAutoUpgradeProfileResourcesByFleet() { + cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { - log.Fatalf("failed to pull the result: %v", err) + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewAutoUpgradeProfilesClient().NewListByFleetPager("rg1", "fleet1", 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 = armcontainerservicefleet.AutoUpgradeProfilesClientListByFleetResponse{ + // AutoUpgradeProfileListResult: armcontainerservicefleet.AutoUpgradeProfileListResult{ + // Value: []*armcontainerservicefleet.AutoUpgradeProfile{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/autoUpgradeProfiles/autoupgradeprofile1"), + // Name: to.Ptr("autoupgradeprofile1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/autoUpgradeProfiles"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("@contoso.com"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // LastModifiedBy: to.Ptr("@contoso.com"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // }, + // Properties: &armcontainerservicefleet.AutoUpgradeProfileProperties{ + // ProvisioningState: to.Ptr(armcontainerservicefleet.AutoUpgradeProfileProvisioningStateSucceeded), + // Channel: to.Ptr(armcontainerservicefleet.UpgradeChannelStable), + // }, + // ETag: to.Ptr("\"EtagValue\""), + // }, + // }, + // NextLink: to.Ptr("http://nextlink.contoso.com"), + // }, + // } + } +} + +// Generated from example definition: 2025-03-01/AutoUpgradeProfiles_ListByFleet_MaximumSet_Gen.json +func ExampleAutoUpgradeProfilesClient_NewListByFleetPager_listsTheAutoUpgradeProfileResourcesByFleetGeneratedByMaximumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewAutoUpgradeProfilesClient().NewListByFleetPager("rgfleets", "fleet1", 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 = armcontainerservicefleet.AutoUpgradeProfilesClientListByFleetResponse{ + // AutoUpgradeProfileListResult: armcontainerservicefleet.AutoUpgradeProfileListResult{ + // Value: []*armcontainerservicefleet.AutoUpgradeProfile{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/autoUpgradeProfiles/autoupgradeprofile1"), + // Name: to.Ptr("autoupgradeprofile1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/autoUpgradeProfiles"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("@contoso.com"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // LastModifiedBy: to.Ptr("@contoso.com"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // }, + // Properties: &armcontainerservicefleet.AutoUpgradeProfileProperties{ + // ProvisioningState: to.Ptr(armcontainerservicefleet.AutoUpgradeProfileProvisioningStateSucceeded), + // Channel: to.Ptr(armcontainerservicefleet.UpgradeChannelStable), + // UpdateStrategyID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.ContainerService/fleets/fleet1/updateStrategies/strategy1"), + // NodeImageSelection: &armcontainerservicefleet.AutoUpgradeNodeImageSelection{ + // Type: to.Ptr(armcontainerservicefleet.AutoUpgradeNodeImageSelectionTypeLatest), + // }, + // Disabled: to.Ptr(true), + // AutoUpgradeProfileStatus: &armcontainerservicefleet.AutoUpgradeProfileStatus{ + // LastTriggeredAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-27T02:49:14.736Z"); return t}()), + // LastTriggerStatus: to.Ptr(armcontainerservicefleet.AutoUpgradeLastTriggerStatusSucceeded), + // LastTriggerError: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("mohtaimtrqkhivtsopwiuveg"), + // Message: to.Ptr("t"), + // Target: to.Ptr("axgswjixhofej"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("oorrhg"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // LastTriggerUpgradeVersions: []*string{ + // to.Ptr("twqzpwqov"), + // }, + // }, + // }, + // ETag: to.Ptr("\"EtagValue\""), + // }, + // }, + // NextLink: to.Ptr("http://nextlink.contoso.com"), + // }, + // } } } diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/build.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/build.go deleted file mode 100644 index af3985306f3a..000000000000 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/build.go +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -// This file enables 'go generate' to regenerate this specific SDK -//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -alwaysSetBodyParamRequired -removeUnreferencedTypes resourcemanager/containerservicefleet/armcontainerservicefleet - -package armcontainerservicefleet diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/client_factory.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/client_factory.go index d5c0c71cef16..3b54d86a35f1 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/client_factory.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/client_factory.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // 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) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armcontainerservicefleet @@ -22,7 +18,7 @@ type ClientFactory struct { // NewClientFactory creates a new instance of ClientFactory with the specified values. // The parameter values will be propagated to any client created from this factory. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { @@ -36,6 +32,14 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } +// NewAutoUpgradeProfileOperationsClient creates a new instance of AutoUpgradeProfileOperationsClient. +func (c *ClientFactory) NewAutoUpgradeProfileOperationsClient() *AutoUpgradeProfileOperationsClient { + return &AutoUpgradeProfileOperationsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewAutoUpgradeProfilesClient creates a new instance of AutoUpgradeProfilesClient. func (c *ClientFactory) NewAutoUpgradeProfilesClient() *AutoUpgradeProfilesClient { return &AutoUpgradeProfilesClient{ diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/constants.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/constants.go index a65253c6507c..40297af39ba2 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/constants.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/constants.go @@ -1,22 +1,19 @@ -//go:build go1.18 -// +build go1.18 - // 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) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armcontainerservicefleet const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet" - moduleVersion = "v1.3.0-beta.1" + moduleVersion = "v2.0.0" ) -// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +// ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. type ActionType string const ( + // ActionTypeInternal - Actions are for internal-only APIs. ActionTypeInternal ActionType = "Internal" ) @@ -27,6 +24,25 @@ func PossibleActionTypeValues() []ActionType { } } +// AutoUpgradeLastTriggerStatus - AutoUpgradeLastTriggerStatus is the status of the last AutoUpgrade trigger (attempt to automatically +// create and start UpdateRun when there are new released versions) of an auto upgrade profile. +type AutoUpgradeLastTriggerStatus string + +const ( + // AutoUpgradeLastTriggerStatusFailed - The last AutoUpgrade trigger failed. + AutoUpgradeLastTriggerStatusFailed AutoUpgradeLastTriggerStatus = "Failed" + // AutoUpgradeLastTriggerStatusSucceeded - The last AutoUpgrade trigger was succeeded. + AutoUpgradeLastTriggerStatusSucceeded AutoUpgradeLastTriggerStatus = "Succeeded" +) + +// PossibleAutoUpgradeLastTriggerStatusValues returns the possible values for the AutoUpgradeLastTriggerStatus const type. +func PossibleAutoUpgradeLastTriggerStatusValues() []AutoUpgradeLastTriggerStatus { + return []AutoUpgradeLastTriggerStatus{ + AutoUpgradeLastTriggerStatusFailed, + AutoUpgradeLastTriggerStatusSucceeded, + } +} + // AutoUpgradeNodeImageSelectionType - The node image upgrade type. type AutoUpgradeNodeImageSelectionType string @@ -74,14 +90,18 @@ func PossibleAutoUpgradeProfileProvisioningStateValues() []AutoUpgradeProfilePro } } -// CreatedByType - The type of identity that created the resource. +// CreatedByType - The kind of entity that created the resource. type CreatedByType string const ( - CreatedByTypeApplication CreatedByType = "Application" - CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeApplication - The entity was created by an application. + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey - The entity was created by a key. + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity - The entity was created by a managed identity. CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - CreatedByTypeUser CreatedByType = "User" + // CreatedByTypeUser - The entity was created by a user. + CreatedByTypeUser CreatedByType = "User" ) // PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. @@ -203,18 +223,22 @@ func PossibleManagedClusterUpgradeTypeValues() []ManagedClusterUpgradeType { type ManagedServiceIdentityType string const ( - ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" - ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" - ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned, UserAssigned" - ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" + // ManagedServiceIdentityTypeNone - No managed identity. + ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" + // ManagedServiceIdentityTypeSystemAndUserAssigned - System and user assigned managed identity. + ManagedServiceIdentityTypeSystemAndUserAssigned ManagedServiceIdentityType = "SystemAssigned, UserAssigned" + // ManagedServiceIdentityTypeSystemAssigned - System assigned managed identity. + ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + // ManagedServiceIdentityTypeUserAssigned - User assigned managed identity. + ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" ) // PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type. func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { return []ManagedServiceIdentityType{ ManagedServiceIdentityTypeNone, + ManagedServiceIdentityTypeSystemAndUserAssigned, ManagedServiceIdentityTypeSystemAssigned, - ManagedServiceIdentityTypeSystemAssignedUserAssigned, ManagedServiceIdentityTypeUserAssigned, } } @@ -253,8 +277,11 @@ func PossibleNodeImageSelectionTypeValues() []NodeImageSelectionType { type Origin string const ( - OriginSystem Origin = "system" - OriginUser Origin = "user" + // OriginSystem - Indicates the operation is initiated by a system. + OriginSystem Origin = "system" + // OriginUser - Indicates the operation is initiated by a user. + OriginUser Origin = "user" + // OriginUserSystem - Indicates the operation is initiated by a user or system. OriginUserSystem Origin = "user,system" ) diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/autoupgradeprofileoperations_server.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/autoupgradeprofileoperations_server.go new file mode 100644 index 000000000000..9168aad37c02 --- /dev/null +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/autoupgradeprofileoperations_server.go @@ -0,0 +1,140 @@ +// 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 ( + "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/resourcemanager/containerservicefleet/armcontainerservicefleet/v2" + "net/http" + "net/url" + "regexp" +) + +// AutoUpgradeProfileOperationsServer is a fake server for instances of the armcontainerservicefleet.AutoUpgradeProfileOperationsClient type. +type AutoUpgradeProfileOperationsServer struct { + // BeginGenerateUpdateRun is the fake for method AutoUpgradeProfileOperationsClient.BeginGenerateUpdateRun + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginGenerateUpdateRun func(ctx context.Context, resourceGroupName string, fleetName string, autoUpgradeProfileName string, options *armcontainerservicefleet.AutoUpgradeProfileOperationsClientBeginGenerateUpdateRunOptions) (resp azfake.PollerResponder[armcontainerservicefleet.AutoUpgradeProfileOperationsClientGenerateUpdateRunResponse], errResp azfake.ErrorResponder) +} + +// NewAutoUpgradeProfileOperationsServerTransport creates a new instance of AutoUpgradeProfileOperationsServerTransport with the provided implementation. +// The returned AutoUpgradeProfileOperationsServerTransport instance is connected to an instance of armcontainerservicefleet.AutoUpgradeProfileOperationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAutoUpgradeProfileOperationsServerTransport(srv *AutoUpgradeProfileOperationsServer) *AutoUpgradeProfileOperationsServerTransport { + return &AutoUpgradeProfileOperationsServerTransport{ + srv: srv, + beginGenerateUpdateRun: newTracker[azfake.PollerResponder[armcontainerservicefleet.AutoUpgradeProfileOperationsClientGenerateUpdateRunResponse]](), + } +} + +// AutoUpgradeProfileOperationsServerTransport connects instances of armcontainerservicefleet.AutoUpgradeProfileOperationsClient to instances of AutoUpgradeProfileOperationsServer. +// Don't use this type directly, use NewAutoUpgradeProfileOperationsServerTransport instead. +type AutoUpgradeProfileOperationsServerTransport struct { + srv *AutoUpgradeProfileOperationsServer + beginGenerateUpdateRun *tracker[azfake.PollerResponder[armcontainerservicefleet.AutoUpgradeProfileOperationsClientGenerateUpdateRunResponse]] +} + +// Do implements the policy.Transporter interface for AutoUpgradeProfileOperationsServerTransport. +func (a *AutoUpgradeProfileOperationsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return a.dispatchToMethodFake(req, method) +} + +func (a *AutoUpgradeProfileOperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if autoUpgradeProfileOperationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = autoUpgradeProfileOperationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AutoUpgradeProfileOperationsClient.BeginGenerateUpdateRun": + res.resp, res.err = a.dispatchBeginGenerateUpdateRun(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (a *AutoUpgradeProfileOperationsServerTransport) dispatchBeginGenerateUpdateRun(req *http.Request) (*http.Response, error) { + if a.srv.BeginGenerateUpdateRun == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginGenerateUpdateRun not implemented")} + } + beginGenerateUpdateRun := a.beginGenerateUpdateRun.get(req) + if beginGenerateUpdateRun == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ContainerService/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/autoUpgradeProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/generateUpdateRun` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + autoUpgradeProfileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("autoUpgradeProfileName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginGenerateUpdateRun(req.Context(), resourceGroupNameParam, fleetNameParam, autoUpgradeProfileNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginGenerateUpdateRun = &respr + a.beginGenerateUpdateRun.add(req, beginGenerateUpdateRun) + } + + resp, err := server.PollerResponderNext(beginGenerateUpdateRun, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + a.beginGenerateUpdateRun.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginGenerateUpdateRun) { + a.beginGenerateUpdateRun.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to AutoUpgradeProfileOperationsServerTransport +var autoUpgradeProfileOperationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/autoupgradeprofiles_server.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/autoupgradeprofiles_server.go index f4db2aff7a44..154a02e0d586 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/autoupgradeprofiles_server.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/autoupgradeprofiles_server.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // 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) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,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/containerservicefleet/armcontainerservicefleet" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/v2" "net/http" "net/url" "regexp" @@ -29,7 +25,7 @@ type AutoUpgradeProfilesServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, fleetName string, autoUpgradeProfileName string, resource armcontainerservicefleet.AutoUpgradeProfile, options *armcontainerservicefleet.AutoUpgradeProfilesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armcontainerservicefleet.AutoUpgradeProfilesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method AutoUpgradeProfilesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, fleetName string, autoUpgradeProfileName string, options *armcontainerservicefleet.AutoUpgradeProfilesClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontainerservicefleet.AutoUpgradeProfilesClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method AutoUpgradeProfilesClient.Get @@ -70,27 +66,46 @@ func (a *AutoUpgradeProfilesServerTransport) Do(req *http.Request) (*http.Respon return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - switch method { - case "AutoUpgradeProfilesClient.BeginCreateOrUpdate": - resp, err = a.dispatchBeginCreateOrUpdate(req) - case "AutoUpgradeProfilesClient.BeginDelete": - resp, err = a.dispatchBeginDelete(req) - case "AutoUpgradeProfilesClient.Get": - resp, err = a.dispatchGet(req) - case "AutoUpgradeProfilesClient.NewListByFleetPager": - resp, err = a.dispatchNewListByFleetPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *AutoUpgradeProfilesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if autoUpgradeProfilesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = autoUpgradeProfilesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AutoUpgradeProfilesClient.BeginCreateOrUpdate": + res.resp, res.err = a.dispatchBeginCreateOrUpdate(req) + case "AutoUpgradeProfilesClient.BeginDelete": + res.resp, res.err = a.dispatchBeginDelete(req) + case "AutoUpgradeProfilesClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AutoUpgradeProfilesClient.NewListByFleetPager": + res.resp, res.err = a.dispatchNewListByFleetPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *AutoUpgradeProfilesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -198,9 +213,9 @@ func (a *AutoUpgradeProfilesServerTransport) dispatchBeginDelete(req *http.Reque return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { a.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { a.beginDelete.remove(req) @@ -286,3 +301,9 @@ func (a *AutoUpgradeProfilesServerTransport) dispatchNewListByFleetPager(req *ht } return resp, nil } + +// set this to conditionally intercept incoming requests to AutoUpgradeProfilesServerTransport +var autoUpgradeProfilesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/fleetmembers_server.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/fleetmembers_server.go index 3f5589bdcde9..5510e78d075f 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/fleetmembers_server.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/fleetmembers_server.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // 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) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,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/containerservicefleet/armcontainerservicefleet" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/v2" "net/http" "net/url" "regexp" @@ -40,9 +36,9 @@ type FleetMembersServer struct { // HTTP status codes to indicate success: http.StatusOK NewListByFleetPager func(resourceGroupName string, fleetName string, options *armcontainerservicefleet.FleetMembersClientListByFleetOptions) (resp azfake.PagerResponder[armcontainerservicefleet.FleetMembersClientListByFleetResponse]) - // BeginUpdate is the fake for method FleetMembersClient.BeginUpdate + // BeginUpdateAsync is the fake for method FleetMembersClient.BeginUpdateAsync // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, fleetName string, fleetMemberName string, properties armcontainerservicefleet.FleetMemberUpdate, options *armcontainerservicefleet.FleetMembersClientBeginUpdateOptions) (resp azfake.PollerResponder[armcontainerservicefleet.FleetMembersClientUpdateResponse], errResp azfake.ErrorResponder) + BeginUpdateAsync func(ctx context.Context, resourceGroupName string, fleetName string, fleetMemberName string, properties armcontainerservicefleet.FleetMemberUpdate, options *armcontainerservicefleet.FleetMembersClientBeginUpdateAsyncOptions) (resp azfake.PollerResponder[armcontainerservicefleet.FleetMembersClientUpdateAsyncResponse], errResp azfake.ErrorResponder) } // NewFleetMembersServerTransport creates a new instance of FleetMembersServerTransport with the provided implementation. @@ -54,7 +50,7 @@ func NewFleetMembersServerTransport(srv *FleetMembersServer) *FleetMembersServer beginCreate: newTracker[azfake.PollerResponder[armcontainerservicefleet.FleetMembersClientCreateResponse]](), beginDelete: newTracker[azfake.PollerResponder[armcontainerservicefleet.FleetMembersClientDeleteResponse]](), newListByFleetPager: newTracker[azfake.PagerResponder[armcontainerservicefleet.FleetMembersClientListByFleetResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armcontainerservicefleet.FleetMembersClientUpdateResponse]](), + beginUpdateAsync: newTracker[azfake.PollerResponder[armcontainerservicefleet.FleetMembersClientUpdateAsyncResponse]](), } } @@ -65,7 +61,7 @@ type FleetMembersServerTransport struct { beginCreate *tracker[azfake.PollerResponder[armcontainerservicefleet.FleetMembersClientCreateResponse]] beginDelete *tracker[azfake.PollerResponder[armcontainerservicefleet.FleetMembersClientDeleteResponse]] newListByFleetPager *tracker[azfake.PagerResponder[armcontainerservicefleet.FleetMembersClientListByFleetResponse]] - beginUpdate *tracker[azfake.PollerResponder[armcontainerservicefleet.FleetMembersClientUpdateResponse]] + beginUpdateAsync *tracker[azfake.PollerResponder[armcontainerservicefleet.FleetMembersClientUpdateAsyncResponse]] } // Do implements the policy.Transporter interface for FleetMembersServerTransport. @@ -76,29 +72,48 @@ func (f *FleetMembersServerTransport) Do(req *http.Request) (*http.Response, err return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return f.dispatchToMethodFake(req, method) +} - switch method { - case "FleetMembersClient.BeginCreate": - resp, err = f.dispatchBeginCreate(req) - case "FleetMembersClient.BeginDelete": - resp, err = f.dispatchBeginDelete(req) - case "FleetMembersClient.Get": - resp, err = f.dispatchGet(req) - case "FleetMembersClient.NewListByFleetPager": - resp, err = f.dispatchNewListByFleetPager(req) - case "FleetMembersClient.BeginUpdate": - resp, err = f.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (f *FleetMembersServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if fleetMembersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = fleetMembersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "FleetMembersClient.BeginCreate": + res.resp, res.err = f.dispatchBeginCreate(req) + case "FleetMembersClient.BeginDelete": + res.resp, res.err = f.dispatchBeginDelete(req) + case "FleetMembersClient.Get": + res.resp, res.err = f.dispatchGet(req) + case "FleetMembersClient.NewListByFleetPager": + res.resp, res.err = f.dispatchNewListByFleetPager(req) + case "FleetMembersClient.BeginUpdateAsync": + res.resp, res.err = f.dispatchBeginUpdateAsync(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (f *FleetMembersServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -295,12 +310,12 @@ func (f *FleetMembersServerTransport) dispatchNewListByFleetPager(req *http.Requ return resp, nil } -func (f *FleetMembersServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if f.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} +func (f *FleetMembersServerTransport) dispatchBeginUpdateAsync(req *http.Request) (*http.Response, error) { + if f.srv.BeginUpdateAsync == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdateAsync not implemented")} } - beginUpdate := f.beginUpdate.get(req) - if beginUpdate == nil { + beginUpdateAsync := f.beginUpdateAsync.get(req) + if beginUpdateAsync == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ContainerService/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/members/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) @@ -324,32 +339,38 @@ func (f *FleetMembersServerTransport) dispatchBeginUpdate(req *http.Request) (*h if err != nil { return nil, err } - var options *armcontainerservicefleet.FleetMembersClientBeginUpdateOptions + var options *armcontainerservicefleet.FleetMembersClientBeginUpdateAsyncOptions if ifMatchParam != nil { - options = &armcontainerservicefleet.FleetMembersClientBeginUpdateOptions{ + options = &armcontainerservicefleet.FleetMembersClientBeginUpdateAsyncOptions{ IfMatch: ifMatchParam, } } - respr, errRespr := f.srv.BeginUpdate(req.Context(), resourceGroupNameParam, fleetNameParam, fleetMemberNameParam, body, options) + respr, errRespr := f.srv.BeginUpdateAsync(req.Context(), resourceGroupNameParam, fleetNameParam, fleetMemberNameParam, body, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } - beginUpdate = &respr - f.beginUpdate.add(req, beginUpdate) + beginUpdateAsync = &respr + f.beginUpdateAsync.add(req, beginUpdateAsync) } - resp, err := server.PollerResponderNext(beginUpdate, req) + resp, err := server.PollerResponderNext(beginUpdateAsync, req) if err != nil { return nil, err } if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - f.beginUpdate.remove(req) + f.beginUpdateAsync.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } - if !server.PollerResponderMore(beginUpdate) { - f.beginUpdate.remove(req) + if !server.PollerResponderMore(beginUpdateAsync) { + f.beginUpdateAsync.remove(req) } return resp, nil } + +// set this to conditionally intercept incoming requests to FleetMembersServerTransport +var fleetMembersServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/fleets_server.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/fleets_server.go index 45fca320662f..93b412ac75ce 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/fleets_server.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/fleets_server.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // 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) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,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/containerservicefleet/armcontainerservicefleet" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/v2" "net/http" "net/url" "regexp" @@ -24,9 +20,9 @@ import ( // FleetsServer is a fake server for instances of the armcontainerservicefleet.FleetsClient type. type FleetsServer struct { - // BeginCreateOrUpdate is the fake for method FleetsClient.BeginCreateOrUpdate + // BeginCreate is the fake for method FleetsClient.BeginCreate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, fleetName string, resource armcontainerservicefleet.Fleet, options *armcontainerservicefleet.FleetsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armcontainerservicefleet.FleetsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + BeginCreate func(ctx context.Context, resourceGroupName string, fleetName string, resource armcontainerservicefleet.Fleet, options *armcontainerservicefleet.FleetsClientBeginCreateOptions) (resp azfake.PollerResponder[armcontainerservicefleet.FleetsClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method FleetsClient.BeginDelete // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent @@ -48,9 +44,9 @@ type FleetsServer struct { // HTTP status codes to indicate success: http.StatusOK ListCredentials func(ctx context.Context, resourceGroupName string, fleetName string, options *armcontainerservicefleet.FleetsClientListCredentialsOptions) (resp azfake.Responder[armcontainerservicefleet.FleetsClientListCredentialsResponse], errResp azfake.ErrorResponder) - // BeginUpdate is the fake for method FleetsClient.BeginUpdate + // BeginUpdateAsync is the fake for method FleetsClient.BeginUpdateAsync // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, fleetName string, properties armcontainerservicefleet.FleetPatch, options *armcontainerservicefleet.FleetsClientBeginUpdateOptions) (resp azfake.PollerResponder[armcontainerservicefleet.FleetsClientUpdateResponse], errResp azfake.ErrorResponder) + BeginUpdateAsync func(ctx context.Context, resourceGroupName string, fleetName string, properties armcontainerservicefleet.FleetPatch, options *armcontainerservicefleet.FleetsClientBeginUpdateAsyncOptions) (resp azfake.PollerResponder[armcontainerservicefleet.FleetsClientUpdateAsyncResponse], errResp azfake.ErrorResponder) } // NewFleetsServerTransport creates a new instance of FleetsServerTransport with the provided implementation. @@ -59,11 +55,11 @@ type FleetsServer struct { func NewFleetsServerTransport(srv *FleetsServer) *FleetsServerTransport { return &FleetsServerTransport{ srv: srv, - beginCreateOrUpdate: newTracker[azfake.PollerResponder[armcontainerservicefleet.FleetsClientCreateOrUpdateResponse]](), + beginCreate: newTracker[azfake.PollerResponder[armcontainerservicefleet.FleetsClientCreateResponse]](), beginDelete: newTracker[azfake.PollerResponder[armcontainerservicefleet.FleetsClientDeleteResponse]](), newListByResourceGroupPager: newTracker[azfake.PagerResponder[armcontainerservicefleet.FleetsClientListByResourceGroupResponse]](), newListBySubscriptionPager: newTracker[azfake.PagerResponder[armcontainerservicefleet.FleetsClientListBySubscriptionResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armcontainerservicefleet.FleetsClientUpdateResponse]](), + beginUpdateAsync: newTracker[azfake.PollerResponder[armcontainerservicefleet.FleetsClientUpdateAsyncResponse]](), } } @@ -71,11 +67,11 @@ func NewFleetsServerTransport(srv *FleetsServer) *FleetsServerTransport { // Don't use this type directly, use NewFleetsServerTransport instead. type FleetsServerTransport struct { srv *FleetsServer - beginCreateOrUpdate *tracker[azfake.PollerResponder[armcontainerservicefleet.FleetsClientCreateOrUpdateResponse]] + beginCreate *tracker[azfake.PollerResponder[armcontainerservicefleet.FleetsClientCreateResponse]] beginDelete *tracker[azfake.PollerResponder[armcontainerservicefleet.FleetsClientDeleteResponse]] newListByResourceGroupPager *tracker[azfake.PagerResponder[armcontainerservicefleet.FleetsClientListByResourceGroupResponse]] newListBySubscriptionPager *tracker[azfake.PagerResponder[armcontainerservicefleet.FleetsClientListBySubscriptionResponse]] - beginUpdate *tracker[azfake.PollerResponder[armcontainerservicefleet.FleetsClientUpdateResponse]] + beginUpdateAsync *tracker[azfake.PollerResponder[armcontainerservicefleet.FleetsClientUpdateAsyncResponse]] } // Do implements the policy.Transporter interface for FleetsServerTransport. @@ -86,41 +82,60 @@ func (f *FleetsServerTransport) Do(req *http.Request) (*http.Response, error) { return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "FleetsClient.BeginCreateOrUpdate": - resp, err = f.dispatchBeginCreateOrUpdate(req) - case "FleetsClient.BeginDelete": - resp, err = f.dispatchBeginDelete(req) - case "FleetsClient.Get": - resp, err = f.dispatchGet(req) - case "FleetsClient.NewListByResourceGroupPager": - resp, err = f.dispatchNewListByResourceGroupPager(req) - case "FleetsClient.NewListBySubscriptionPager": - resp, err = f.dispatchNewListBySubscriptionPager(req) - case "FleetsClient.ListCredentials": - resp, err = f.dispatchListCredentials(req) - case "FleetsClient.BeginUpdate": - resp, err = f.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return f.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (f *FleetsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - return resp, nil + go func() { + var intercepted bool + var res result + if fleetsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = fleetsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "FleetsClient.BeginCreate": + res.resp, res.err = f.dispatchBeginCreate(req) + case "FleetsClient.BeginDelete": + res.resp, res.err = f.dispatchBeginDelete(req) + case "FleetsClient.Get": + res.resp, res.err = f.dispatchGet(req) + case "FleetsClient.NewListByResourceGroupPager": + res.resp, res.err = f.dispatchNewListByResourceGroupPager(req) + case "FleetsClient.NewListBySubscriptionPager": + res.resp, res.err = f.dispatchNewListBySubscriptionPager(req) + case "FleetsClient.ListCredentials": + res.resp, res.err = f.dispatchListCredentials(req) + case "FleetsClient.BeginUpdateAsync": + res.resp, res.err = f.dispatchBeginUpdateAsync(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } -func (f *FleetsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { - if f.srv.BeginCreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} +func (f *FleetsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if f.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} } - beginCreateOrUpdate := f.beginCreateOrUpdate.get(req) - if beginCreateOrUpdate == nil { + beginCreate := f.beginCreate.get(req) + if beginCreate == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ContainerService/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) @@ -141,32 +156,32 @@ func (f *FleetsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) ( if err != nil { return nil, err } - var options *armcontainerservicefleet.FleetsClientBeginCreateOrUpdateOptions + var options *armcontainerservicefleet.FleetsClientBeginCreateOptions if ifMatchParam != nil || ifNoneMatchParam != nil { - options = &armcontainerservicefleet.FleetsClientBeginCreateOrUpdateOptions{ + options = &armcontainerservicefleet.FleetsClientBeginCreateOptions{ IfMatch: ifMatchParam, IfNoneMatch: ifNoneMatchParam, } } - respr, errRespr := f.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, fleetNameParam, body, options) + respr, errRespr := f.srv.BeginCreate(req.Context(), resourceGroupNameParam, fleetNameParam, body, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } - beginCreateOrUpdate = &respr - f.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + beginCreate = &respr + f.beginCreate.add(req, beginCreate) } - resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + resp, err := server.PollerResponderNext(beginCreate, req) if err != nil { return nil, err } if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - f.beginCreateOrUpdate.remove(req) + f.beginCreate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} } - if !server.PollerResponderMore(beginCreateOrUpdate) { - f.beginCreateOrUpdate.remove(req) + if !server.PollerResponderMore(beginCreate) { + f.beginCreate.remove(req) } return resp, nil @@ -359,12 +374,12 @@ func (f *FleetsServerTransport) dispatchListCredentials(req *http.Request) (*htt return resp, nil } -func (f *FleetsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if f.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} +func (f *FleetsServerTransport) dispatchBeginUpdateAsync(req *http.Request) (*http.Response, error) { + if f.srv.BeginUpdateAsync == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdateAsync not implemented")} } - beginUpdate := f.beginUpdate.get(req) - if beginUpdate == nil { + beginUpdateAsync := f.beginUpdateAsync.get(req) + if beginUpdateAsync == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ContainerService/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) @@ -384,32 +399,38 @@ func (f *FleetsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Re if err != nil { return nil, err } - var options *armcontainerservicefleet.FleetsClientBeginUpdateOptions + var options *armcontainerservicefleet.FleetsClientBeginUpdateAsyncOptions if ifMatchParam != nil { - options = &armcontainerservicefleet.FleetsClientBeginUpdateOptions{ + options = &armcontainerservicefleet.FleetsClientBeginUpdateAsyncOptions{ IfMatch: ifMatchParam, } } - respr, errRespr := f.srv.BeginUpdate(req.Context(), resourceGroupNameParam, fleetNameParam, body, options) + respr, errRespr := f.srv.BeginUpdateAsync(req.Context(), resourceGroupNameParam, fleetNameParam, body, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } - beginUpdate = &respr - f.beginUpdate.add(req, beginUpdate) + beginUpdateAsync = &respr + f.beginUpdateAsync.add(req, beginUpdateAsync) } - resp, err := server.PollerResponderNext(beginUpdate, req) + resp, err := server.PollerResponderNext(beginUpdateAsync, req) if err != nil { return nil, err } if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - f.beginUpdate.remove(req) + f.beginUpdateAsync.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } - if !server.PollerResponderMore(beginUpdate) { - f.beginUpdate.remove(req) + if !server.PollerResponderMore(beginUpdateAsync) { + f.beginUpdateAsync.remove(req) } return resp, nil } + +// set this to conditionally intercept incoming requests to FleetsServerTransport +var fleetsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/fleetupdatestrategies_server.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/fleetupdatestrategies_server.go index f869771262c6..ad3efdce1551 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/fleetupdatestrategies_server.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/fleetupdatestrategies_server.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // 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) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,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/containerservicefleet/armcontainerservicefleet" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/v2" "net/http" "net/url" "regexp" @@ -70,27 +66,46 @@ func (f *FleetUpdateStrategiesServerTransport) Do(req *http.Request) (*http.Resp return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return f.dispatchToMethodFake(req, method) +} - switch method { - case "FleetUpdateStrategiesClient.BeginCreateOrUpdate": - resp, err = f.dispatchBeginCreateOrUpdate(req) - case "FleetUpdateStrategiesClient.BeginDelete": - resp, err = f.dispatchBeginDelete(req) - case "FleetUpdateStrategiesClient.Get": - resp, err = f.dispatchGet(req) - case "FleetUpdateStrategiesClient.NewListByFleetPager": - resp, err = f.dispatchNewListByFleetPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (f *FleetUpdateStrategiesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if fleetUpdateStrategiesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = fleetUpdateStrategiesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "FleetUpdateStrategiesClient.BeginCreateOrUpdate": + res.resp, res.err = f.dispatchBeginCreateOrUpdate(req) + case "FleetUpdateStrategiesClient.BeginDelete": + res.resp, res.err = f.dispatchBeginDelete(req) + case "FleetUpdateStrategiesClient.Get": + res.resp, res.err = f.dispatchGet(req) + case "FleetUpdateStrategiesClient.NewListByFleetPager": + res.resp, res.err = f.dispatchNewListByFleetPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (f *FleetUpdateStrategiesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -286,3 +301,9 @@ func (f *FleetUpdateStrategiesServerTransport) dispatchNewListByFleetPager(req * } return resp, nil } + +// set this to conditionally intercept incoming requests to FleetUpdateStrategiesServerTransport +var fleetUpdateStrategiesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/internal.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/internal.go index 45777d4ec6e6..9989d5e3cd32 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/internal.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/internal.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // 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) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -15,6 +11,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/operations_server.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/operations_server.go index 6f01311229b5..3a6624f7e967 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/operations_server.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/operations_server.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // 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) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -15,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/containerservicefleet/armcontainerservicefleet" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/v2" "net/http" ) @@ -51,21 +47,40 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return o.dispatchToMethodFake(req, method) +} - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -94,3 +109,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/server_factory.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/server_factory.go index 3ba6844c6da4..ec875121cfce 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/server_factory.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/server_factory.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // 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) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -19,12 +15,26 @@ import ( // ServerFactory is a fake server for instances of the armcontainerservicefleet.ClientFactory type. type ServerFactory struct { - AutoUpgradeProfilesServer AutoUpgradeProfilesServer - FleetMembersServer FleetMembersServer + // AutoUpgradeProfileOperationsServer contains the fakes for client AutoUpgradeProfileOperationsClient + AutoUpgradeProfileOperationsServer AutoUpgradeProfileOperationsServer + + // AutoUpgradeProfilesServer contains the fakes for client AutoUpgradeProfilesClient + AutoUpgradeProfilesServer AutoUpgradeProfilesServer + + // FleetMembersServer contains the fakes for client FleetMembersClient + FleetMembersServer FleetMembersServer + + // FleetUpdateStrategiesServer contains the fakes for client FleetUpdateStrategiesClient FleetUpdateStrategiesServer FleetUpdateStrategiesServer - FleetsServer FleetsServer - OperationsServer OperationsServer - UpdateRunsServer UpdateRunsServer + + // FleetsServer contains the fakes for client FleetsClient + FleetsServer FleetsServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // UpdateRunsServer contains the fakes for client UpdateRunsClient + UpdateRunsServer UpdateRunsServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -39,14 +49,15 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { // ServerFactoryTransport connects instances of armcontainerservicefleet.ClientFactory to instances of ServerFactory. // Don't use this type directly, use NewServerFactoryTransport instead. type ServerFactoryTransport struct { - srv *ServerFactory - trMu sync.Mutex - trAutoUpgradeProfilesServer *AutoUpgradeProfilesServerTransport - trFleetMembersServer *FleetMembersServerTransport - trFleetUpdateStrategiesServer *FleetUpdateStrategiesServerTransport - trFleetsServer *FleetsServerTransport - trOperationsServer *OperationsServerTransport - trUpdateRunsServer *UpdateRunsServerTransport + srv *ServerFactory + trMu sync.Mutex + trAutoUpgradeProfileOperationsServer *AutoUpgradeProfileOperationsServerTransport + trAutoUpgradeProfilesServer *AutoUpgradeProfilesServerTransport + trFleetMembersServer *FleetMembersServerTransport + trFleetUpdateStrategiesServer *FleetUpdateStrategiesServerTransport + trFleetsServer *FleetsServerTransport + trOperationsServer *OperationsServerTransport + trUpdateRunsServer *UpdateRunsServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -62,6 +73,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { var err error switch client { + case "AutoUpgradeProfileOperationsClient": + initServer(s, &s.trAutoUpgradeProfileOperationsServer, func() *AutoUpgradeProfileOperationsServerTransport { + return NewAutoUpgradeProfileOperationsServerTransport(&s.srv.AutoUpgradeProfileOperationsServer) + }) + resp, err = s.trAutoUpgradeProfileOperationsServer.Do(req) case "AutoUpgradeProfilesClient": initServer(s, &s.trAutoUpgradeProfilesServer, func() *AutoUpgradeProfilesServerTransport { return NewAutoUpgradeProfilesServerTransport(&s.srv.AutoUpgradeProfilesServer) diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/time_rfc3339.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/time_rfc3339.go index 81f308b0d343..87ee11e83b32 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/time_rfc3339.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/time_rfc3339.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // 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) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -60,6 +56,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } 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 diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/updateruns_server.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/updateruns_server.go index 667eef902627..de271a627605 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/updateruns_server.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fake/updateruns_server.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // 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) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,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/containerservicefleet/armcontainerservicefleet" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/v2" "net/http" "net/url" "regexp" @@ -88,33 +84,52 @@ func (u *UpdateRunsServerTransport) Do(req *http.Request) (*http.Response, error return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "UpdateRunsClient.BeginCreateOrUpdate": - resp, err = u.dispatchBeginCreateOrUpdate(req) - case "UpdateRunsClient.BeginDelete": - resp, err = u.dispatchBeginDelete(req) - case "UpdateRunsClient.Get": - resp, err = u.dispatchGet(req) - case "UpdateRunsClient.NewListByFleetPager": - resp, err = u.dispatchNewListByFleetPager(req) - case "UpdateRunsClient.BeginSkip": - resp, err = u.dispatchBeginSkip(req) - case "UpdateRunsClient.BeginStart": - resp, err = u.dispatchBeginStart(req) - case "UpdateRunsClient.BeginStop": - resp, err = u.dispatchBeginStop(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return u.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (u *UpdateRunsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if updateRunsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = updateRunsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "UpdateRunsClient.BeginCreateOrUpdate": + res.resp, res.err = u.dispatchBeginCreateOrUpdate(req) + case "UpdateRunsClient.BeginDelete": + res.resp, res.err = u.dispatchBeginDelete(req) + case "UpdateRunsClient.Get": + res.resp, res.err = u.dispatchGet(req) + case "UpdateRunsClient.NewListByFleetPager": + res.resp, res.err = u.dispatchNewListByFleetPager(req) + case "UpdateRunsClient.BeginSkip": + res.resp, res.err = u.dispatchBeginSkip(req) + case "UpdateRunsClient.BeginStart": + res.resp, res.err = u.dispatchBeginStart(req) + case "UpdateRunsClient.BeginStop": + res.resp, res.err = u.dispatchBeginStop(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (u *UpdateRunsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -479,3 +494,9 @@ func (u *UpdateRunsServerTransport) dispatchBeginStop(req *http.Request) (*http. return resp, nil } + +// set this to conditionally intercept incoming requests to UpdateRunsServerTransport +var updateRunsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetmembers_client.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetmembers_client.go index a79ef12a30d5..b14f24be90f7 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetmembers_client.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetmembers_client.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // 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) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armcontainerservicefleet @@ -28,7 +24,7 @@ type FleetMembersClient struct { } // NewFleetMembersClient creates a new instance of FleetMembersClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewFleetMembersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FleetMembersClient, error) { @@ -46,7 +42,7 @@ func NewFleetMembersClient(subscriptionID string, credential azcore.TokenCredent // BeginCreate - Create a FleetMember // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fleetName - The name of the Fleet resource. // - fleetMemberName - The name of the Fleet member resource. @@ -74,7 +70,7 @@ func (client *FleetMembersClient) BeginCreate(ctx context.Context, resourceGroup // Create - Create a FleetMember // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 func (client *FleetMembersClient) create(ctx context.Context, resourceGroupName string, fleetName string, fleetMemberName string, resource FleetMember, options *FleetMembersClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "FleetMembersClient.BeginCreate" @@ -120,7 +116,7 @@ func (client *FleetMembersClient) createCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-02-preview") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.IfMatch != nil { @@ -129,6 +125,7 @@ func (client *FleetMembersClient) createCreateRequest(ctx context.Context, resou if options != nil && options.IfNoneMatch != nil { req.Raw().Header["If-None-Match"] = []string{*options.IfNoneMatch} } + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } @@ -138,7 +135,7 @@ func (client *FleetMembersClient) createCreateRequest(ctx context.Context, resou // BeginDelete - Delete a FleetMember // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fleetName - The name of the Fleet resource. // - fleetMemberName - The name of the Fleet member resource. @@ -151,8 +148,7 @@ func (client *FleetMembersClient) BeginDelete(ctx context.Context, resourceGroup return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetMembersClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -165,7 +161,7 @@ func (client *FleetMembersClient) BeginDelete(ctx context.Context, resourceGroup // Delete - Delete a FleetMember // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 func (client *FleetMembersClient) deleteOperation(ctx context.Context, resourceGroupName string, fleetName string, fleetMemberName string, options *FleetMembersClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "FleetMembersClient.BeginDelete" @@ -211,7 +207,7 @@ func (client *FleetMembersClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-02-preview") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.IfMatch != nil { @@ -223,7 +219,7 @@ func (client *FleetMembersClient) deleteCreateRequest(ctx context.Context, resou // Get - Get a FleetMember // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fleetName - The name of the Fleet resource. // - fleetMemberName - The name of the Fleet member resource. @@ -251,7 +247,7 @@ func (client *FleetMembersClient) Get(ctx context.Context, resourceGroupName str } // getCreateRequest creates the Get request. -func (client *FleetMembersClient) getCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetMemberName string, options *FleetMembersClientGetOptions) (*policy.Request, error) { +func (client *FleetMembersClient) getCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetMemberName string, _ *FleetMembersClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -274,7 +270,7 @@ func (client *FleetMembersClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-02-preview") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -291,7 +287,7 @@ func (client *FleetMembersClient) getHandleResponse(resp *http.Response) (FleetM // NewListByFleetPager - List FleetMember resources by Fleet // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fleetName - The name of the Fleet resource. // - options - FleetMembersClientListByFleetOptions contains the optional parameters for the FleetMembersClient.NewListByFleetPager @@ -320,7 +316,7 @@ func (client *FleetMembersClient) NewListByFleetPager(resourceGroupName string, } // listByFleetCreateRequest creates the ListByFleet request. -func (client *FleetMembersClient) listByFleetCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, options *FleetMembersClientListByFleetOptions) (*policy.Request, error) { +func (client *FleetMembersClient) listByFleetCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, _ *FleetMembersClientListByFleetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -339,7 +335,7 @@ func (client *FleetMembersClient) listByFleetCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-02-preview") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -354,45 +350,44 @@ func (client *FleetMembersClient) listByFleetHandleResponse(resp *http.Response) return result, nil } -// BeginUpdate - Update a FleetMember +// BeginUpdateAsync - Update a FleetMember // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fleetName - The name of the Fleet resource. // - fleetMemberName - The name of the Fleet member resource. // - properties - The resource properties to be updated. -// - options - FleetMembersClientBeginUpdateOptions contains the optional parameters for the FleetMembersClient.BeginUpdate +// - options - FleetMembersClientBeginUpdateAsyncOptions contains the optional parameters for the FleetMembersClient.BeginUpdateAsync // method. -func (client *FleetMembersClient) BeginUpdate(ctx context.Context, resourceGroupName string, fleetName string, fleetMemberName string, properties FleetMemberUpdate, options *FleetMembersClientBeginUpdateOptions) (*runtime.Poller[FleetMembersClientUpdateResponse], error) { +func (client *FleetMembersClient) BeginUpdateAsync(ctx context.Context, resourceGroupName string, fleetName string, fleetMemberName string, properties FleetMemberUpdate, options *FleetMembersClientBeginUpdateAsyncOptions) (*runtime.Poller[FleetMembersClientUpdateAsyncResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, fleetName, fleetMemberName, properties, options) + resp, err := client.updateAsync(ctx, resourceGroupName, fleetName, fleetMemberName, properties, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetMembersClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaOriginalURI, - Tracer: client.internal.Tracer(), + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetMembersClientUpdateAsyncResponse]{ + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetMembersClientUpdateResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetMembersClientUpdateAsyncResponse]{ Tracer: client.internal.Tracer(), }) } } -// Update - Update a FleetMember +// UpdateAsync - Update a FleetMember // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview -func (client *FleetMembersClient) update(ctx context.Context, resourceGroupName string, fleetName string, fleetMemberName string, properties FleetMemberUpdate, options *FleetMembersClientBeginUpdateOptions) (*http.Response, error) { +// Generated from API version 2025-03-01 +func (client *FleetMembersClient) updateAsync(ctx context.Context, resourceGroupName string, fleetName string, fleetMemberName string, properties FleetMemberUpdate, options *FleetMembersClientBeginUpdateAsyncOptions) (*http.Response, error) { var err error - const operationName = "FleetMembersClient.BeginUpdate" + const operationName = "FleetMembersClient.BeginUpdateAsync" 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, fleetName, fleetMemberName, properties, options) + req, err := client.updateAsyncCreateRequest(ctx, resourceGroupName, fleetName, fleetMemberName, properties, options) if err != nil { return nil, err } @@ -407,8 +402,8 @@ func (client *FleetMembersClient) update(ctx context.Context, resourceGroupName return httpResp, nil } -// updateCreateRequest creates the Update request. -func (client *FleetMembersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetMemberName string, properties FleetMemberUpdate, options *FleetMembersClientBeginUpdateOptions) (*policy.Request, error) { +// updateAsyncCreateRequest creates the UpdateAsync request. +func (client *FleetMembersClient) updateAsyncCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetMemberName string, properties FleetMemberUpdate, options *FleetMembersClientBeginUpdateAsyncOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -431,12 +426,13 @@ func (client *FleetMembersClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-02-preview") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} } + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetmembers_client_example_test.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetmembers_client_example_test.go index 21e936a12e32..aa5ce71989c7 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetmembers_client_example_test.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetmembers_client_example_test.go @@ -1,125 +1,163 @@ -//go:build go1.18 -// +build go1.18 - // 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) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armcontainerservicefleet_test import ( "context" - "log" - "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/containerservicefleet/armcontainerservicefleet" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/FleetMembers_ListByFleet.json -func ExampleFleetMembersClient_NewListByFleetPager() { +// Generated from example definition: 2025-03-01/FleetMembers_Create.json +func ExampleFleetMembersClient_BeginCreate_createsAFleetMemberResourceWithALongRunningOperation() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewFleetMembersClient().NewListByFleetPager("rg1", "fleet1", 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.FleetMemberListResult = armcontainerservicefleet.FleetMemberListResult{ - // Value: []*armcontainerservicefleet.FleetMember{ - // { - // Name: to.Ptr("member-1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets/members"), - // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet-1/members/member-1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // CreatedBy: to.Ptr("someUser"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // LastModifiedBy: to.Ptr("someOtherUser"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // ETag: to.Ptr("kd30rkdfo49="), - // Properties: &armcontainerservicefleet.FleetMemberProperties{ - // ClusterResourceID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster-1"), - // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetMemberProvisioningStateSucceeded), - // }, - // }}, - // } + poller, err := clientFactory.NewFleetMembersClient().BeginCreate(ctx, "rg1", "fleet1", "member-1", armcontainerservicefleet.FleetMember{ + Properties: &armcontainerservicefleet.FleetMemberProperties{ + ClusterResourceID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster-1"), + }, + }, 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 = armcontainerservicefleet.FleetMembersClientCreateResponse{ + // FleetMember: &armcontainerservicefleet.FleetMember{ + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet-1/members/member-1"), + // Name: to.Ptr("member-1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/members"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("someUser"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // LastModifiedBy: to.Ptr("someOtherUser"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // }, + // ETag: to.Ptr("23ujdflewrj3="), + // Properties: &armcontainerservicefleet.FleetMemberProperties{ + // ClusterResourceID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster-1"), + // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetMemberProvisioningStateSucceeded), + // Status: &armcontainerservicefleet.FleetMemberStatus{ + // LastOperationID: to.Ptr("operation-12345"), + // LastOperationError: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("None"), + // Message: to.Ptr("No error"), + // }, + // }, + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/FleetMembers_Get.json -func ExampleFleetMembersClient_Get() { +// Generated from example definition: 2025-03-01/FleetMembers_Create_MaximumSet_Gen.json +func ExampleFleetMembersClient_BeginCreate_createsAFleetMemberResourceWithALongRunningOperationGeneratedByMaximumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewFleetMembersClient().Get(ctx, "rg1", "fleet1", "member-1", nil) + poller, err := clientFactory.NewFleetMembersClient().BeginCreate(ctx, "rgfleets", "fleet1", "fleet1", armcontainerservicefleet.FleetMember{ + Properties: &armcontainerservicefleet.FleetMemberProperties{ + ClusterResourceID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster-1"), + Group: to.Ptr("fleet1"), + }, + }, &FleetMembersClientBeginCreateOptions{ + ifMatch: to.Ptr("amkttadbw"), + ifNoneMatch: to.Ptr("zoljoccbcg")}) 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.FleetMember = armcontainerservicefleet.FleetMember{ - // Name: to.Ptr("member-1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets/members"), - // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet-1/members/member-1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // CreatedBy: to.Ptr("someUser"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // LastModifiedBy: to.Ptr("someOtherUser"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // ETag: to.Ptr("kd30rkdfo49="), - // Properties: &armcontainerservicefleet.FleetMemberProperties{ - // ClusterResourceID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster-1"), - // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetMemberProvisioningStateSucceeded), + // res = armcontainerservicefleet.FleetMembersClientCreateResponse{ + // FleetMember: &armcontainerservicefleet.FleetMember{ + // Properties: &armcontainerservicefleet.FleetMemberProperties{ + // ClusterResourceID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster-1"), + // Group: to.Ptr("fleet1"), + // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetMemberProvisioningStateSucceeded), + // }, + // ETag: to.Ptr("kd30rkdfo49="), + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet-1/members/member-1"), + // Name: to.Ptr("member-1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/members"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("someUser"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // LastModifiedBy: to.Ptr("someOtherUser"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/FleetMembers_Create.json -func ExampleFleetMembersClient_BeginCreate() { +// Generated from example definition: 2025-03-01/FleetMembers_Delete.json +func ExampleFleetMembersClient_BeginDelete_deletesAFleetMemberResourceAsynchronouslyWithALongRunningOperation() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewFleetMembersClient().BeginCreate(ctx, "rg1", "fleet1", "member-1", armcontainerservicefleet.FleetMember{ - Properties: &armcontainerservicefleet.FleetMemberProperties{ - ClusterResourceID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster-1"), - }, - }, &armcontainerservicefleet.FleetMembersClientBeginCreateOptions{IfMatch: nil, - IfNoneMatch: nil, - }) + poller, err := clientFactory.NewFleetMembersClient().BeginDelete(ctx, "rg1", "fleet1", "member-1", 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 = armcontainerservicefleet.FleetMembersClientDeleteResponse{ + // } +} + +// Generated from example definition: 2025-03-01/FleetMembers_Delete_MaximumSet_Gen.json +func ExampleFleetMembersClient_BeginDelete_deletesAFleetMemberResourceAsynchronouslyWithALongRunningOperationGeneratedByMaximumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFleetMembersClient().BeginDelete(ctx, "rgfleets", "fleet1", "fleet1", &FleetMembersClientBeginDeleteOptions{ + ifMatch: to.Ptr("klroqfozx")}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -130,42 +168,221 @@ func ExampleFleetMembersClient_BeginCreate() { // 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.FleetMember = armcontainerservicefleet.FleetMember{ - // Name: to.Ptr("member-1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets/members"), - // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet-1/members/member-1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // CreatedBy: to.Ptr("someUser"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // LastModifiedBy: to.Ptr("someOtherUser"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // res = armcontainerservicefleet.FleetMembersClientDeleteResponse{ + // } +} + +// Generated from example definition: 2025-03-01/FleetMembers_Get.json +func ExampleFleetMembersClient_Get_getsAFleetMemberResource() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFleetMembersClient().Get(ctx, "rg1", "fleet1", "member-1", 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 = armcontainerservicefleet.FleetMembersClientGetResponse{ + // FleetMember: &armcontainerservicefleet.FleetMember{ + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet-1/members/member-1"), + // Name: to.Ptr("member-1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/members"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("someUser"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // LastModifiedBy: to.Ptr("someOtherUser"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // }, + // ETag: to.Ptr("kd30rkdfo49="), + // Properties: &armcontainerservicefleet.FleetMemberProperties{ + // ClusterResourceID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster-1"), + // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetMemberProvisioningStateSucceeded), + // Status: &armcontainerservicefleet.FleetMemberStatus{ + // LastOperationID: to.Ptr("operation-12345"), + // LastOperationError: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("None"), + // Message: to.Ptr("No error"), + // }, + // }, + // }, // }, - // ETag: to.Ptr("23ujdflewrj3="), - // Properties: &armcontainerservicefleet.FleetMemberProperties{ - // ClusterResourceID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster-1"), - // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetMemberProvisioningStateSucceeded), + // } +} + +// Generated from example definition: 2025-03-01/FleetMembers_Get_MaximumSet_Gen.json +func ExampleFleetMembersClient_Get_getsAFleetMemberResourceGeneratedByMaximumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFleetMembersClient().Get(ctx, "rgfleets", "fleet1", "fleet1", 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 = armcontainerservicefleet.FleetMembersClientGetResponse{ + // FleetMember: &armcontainerservicefleet.FleetMember{ + // Properties: &armcontainerservicefleet.FleetMemberProperties{ + // ClusterResourceID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster-1"), + // Group: to.Ptr("fleet1"), + // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetMemberProvisioningStateSucceeded), + // }, + // ETag: to.Ptr("kd30rkdfo49="), + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet-1/members/member-1"), + // Name: to.Ptr("member-1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/members"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("someUser"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // LastModifiedBy: to.Ptr("someOtherUser"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/FleetMembers_Update.json -func ExampleFleetMembersClient_BeginUpdate() { +// Generated from example definition: 2025-03-01/FleetMembers_ListByFleet.json +func ExampleFleetMembersClient_NewListByFleetPager_listsTheMembersOfAFleet() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewFleetMembersClient().BeginUpdate(ctx, "rg1", "fleet1", "member-1", armcontainerservicefleet.FleetMemberUpdate{ + pager := clientFactory.NewFleetMembersClient().NewListByFleetPager("rg1", "fleet1", 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 = armcontainerservicefleet.FleetMembersClientListByFleetResponse{ + // FleetMemberListResult: armcontainerservicefleet.FleetMemberListResult{ + // Value: []*armcontainerservicefleet.FleetMember{ + // { + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet-1/members/member-1"), + // Name: to.Ptr("member-1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/members"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("someUser"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // LastModifiedBy: to.Ptr("someOtherUser"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // }, + // ETag: to.Ptr("kd30rkdfo49="), + // Properties: &armcontainerservicefleet.FleetMemberProperties{ + // ClusterResourceID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster-1"), + // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetMemberProvisioningStateSucceeded), + // Status: &armcontainerservicefleet.FleetMemberStatus{ + // LastOperationID: to.Ptr("operation-12345"), + // LastOperationError: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("None"), + // Message: to.Ptr("No error"), + // }, + // }, + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2025-03-01/FleetMembers_ListByFleet_MaximumSet_Gen.json +func ExampleFleetMembersClient_NewListByFleetPager_listsTheMembersOfAFleetGeneratedByMaximumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewFleetMembersClient().NewListByFleetPager("rgfleets", "fleet1", 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 = armcontainerservicefleet.FleetMembersClientListByFleetResponse{ + // FleetMemberListResult: armcontainerservicefleet.FleetMemberListResult{ + // Value: []*armcontainerservicefleet.FleetMember{ + // { + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet-1/members/member-1"), + // Name: to.Ptr("member-1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/members"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("someUser"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // LastModifiedBy: to.Ptr("someOtherUser"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // }, + // ETag: to.Ptr("kd30rkdfo49="), + // Properties: &armcontainerservicefleet.FleetMemberProperties{ + // ClusterResourceID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster-1"), + // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetMemberProvisioningStateSucceeded), + // Group: to.Ptr("fleet1"), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2025-03-01/FleetMembers_Update.json +func ExampleFleetMembersClient_BeginUpdateAsync_updatesAFleetMemberResourceSynchronously() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFleetMembersClient().BeginUpdateAsync(ctx, "rg1", "fleet1", "member-1", armcontainerservicefleet.FleetMemberUpdate{ Properties: &armcontainerservicefleet.FleetMemberUpdateProperties{ Group: to.Ptr("staging"), }, - }, &armcontainerservicefleet.FleetMembersClientBeginUpdateOptions{IfMatch: nil}) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -176,44 +393,82 @@ func ExampleFleetMembersClient_BeginUpdate() { // 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.FleetMember = armcontainerservicefleet.FleetMember{ - // Name: to.Ptr("member-1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets/members"), - // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet-1/members/member-1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // CreatedBy: to.Ptr("someUser"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // LastModifiedBy: to.Ptr("someOtherUser"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // ETag: to.Ptr("23ujdflewrj3="), - // Properties: &armcontainerservicefleet.FleetMemberProperties{ - // ClusterResourceID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster-1"), - // Group: to.Ptr("staging"), - // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetMemberProvisioningStateSucceeded), + // res = armcontainerservicefleet.FleetMembersClientUpdateAsyncResponse{ + // FleetMember: &armcontainerservicefleet.FleetMember{ + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet-1/members/member-1"), + // Name: to.Ptr("member-1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/members"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("someUser"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // LastModifiedBy: to.Ptr("someOtherUser"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // }, + // ETag: to.Ptr("23ujdflewrj3="), + // Properties: &armcontainerservicefleet.FleetMemberProperties{ + // ClusterResourceID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster-1"), + // Group: to.Ptr("staging"), + // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetMemberProvisioningStateSucceeded), + // Status: &armcontainerservicefleet.FleetMemberStatus{ + // LastOperationID: to.Ptr("operation-12345"), + // LastOperationError: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("None"), + // Message: to.Ptr("No error"), + // }, + // }, + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/FleetMembers_Delete.json -func ExampleFleetMembersClient_BeginDelete() { +// Generated from example definition: 2025-03-01/FleetMembers_Update_MaximumSet_Gen.json +func ExampleFleetMembersClient_BeginUpdateAsync_updatesAFleetMemberResourceSynchronouslyGeneratedByMaximumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewFleetMembersClient().BeginDelete(ctx, "rg1", "fleet1", "member-1", &armcontainerservicefleet.FleetMembersClientBeginDeleteOptions{IfMatch: nil}) + poller, err := clientFactory.NewFleetMembersClient().BeginUpdateAsync(ctx, "rgfleets", "fleet1", "fleet1", armcontainerservicefleet.FleetMemberUpdate{ + Properties: &armcontainerservicefleet.FleetMemberUpdateProperties{ + Group: to.Ptr("staging"), + }, + }, &FleetMembersClientBeginUpdateAsyncOptions{ + ifMatch: to.Ptr("bjyjzzxvbs")}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + 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 = armcontainerservicefleet.FleetMembersClientUpdateAsyncResponse{ + // FleetMember: &armcontainerservicefleet.FleetMember{ + // Properties: &armcontainerservicefleet.FleetMemberProperties{ + // ClusterResourceID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster-1"), + // Group: to.Ptr("fleet1"), + // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetMemberProvisioningStateSucceeded), + // }, + // ETag: to.Ptr("kd30rkdfo49="), + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet-1/members/member-1"), + // Name: to.Ptr("member-1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/members"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("someUser"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // LastModifiedBy: to.Ptr("someOtherUser"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // }, + // }, + // } } diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleets_client.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleets_client.go index 57259487a072..c2fa040cef4a 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleets_client.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleets_client.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // 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) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armcontainerservicefleet @@ -28,7 +24,7 @@ type FleetsClient struct { } // NewFleetsClient creates a new instance of FleetsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewFleetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FleetsClient, error) { @@ -43,44 +39,43 @@ func NewFleetsClient(subscriptionID string, credential azcore.TokenCredential, o return client, nil } -// BeginCreateOrUpdate - Creates or updates a Fleet. +// BeginCreate - Creates or updates a Fleet. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fleetName - The name of the Fleet resource. // - resource - Resource create parameters. -// - options - FleetsClientBeginCreateOrUpdateOptions contains the optional parameters for the FleetsClient.BeginCreateOrUpdate -// method. -func (client *FleetsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, resource Fleet, options *FleetsClientBeginCreateOrUpdateOptions) (*runtime.Poller[FleetsClientCreateOrUpdateResponse], error) { +// - options - FleetsClientBeginCreateOptions contains the optional parameters for the FleetsClient.BeginCreate method. +func (client *FleetsClient) BeginCreate(ctx context.Context, resourceGroupName string, fleetName string, resource Fleet, options *FleetsClientBeginCreateOptions) (*runtime.Poller[FleetsClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, fleetName, resource, options) + resp, err := client.create(ctx, resourceGroupName, fleetName, resource, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetsClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetsClientCreateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetsClientCreateOrUpdateResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetsClientCreateResponse]{ Tracer: client.internal.Tracer(), }) } } -// CreateOrUpdate - Creates or updates a Fleet. +// Create - Creates or updates a Fleet. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview -func (client *FleetsClient) createOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, resource Fleet, options *FleetsClientBeginCreateOrUpdateOptions) (*http.Response, error) { +// Generated from API version 2025-03-01 +func (client *FleetsClient) create(ctx context.Context, resourceGroupName string, fleetName string, resource Fleet, options *FleetsClientBeginCreateOptions) (*http.Response, error) { var err error - const operationName = "FleetsClient.BeginCreateOrUpdate" + const operationName = "FleetsClient.BeginCreate" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, fleetName, resource, options) + req, err := client.createCreateRequest(ctx, resourceGroupName, fleetName, resource, options) if err != nil { return nil, err } @@ -95,8 +90,8 @@ func (client *FleetsClient) createOrUpdate(ctx context.Context, resourceGroupNam return httpResp, nil } -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *FleetsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, resource Fleet, options *FleetsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +// createCreateRequest creates the Create request. +func (client *FleetsClient) createCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, resource Fleet, options *FleetsClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -115,7 +110,7 @@ func (client *FleetsClient) createOrUpdateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-02-preview") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.IfMatch != nil { @@ -124,6 +119,7 @@ func (client *FleetsClient) createOrUpdateCreateRequest(ctx context.Context, res if options != nil && options.IfNoneMatch != nil { req.Raw().Header["If-None-Match"] = []string{*options.IfNoneMatch} } + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } @@ -133,7 +129,7 @@ func (client *FleetsClient) createOrUpdateCreateRequest(ctx context.Context, res // BeginDelete - Delete a Fleet // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fleetName - The name of the Fleet resource. // - options - FleetsClientBeginDeleteOptions contains the optional parameters for the FleetsClient.BeginDelete method. @@ -144,8 +140,7 @@ func (client *FleetsClient) BeginDelete(ctx context.Context, resourceGroupName s return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -158,7 +153,7 @@ func (client *FleetsClient) BeginDelete(ctx context.Context, resourceGroupName s // Delete - Delete a Fleet // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 func (client *FleetsClient) deleteOperation(ctx context.Context, resourceGroupName string, fleetName string, options *FleetsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "FleetsClient.BeginDelete" @@ -200,7 +195,7 @@ func (client *FleetsClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-02-preview") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.IfMatch != nil { @@ -212,7 +207,7 @@ func (client *FleetsClient) deleteCreateRequest(ctx context.Context, resourceGro // Get - Gets a Fleet. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fleetName - The name of the Fleet resource. // - options - FleetsClientGetOptions contains the optional parameters for the FleetsClient.Get method. @@ -239,7 +234,7 @@ func (client *FleetsClient) Get(ctx context.Context, resourceGroupName string, f } // getCreateRequest creates the Get request. -func (client *FleetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, options *FleetsClientGetOptions) (*policy.Request, error) { +func (client *FleetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, _ *FleetsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -258,7 +253,7 @@ func (client *FleetsClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-02-preview") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -275,7 +270,7 @@ func (client *FleetsClient) getHandleResponse(resp *http.Response) (FleetsClient // NewListByResourceGroupPager - Lists fleets in the specified subscription and resource group. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - FleetsClientListByResourceGroupOptions contains the optional parameters for the FleetsClient.NewListByResourceGroupPager // method. @@ -303,7 +298,7 @@ func (client *FleetsClient) NewListByResourceGroupPager(resourceGroupName string } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *FleetsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *FleetsClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *FleetsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *FleetsClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -318,7 +313,7 @@ func (client *FleetsClient) listByResourceGroupCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-02-preview") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -335,7 +330,7 @@ func (client *FleetsClient) listByResourceGroupHandleResponse(resp *http.Respons // NewListBySubscriptionPager - Lists fleets in the specified subscription. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 // - options - FleetsClientListBySubscriptionOptions contains the optional parameters for the FleetsClient.NewListBySubscriptionPager // method. func (client *FleetsClient) NewListBySubscriptionPager(options *FleetsClientListBySubscriptionOptions) *runtime.Pager[FleetsClientListBySubscriptionResponse] { @@ -362,7 +357,7 @@ func (client *FleetsClient) NewListBySubscriptionPager(options *FleetsClientList } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *FleetsClient) listBySubscriptionCreateRequest(ctx context.Context, options *FleetsClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *FleetsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *FleetsClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -373,7 +368,7 @@ func (client *FleetsClient) listBySubscriptionCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-02-preview") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -391,7 +386,7 @@ func (client *FleetsClient) listBySubscriptionHandleResponse(resp *http.Response // ListCredentials - Lists the user credentials of a Fleet. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fleetName - The name of the Fleet resource. // - options - FleetsClientListCredentialsOptions contains the optional parameters for the FleetsClient.ListCredentials method. @@ -418,7 +413,7 @@ func (client *FleetsClient) ListCredentials(ctx context.Context, resourceGroupNa } // listCredentialsCreateRequest creates the ListCredentials request. -func (client *FleetsClient) listCredentialsCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, options *FleetsClientListCredentialsOptions) (*policy.Request, error) { +func (client *FleetsClient) listCredentialsCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, _ *FleetsClientListCredentialsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -437,7 +432,7 @@ func (client *FleetsClient) listCredentialsCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-02-preview") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -452,43 +447,42 @@ func (client *FleetsClient) listCredentialsHandleResponse(resp *http.Response) ( return result, nil } -// BeginUpdate - Update a Fleet +// BeginUpdateAsync - Update a Fleet // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fleetName - The name of the Fleet resource. // - properties - The resource properties to be updated. -// - options - FleetsClientBeginUpdateOptions contains the optional parameters for the FleetsClient.BeginUpdate method. -func (client *FleetsClient) BeginUpdate(ctx context.Context, resourceGroupName string, fleetName string, properties FleetPatch, options *FleetsClientBeginUpdateOptions) (*runtime.Poller[FleetsClientUpdateResponse], error) { +// - options - FleetsClientBeginUpdateAsyncOptions contains the optional parameters for the FleetsClient.BeginUpdateAsync method. +func (client *FleetsClient) BeginUpdateAsync(ctx context.Context, resourceGroupName string, fleetName string, properties FleetPatch, options *FleetsClientBeginUpdateAsyncOptions) (*runtime.Poller[FleetsClientUpdateAsyncResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, fleetName, properties, options) + resp, err := client.updateAsync(ctx, resourceGroupName, fleetName, properties, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetsClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaOriginalURI, - Tracer: client.internal.Tracer(), + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetsClientUpdateAsyncResponse]{ + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetsClientUpdateResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetsClientUpdateAsyncResponse]{ Tracer: client.internal.Tracer(), }) } } -// Update - Update a Fleet +// UpdateAsync - Update a Fleet // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview -func (client *FleetsClient) update(ctx context.Context, resourceGroupName string, fleetName string, properties FleetPatch, options *FleetsClientBeginUpdateOptions) (*http.Response, error) { +// Generated from API version 2025-03-01 +func (client *FleetsClient) updateAsync(ctx context.Context, resourceGroupName string, fleetName string, properties FleetPatch, options *FleetsClientBeginUpdateAsyncOptions) (*http.Response, error) { var err error - const operationName = "FleetsClient.BeginUpdate" + const operationName = "FleetsClient.BeginUpdateAsync" 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, fleetName, properties, options) + req, err := client.updateAsyncCreateRequest(ctx, resourceGroupName, fleetName, properties, options) if err != nil { return nil, err } @@ -503,8 +497,8 @@ func (client *FleetsClient) update(ctx context.Context, resourceGroupName string return httpResp, nil } -// updateCreateRequest creates the Update request. -func (client *FleetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, properties FleetPatch, options *FleetsClientBeginUpdateOptions) (*policy.Request, error) { +// updateAsyncCreateRequest creates the UpdateAsync request. +func (client *FleetsClient) updateAsyncCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, properties FleetPatch, options *FleetsClientBeginUpdateAsyncOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -523,12 +517,13 @@ func (client *FleetsClient) updateCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-02-preview") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} } + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleets_client_example_test.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleets_client_example_test.go index 8c6610a6f34f..f25992a0a897 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleets_client_example_test.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleets_client_example_test.go @@ -1,35 +1,385 @@ -//go:build go1.18 -// +build go1.18 - // 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) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armcontainerservicefleet_test import ( "context" - "log" - "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/containerservicefleet/armcontainerservicefleet" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/Fleets_ListBySub.json -func ExampleFleetsClient_NewListBySubscriptionPager() { +// Generated from example definition: 2025-03-01/Fleets_CreateOrUpdate.json +func ExampleFleetsClient_BeginCreate_createsAFleetResourceWithALongRunningOperation() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewFleetsClient().NewListBySubscriptionPager(nil) + poller, err := clientFactory.NewFleetsClient().BeginCreate(ctx, "rg1", "fleet1", armcontainerservicefleet.Fleet{ + Tags: map[string]*string{ + "tier": to.Ptr("production"), + "archv2": to.Ptr(""), + }, + Location: to.Ptr("East US"), + Properties: &armcontainerservicefleet.FleetProperties{ + HubProfile: &armcontainerservicefleet.FleetHubProfile{ + DNSPrefix: to.Ptr("dnsprefix1"), + AgentProfile: &armcontainerservicefleet.AgentProfile{ + VMSize: to.Ptr("Standard_DS1"), + }, + }, + }, + }, 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 = armcontainerservicefleet.FleetsClientCreateResponse{ + // Fleet: &armcontainerservicefleet.Fleet{ + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet-1"), + // Name: to.Ptr("fleet-1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("someUser"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // LastModifiedBy: to.Ptr("someOtherUser"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // }, + // Tags: map[string]*string{ + // "tier": to.Ptr("production"), + // "archv2": to.Ptr(""), + // }, + // Location: to.Ptr("East US"), + // ETag: to.Ptr("23ujdflewrj3="), + // Properties: &armcontainerservicefleet.FleetProperties{ + // HubProfile: &armcontainerservicefleet.FleetHubProfile{ + // DNSPrefix: to.Ptr("dnsprefix1"), + // Fqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), + // PortalFqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), + // KubernetesVersion: to.Ptr("1.22.4"), + // AgentProfile: &armcontainerservicefleet.AgentProfile{ + // VMSize: to.Ptr("Standard_DS1"), + // }, + // }, + // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetProvisioningStateUpdating), + // Status: &armcontainerservicefleet.FleetStatus{ + // LastOperationID: to.Ptr("operation-12345"), + // LastOperationError: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("None"), + // Message: to.Ptr("No error"), + // }, + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2025-03-01/Fleets_CreateOrUpdate_MaximumSet_Gen.json +func ExampleFleetsClient_BeginCreate_createsAFleetResourceWithALongRunningOperationGeneratedByMaximumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFleetsClient().BeginCreate(ctx, "rgfleets", "fleet1", armcontainerservicefleet.Fleet{ + Tags: map[string]*string{}, + Location: to.Ptr("East US"), + Properties: &armcontainerservicefleet.FleetProperties{ + HubProfile: &armcontainerservicefleet.FleetHubProfile{ + DNSPrefix: to.Ptr("dnsprefix1"), + AgentProfile: &armcontainerservicefleet.AgentProfile{ + VMSize: to.Ptr("Standard_DS1"), + SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.Network/virtualNetwork/myvnet/subnets/mysubnet1"), + }, + APIServerAccessProfile: &armcontainerservicefleet.APIServerAccessProfile{ + EnablePrivateCluster: to.Ptr(true), + EnableVnetIntegration: to.Ptr(true), + SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.Network/virtualNetwork/myvnet/subnets/mysubnet1"), + }, + }, + }, + Identity: &armcontainerservicefleet.ManagedServiceIdentity{ + Type: to.Ptr(armcontainerservicefleet.ManagedServiceIdentityTypeNone), + UserAssignedIdentities: map[string]*armcontainerservicefleet.UserAssignedIdentity{ + "key126": {}, + }, + }, + }, &FleetsClientBeginCreateOptions{ + ifMatch: to.Ptr("jzlrwaylijhsnzp"), + ifNoneMatch: to.Ptr("cqpzdjshmggwolagomzxfy")}) + 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 = armcontainerservicefleet.FleetsClientCreateResponse{ + // Fleet: &armcontainerservicefleet.Fleet{ + // Tags: map[string]*string{ + // }, + // Location: to.Ptr("East US"), + // Properties: &armcontainerservicefleet.FleetProperties{ + // HubProfile: &armcontainerservicefleet.FleetHubProfile{ + // DNSPrefix: to.Ptr("dnsprefix1"), + // AgentProfile: &armcontainerservicefleet.AgentProfile{ + // VMSize: to.Ptr("Standard_DS1"), + // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.Network/virtualNetwork/myvnet/subnets/mysubnet1"), + // }, + // APIServerAccessProfile: &armcontainerservicefleet.APIServerAccessProfile{ + // EnablePrivateCluster: to.Ptr(true), + // EnableVnetIntegration: to.Ptr(true), + // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.Network/virtualNetwork/myvnet/subnets/mysubnet1"), + // }, + // Fqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), + // KubernetesVersion: to.Ptr("1.22.4"), + // PortalFqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), + // }, + // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetProvisioningStateSucceeded), + // }, + // ETag: to.Ptr("23ujdflewrj3="), + // Identity: &armcontainerservicefleet.ManagedServiceIdentity{ + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // Type: to.Ptr(armcontainerservicefleet.ManagedServiceIdentityTypeNone), + // UserAssignedIdentities: map[string]*armcontainerservicefleet.UserAssignedIdentity{ + // "key126": &armcontainerservicefleet.UserAssignedIdentity{ + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // }, + // }, + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet1"), + // Name: to.Ptr("fleet-1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("someUser"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // LastModifiedBy: to.Ptr("someOtherUser"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-03-01/Fleets_Delete.json +func ExampleFleetsClient_BeginDelete_deletesAFleetResourceAsynchronouslyWithALongRunningOperation() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFleetsClient().BeginDelete(ctx, "rg1", "fleet1", 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 = armcontainerservicefleet.FleetsClientDeleteResponse{ + // } +} + +// Generated from example definition: 2025-03-01/Fleets_Delete_MaximumSet_Gen.json +func ExampleFleetsClient_BeginDelete_deletesAFleetResourceAsynchronouslyWithALongRunningOperationGeneratedByMaximumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFleetsClient().BeginDelete(ctx, "rgfleets", "fleet1", &FleetsClientBeginDeleteOptions{ + ifMatch: to.Ptr("crsgokrdxddjsvqxpplerummnmzav")}) + 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 = armcontainerservicefleet.FleetsClientDeleteResponse{ + // } +} + +// Generated from example definition: 2025-03-01/Fleets_Get.json +func ExampleFleetsClient_Get_getsAFleetResource() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFleetsClient().Get(ctx, "rg1", "fleet1", 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 = armcontainerservicefleet.FleetsClientGetResponse{ + // Fleet: &armcontainerservicefleet.Fleet{ + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet-1"), + // Name: to.Ptr("fleet-1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("someUser"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // LastModifiedBy: to.Ptr("someOtherUser"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // }, + // Tags: map[string]*string{ + // "tier": to.Ptr("production"), + // "archv2": to.Ptr(""), + // }, + // Location: to.Ptr("East US"), + // ETag: to.Ptr("23ujdflewrj3="), + // Properties: &armcontainerservicefleet.FleetProperties{ + // HubProfile: &armcontainerservicefleet.FleetHubProfile{ + // DNSPrefix: to.Ptr("dnsprefix1"), + // Fqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), + // PortalFqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), + // KubernetesVersion: to.Ptr("1.22.4"), + // AgentProfile: &armcontainerservicefleet.AgentProfile{ + // VMSize: to.Ptr("Standard_DS1"), + // }, + // }, + // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetProvisioningStateSucceeded), + // Status: &armcontainerservicefleet.FleetStatus{ + // LastOperationID: to.Ptr("operation-12345"), + // LastOperationError: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("None"), + // Message: to.Ptr("No error"), + // }, + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2025-03-01/Fleets_Get_MaximumSet_Gen.json +func ExampleFleetsClient_Get_getsAFleetResourceGeneratedByMaximumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFleetsClient().Get(ctx, "rgfleets", "fleet1", 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 = armcontainerservicefleet.FleetsClientGetResponse{ + // Fleet: &armcontainerservicefleet.Fleet{ + // Tags: map[string]*string{ + // }, + // Location: to.Ptr("East US"), + // Properties: &armcontainerservicefleet.FleetProperties{ + // HubProfile: &armcontainerservicefleet.FleetHubProfile{ + // DNSPrefix: to.Ptr("dnsprefix1"), + // AgentProfile: &armcontainerservicefleet.AgentProfile{ + // VMSize: to.Ptr("Standard_DS1"), + // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.Network/virtualNetwork/myvnet/subnets/mysubnet1"), + // }, + // APIServerAccessProfile: &armcontainerservicefleet.APIServerAccessProfile{ + // EnablePrivateCluster: to.Ptr(true), + // EnableVnetIntegration: to.Ptr(true), + // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.Network/virtualNetwork/myvnet/subnets/mysubnet1"), + // }, + // Fqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), + // KubernetesVersion: to.Ptr("1.22.4"), + // PortalFqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), + // }, + // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetProvisioningStateSucceeded), + // }, + // ETag: to.Ptr("23ujdflewrj3="), + // Identity: &armcontainerservicefleet.ManagedServiceIdentity{ + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // Type: to.Ptr(armcontainerservicefleet.ManagedServiceIdentityTypeNone), + // UserAssignedIdentities: map[string]*armcontainerservicefleet.UserAssignedIdentity{ + // "key126": &armcontainerservicefleet.UserAssignedIdentity{ + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // }, + // }, + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet1"), + // Name: to.Ptr("fleet-1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("someUser"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // LastModifiedBy: to.Ptr("someOtherUser"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-03-01/Fleets_ListByResourceGroup.json +func ExampleFleetsClient_NewListByResourceGroupPager_listsTheFleetResourcesInAResourceGroup() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewFleetsClient().NewListByResourceGroupPager("rg1", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -40,55 +390,65 @@ func ExampleFleetsClient_NewListBySubscriptionPager() { _ = 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.FleetListResult = armcontainerservicefleet.FleetListResult{ - // Value: []*armcontainerservicefleet.Fleet{ - // { - // Name: to.Ptr("fleet-1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets"), - // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // CreatedBy: to.Ptr("someUser"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // LastModifiedBy: to.Ptr("someOtherUser"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // "archv2": to.Ptr(""), - // "tier": to.Ptr("production"), - // }, - // ETag: to.Ptr("23ujdflewrj3="), - // Properties: &armcontainerservicefleet.FleetProperties{ - // HubProfile: &armcontainerservicefleet.FleetHubProfile{ - // AgentProfile: &armcontainerservicefleet.AgentProfile{ - // VMSize: to.Ptr("Standard_DS1"), + // page = armcontainerservicefleet.FleetsClientListByResourceGroupResponse{ + // FleetListResult: armcontainerservicefleet.FleetListResult{ + // Value: []*armcontainerservicefleet.Fleet{ + // { + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet-1"), + // Name: to.Ptr("fleet1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("someUser"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // LastModifiedBy: to.Ptr("someOtherUser"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // }, + // Tags: map[string]*string{ + // "tier": to.Ptr("production"), + // "archv2": to.Ptr(""), + // }, + // Location: to.Ptr("East US"), + // ETag: to.Ptr("23ujdflewrj3="), + // Properties: &armcontainerservicefleet.FleetProperties{ + // HubProfile: &armcontainerservicefleet.FleetHubProfile{ + // DNSPrefix: to.Ptr("dnsprefix1"), + // Fqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), + // PortalFqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), + // KubernetesVersion: to.Ptr("1.22.4"), + // AgentProfile: &armcontainerservicefleet.AgentProfile{ + // VMSize: to.Ptr("Standard_DS1"), + // }, + // }, + // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetProvisioningStateSucceeded), + // Status: &armcontainerservicefleet.FleetStatus{ + // LastOperationID: to.Ptr("operation-12345"), + // LastOperationError: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("None"), + // Message: to.Ptr("No error"), + // }, // }, - // DNSPrefix: to.Ptr("dnsprefix1"), - // Fqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), - // KubernetesVersion: to.Ptr("1.22.4"), - // PortalFqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), // }, - // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetProvisioningStateSucceeded), // }, - // }}, + // }, + // }, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/Fleets_ListByResourceGroup.json -func ExampleFleetsClient_NewListByResourceGroupPager() { +// Generated from example definition: 2025-03-01/Fleets_ListByResourceGroup_MaximumSet_Gen.json +func ExampleFleetsClient_NewListByResourceGroupPager_listsTheFleetResourcesInAResourceGroupGeneratedByMaximumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewFleetsClient().NewListByResourceGroupPager("rg1", nil) + pager := clientFactory.NewFleetsClient().NewListByResourceGroupPager("rgfleets", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -99,182 +459,287 @@ func ExampleFleetsClient_NewListByResourceGroupPager() { _ = 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.FleetListResult = armcontainerservicefleet.FleetListResult{ - // Value: []*armcontainerservicefleet.Fleet{ - // { - // Name: to.Ptr("fleet1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets"), - // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet-1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // CreatedBy: to.Ptr("someUser"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // LastModifiedBy: to.Ptr("someOtherUser"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // page = armcontainerservicefleet.FleetsClientListByResourceGroupResponse{ + // FleetListResult: armcontainerservicefleet.FleetListResult{ + // Value: []*armcontainerservicefleet.Fleet{ + // { + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet1"), + // Name: to.Ptr("fleet-1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("someUser"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // LastModifiedBy: to.Ptr("someOtherUser"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // }, + // Tags: map[string]*string{ + // }, + // Location: to.Ptr("East US"), + // ETag: to.Ptr("23ujdflewrj3="), + // Properties: &armcontainerservicefleet.FleetProperties{ + // HubProfile: &armcontainerservicefleet.FleetHubProfile{ + // DNSPrefix: to.Ptr("dnsprefix1"), + // Fqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), + // PortalFqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), + // KubernetesVersion: to.Ptr("1.22.4"), + // AgentProfile: &armcontainerservicefleet.AgentProfile{ + // VMSize: to.Ptr("Standard_DS1"), + // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.Network/virtualNetwork/myvnet/subnets/mysubnet1"), + // }, + // APIServerAccessProfile: &armcontainerservicefleet.APIServerAccessProfile{ + // EnablePrivateCluster: to.Ptr(true), + // EnableVnetIntegration: to.Ptr(true), + // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.Network/virtualNetwork/myvnet/subnets/mysubnet1"), + // }, + // }, + // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetProvisioningStateSucceeded), + // }, + // Identity: &armcontainerservicefleet.ManagedServiceIdentity{ + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // Type: to.Ptr(armcontainerservicefleet.ManagedServiceIdentityTypeNone), + // UserAssignedIdentities: map[string]*armcontainerservicefleet.UserAssignedIdentity{ + // "key126": &armcontainerservicefleet.UserAssignedIdentity{ + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // }, + // }, // }, - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // "archv2": to.Ptr(""), - // "tier": to.Ptr("production"), + // }, + // NextLink: to.Ptr("https://microsoft.com/adyccxeh"), + // }, + // } + } +} + +// Generated from example definition: 2025-03-01/Fleets_ListBySub.json +func ExampleFleetsClient_NewListBySubscriptionPager_listsTheFleetResourcesInASubscription() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewFleetsClient().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 = armcontainerservicefleet.FleetsClientListBySubscriptionResponse{ + // FleetListResult: armcontainerservicefleet.FleetListResult{ + // Value: []*armcontainerservicefleet.Fleet{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet1"), + // Name: to.Ptr("fleet-1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("someUser"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // LastModifiedBy: to.Ptr("someOtherUser"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // }, + // Tags: map[string]*string{ + // "tier": to.Ptr("production"), + // "archv2": to.Ptr(""), + // }, + // Location: to.Ptr("East US"), + // ETag: to.Ptr("23ujdflewrj3="), + // Properties: &armcontainerservicefleet.FleetProperties{ + // HubProfile: &armcontainerservicefleet.FleetHubProfile{ + // DNSPrefix: to.Ptr("dnsprefix1"), + // Fqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), + // PortalFqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), + // KubernetesVersion: to.Ptr("1.22.4"), + // AgentProfile: &armcontainerservicefleet.AgentProfile{ + // VMSize: to.Ptr("Standard_DS1"), + // }, + // }, + // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetProvisioningStateSucceeded), + // Status: &armcontainerservicefleet.FleetStatus{ + // LastOperationID: to.Ptr("operation-12345"), + // LastOperationError: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("None"), + // Message: to.Ptr("No error"), + // }, + // }, + // }, // }, - // ETag: to.Ptr("23ujdflewrj3="), - // Properties: &armcontainerservicefleet.FleetProperties{ - // HubProfile: &armcontainerservicefleet.FleetHubProfile{ - // AgentProfile: &armcontainerservicefleet.AgentProfile{ - // VMSize: to.Ptr("Standard_DS1"), + // }, + // }, + // } + } +} + +// Generated from example definition: 2025-03-01/Fleets_ListBySubscription_MaximumSet_Gen.json +func ExampleFleetsClient_NewListBySubscriptionPager_listsTheFleetResourcesInASubscriptionGeneratedByMaximumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewFleetsClient().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 = armcontainerservicefleet.FleetsClientListBySubscriptionResponse{ + // FleetListResult: armcontainerservicefleet.FleetListResult{ + // Value: []*armcontainerservicefleet.Fleet{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet1"), + // Name: to.Ptr("fleet-1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("someUser"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // LastModifiedBy: to.Ptr("someOtherUser"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // }, + // Tags: map[string]*string{ + // }, + // Location: to.Ptr("East US"), + // ETag: to.Ptr("23ujdflewrj3="), + // Properties: &armcontainerservicefleet.FleetProperties{ + // HubProfile: &armcontainerservicefleet.FleetHubProfile{ + // DNSPrefix: to.Ptr("dnsprefix1"), + // Fqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), + // PortalFqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), + // KubernetesVersion: to.Ptr("1.22.4"), + // AgentProfile: &armcontainerservicefleet.AgentProfile{ + // VMSize: to.Ptr("Standard_DS1"), + // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.Network/virtualNetwork/myvnet/subnets/mysubnet1"), + // }, + // APIServerAccessProfile: &armcontainerservicefleet.APIServerAccessProfile{ + // EnablePrivateCluster: to.Ptr(true), + // EnableVnetIntegration: to.Ptr(true), + // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.Network/virtualNetwork/myvnet/subnets/mysubnet1"), + // }, + // }, + // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetProvisioningStateSucceeded), + // }, + // Identity: &armcontainerservicefleet.ManagedServiceIdentity{ + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // Type: to.Ptr(armcontainerservicefleet.ManagedServiceIdentityTypeNone), + // UserAssignedIdentities: map[string]*armcontainerservicefleet.UserAssignedIdentity{ + // "key126": &armcontainerservicefleet.UserAssignedIdentity{ + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, // }, - // DNSPrefix: to.Ptr("dnsprefix1"), - // Fqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), - // KubernetesVersion: to.Ptr("1.22.4"), - // PortalFqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), // }, - // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetProvisioningStateSucceeded), // }, - // }}, + // }, + // NextLink: to.Ptr("https://microsoft.com/adyccxeh"), + // }, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/Fleets_Get.json -func ExampleFleetsClient_Get() { +// Generated from example definition: 2025-03-01/Fleets_ListCredentialsResult.json +func ExampleFleetsClient_ListCredentials_listsTheUserCredentialsOfAFleet() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewFleetsClient().Get(ctx, "rg1", "fleet1", nil) + res, err := clientFactory.NewFleetsClient().ListCredentials(ctx, "rg1", "fleet", 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.Fleet = armcontainerservicefleet.Fleet{ - // Name: to.Ptr("fleet-1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets"), - // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet-1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // CreatedBy: to.Ptr("someUser"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // LastModifiedBy: to.Ptr("someOtherUser"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // "archv2": to.Ptr(""), - // "tier": to.Ptr("production"), - // }, - // ETag: to.Ptr("23ujdflewrj3="), - // Properties: &armcontainerservicefleet.FleetProperties{ - // HubProfile: &armcontainerservicefleet.FleetHubProfile{ - // AgentProfile: &armcontainerservicefleet.AgentProfile{ - // VMSize: to.Ptr("Standard_DS1"), + // res = armcontainerservicefleet.FleetsClientListCredentialsResponse{ + // FleetCredentialResults: &armcontainerservicefleet.FleetCredentialResults{ + // Kubeconfigs: []*armcontainerservicefleet.FleetCredentialResult{ + // { + // Name: to.Ptr("credentialName1"), + // Value: []byte("Y3JlZGVudGlhbFZhbHVlMQ=="), // }, - // DNSPrefix: to.Ptr("dnsprefix1"), - // Fqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), - // KubernetesVersion: to.Ptr("1.22.4"), - // PortalFqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), // }, - // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetProvisioningStateSucceeded), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/Fleets_CreateOrUpdate.json -func ExampleFleetsClient_BeginCreateOrUpdate() { +// Generated from example definition: 2025-03-01/Fleets_ListCredentials_MaximumSet_Gen.json +func ExampleFleetsClient_ListCredentials_listsTheUserCredentialsOfAFleetGeneratedByMaximumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewFleetsClient().BeginCreateOrUpdate(ctx, "rg1", "fleet1", armcontainerservicefleet.Fleet{ - Location: to.Ptr("East US"), - Tags: map[string]*string{ - "archv2": to.Ptr(""), - "tier": to.Ptr("production"), - }, - Properties: &armcontainerservicefleet.FleetProperties{ - HubProfile: &armcontainerservicefleet.FleetHubProfile{ - AgentProfile: &armcontainerservicefleet.AgentProfile{ - VMSize: to.Ptr("Standard_DS1"), - }, - DNSPrefix: to.Ptr("dnsprefix1"), - }, - }, - }, &armcontainerservicefleet.FleetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: nil, - }) + res, err := clientFactory.NewFleetsClient().ListCredentials(ctx, "rgfleets", "fleet1", 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.Fleet = armcontainerservicefleet.Fleet{ - // Name: to.Ptr("fleet-1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets"), - // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet-1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // CreatedBy: to.Ptr("someUser"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // LastModifiedBy: to.Ptr("someOtherUser"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // "archv2": to.Ptr(""), - // "tier": to.Ptr("production"), - // }, - // ETag: to.Ptr("23ujdflewrj3="), - // Properties: &armcontainerservicefleet.FleetProperties{ - // HubProfile: &armcontainerservicefleet.FleetHubProfile{ - // AgentProfile: &armcontainerservicefleet.AgentProfile{ - // VMSize: to.Ptr("Standard_DS1"), + // res = armcontainerservicefleet.FleetsClientListCredentialsResponse{ + // FleetCredentialResults: &armcontainerservicefleet.FleetCredentialResults{ + // Kubeconfigs: []*armcontainerservicefleet.FleetCredentialResult{ + // { + // Name: to.Ptr("credentialName1"), + // Value: []byte("Y3JlZGVudGlhbFZhbHVlMQ=="), // }, - // DNSPrefix: to.Ptr("dnsprefix1"), - // Fqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), - // KubernetesVersion: to.Ptr("1.22.4"), - // PortalFqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), // }, - // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetProvisioningStateSucceeded), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/Fleets_PatchTags.json -func ExampleFleetsClient_BeginUpdate() { +// Generated from example definition: 2025-03-01/Fleets_PatchTags.json +func ExampleFleetsClient_BeginUpdateAsync_updateAFleet() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewFleetsClient().BeginUpdate(ctx, "rg1", "fleet1", armcontainerservicefleet.FleetPatch{ + poller, err := clientFactory.NewFleetsClient().BeginUpdateAsync(ctx, "rg1", "fleet1", armcontainerservicefleet.FleetPatch{ Tags: map[string]*string{ - "env": to.Ptr("prod"), "tier": to.Ptr("secure"), + "env": to.Ptr("prod"), }, - }, &armcontainerservicefleet.FleetsClientBeginUpdateOptions{IfMatch: to.Ptr("dfjkwelr7384")}) + }, &FleetsClientBeginUpdateAsyncOptions{ + ifMatch: to.Ptr("dfjkwelr7384")}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -285,83 +750,125 @@ func ExampleFleetsClient_BeginUpdate() { // 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.Fleet = armcontainerservicefleet.Fleet{ - // Name: to.Ptr("fleet-1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets"), - // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet-1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // CreatedBy: to.Ptr("someUser"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), - // LastModifiedBy: to.Ptr("someOtherUser"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // Location: to.Ptr("East US"), - // Tags: map[string]*string{ - // "env": to.Ptr("prod"), - // "tier": to.Ptr("secure"), - // }, - // ETag: to.Ptr("23ujdflewrj3="), - // Properties: &armcontainerservicefleet.FleetProperties{ - // HubProfile: &armcontainerservicefleet.FleetHubProfile{ - // AgentProfile: &armcontainerservicefleet.AgentProfile{ - // VMSize: to.Ptr("Standard_DS1"), + // res = armcontainerservicefleet.FleetsClientUpdateAsyncResponse{ + // Fleet: &armcontainerservicefleet.Fleet{ + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet-1"), + // Name: to.Ptr("fleet-1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("someUser"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // LastModifiedBy: to.Ptr("someOtherUser"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // }, + // Tags: map[string]*string{ + // "tier": to.Ptr("secure"), + // "env": to.Ptr("prod"), + // }, + // Location: to.Ptr("East US"), + // ETag: to.Ptr("23ujdflewrj3="), + // Properties: &armcontainerservicefleet.FleetProperties{ + // HubProfile: &armcontainerservicefleet.FleetHubProfile{ + // DNSPrefix: to.Ptr("dnsprefix1"), + // Fqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), + // PortalFqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), + // KubernetesVersion: to.Ptr("1.22.4"), + // AgentProfile: &armcontainerservicefleet.AgentProfile{ + // VMSize: to.Ptr("Standard_DS1"), + // }, + // }, + // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetProvisioningStateSucceeded), + // Status: &armcontainerservicefleet.FleetStatus{ + // LastOperationID: to.Ptr("operation-12345"), + // LastOperationError: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("None"), + // Message: to.Ptr("No error"), + // }, // }, - // DNSPrefix: to.Ptr("dnsprefix1"), - // Fqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), - // KubernetesVersion: to.Ptr("1.22.4"), - // PortalFqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), // }, - // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetProvisioningStateSucceeded), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/Fleets_Delete.json -func ExampleFleetsClient_BeginDelete() { +// Generated from example definition: 2025-03-01/Fleets_Update_MaximumSet_Gen.json +func ExampleFleetsClient_BeginUpdateAsync_updateAFleetGeneratedByMaximumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewFleetsClient().BeginDelete(ctx, "rg1", "fleet1", &armcontainerservicefleet.FleetsClientBeginDeleteOptions{IfMatch: nil}) + poller, err := clientFactory.NewFleetsClient().BeginUpdateAsync(ctx, "rgfleets", "fleet1", armcontainerservicefleet.FleetPatch{ + Tags: map[string]*string{}, + Identity: &armcontainerservicefleet.ManagedServiceIdentity{ + Type: to.Ptr(armcontainerservicefleet.ManagedServiceIdentityTypeNone), + UserAssignedIdentities: map[string]*armcontainerservicefleet.UserAssignedIdentity{ + "key126": {}, + }, + }, + }, &FleetsClientBeginUpdateAsyncOptions{ + ifMatch: to.Ptr("lgoeir")}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + res, err := poller.PollUntilDone(ctx, nil) if err != nil { log.Fatalf("failed to pull the result: %v", err) } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/Fleets_ListCredentialsResult.json -func ExampleFleetsClient_ListCredentials() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFleetsClient().ListCredentials(ctx, "rg1", "fleet", 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.FleetCredentialResults = armcontainerservicefleet.FleetCredentialResults{ - // Kubeconfigs: []*armcontainerservicefleet.FleetCredentialResult{ - // { - // Name: to.Ptr("credentialName1"), - // Value: []byte("Y3JlZGVudGlhbFZhbHVlMQ=="), - // }}, + // res = armcontainerservicefleet.FleetsClientUpdateAsyncResponse{ + // Fleet: &armcontainerservicefleet.Fleet{ + // Tags: map[string]*string{ + // }, + // Location: to.Ptr("East US"), + // Properties: &armcontainerservicefleet.FleetProperties{ + // HubProfile: &armcontainerservicefleet.FleetHubProfile{ + // DNSPrefix: to.Ptr("dnsprefix1"), + // AgentProfile: &armcontainerservicefleet.AgentProfile{ + // VMSize: to.Ptr("Standard_DS1"), + // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.Network/virtualNetwork/myvnet/subnets/mysubnet1"), + // }, + // APIServerAccessProfile: &armcontainerservicefleet.APIServerAccessProfile{ + // EnablePrivateCluster: to.Ptr(true), + // EnableVnetIntegration: to.Ptr(true), + // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.Network/virtualNetwork/myvnet/subnets/mysubnet1"), + // }, + // Fqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), + // KubernetesVersion: to.Ptr("1.22.4"), + // PortalFqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), + // }, + // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetProvisioningStateSucceeded), + // }, + // ETag: to.Ptr("23ujdflewrj3="), + // Identity: &armcontainerservicefleet.ManagedServiceIdentity{ + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // Type: to.Ptr(armcontainerservicefleet.ManagedServiceIdentityTypeNone), + // UserAssignedIdentities: map[string]*armcontainerservicefleet.UserAssignedIdentity{ + // "key126": &armcontainerservicefleet.UserAssignedIdentity{ + // PrincipalID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // ClientID: to.Ptr("00000000-0000-0000-0000-000000000000"), + // }, + // }, + // }, + // ID: to.Ptr("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/fleets/fleet1"), + // Name: to.Ptr("fleet-1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("someUser"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // LastModifiedBy: to.Ptr("someOtherUser"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // }, + // }, // } } diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleets_live_test.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleets_live_test.go index 1f8649c03ec9..eddcbcc21436 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleets_live_test.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleets_live_test.go @@ -15,7 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/v2" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3/testutil" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" "github.com/stretchr/testify/suite" diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetupdatestrategies_client.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetupdatestrategies_client.go index 696fc879675c..a0e82bf02907 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetupdatestrategies_client.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetupdatestrategies_client.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // 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) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armcontainerservicefleet @@ -28,7 +24,7 @@ type FleetUpdateStrategiesClient struct { } // NewFleetUpdateStrategiesClient creates a new instance of FleetUpdateStrategiesClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewFleetUpdateStrategiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FleetUpdateStrategiesClient, error) { @@ -46,7 +42,7 @@ func NewFleetUpdateStrategiesClient(subscriptionID string, credential azcore.Tok // BeginCreateOrUpdate - Create a FleetUpdateStrategy // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fleetName - The name of the Fleet resource. // - updateStrategyName - The name of the UpdateStrategy resource. @@ -74,7 +70,7 @@ func (client *FleetUpdateStrategiesClient) BeginCreateOrUpdate(ctx context.Conte // CreateOrUpdate - Create a FleetUpdateStrategy // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 func (client *FleetUpdateStrategiesClient) createOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, updateStrategyName string, resource FleetUpdateStrategy, options *FleetUpdateStrategiesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "FleetUpdateStrategiesClient.BeginCreateOrUpdate" @@ -120,7 +116,7 @@ func (client *FleetUpdateStrategiesClient) createOrUpdateCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-02-preview") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.IfMatch != nil { @@ -129,6 +125,7 @@ func (client *FleetUpdateStrategiesClient) createOrUpdateCreateRequest(ctx conte if options != nil && options.IfNoneMatch != nil { req.Raw().Header["If-None-Match"] = []string{*options.IfNoneMatch} } + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } @@ -138,7 +135,7 @@ func (client *FleetUpdateStrategiesClient) createOrUpdateCreateRequest(ctx conte // BeginDelete - Delete a FleetUpdateStrategy // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fleetName - The name of the Fleet resource. // - updateStrategyName - The name of the UpdateStrategy resource. @@ -151,8 +148,7 @@ func (client *FleetUpdateStrategiesClient) BeginDelete(ctx context.Context, reso return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetUpdateStrategiesClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -165,7 +161,7 @@ func (client *FleetUpdateStrategiesClient) BeginDelete(ctx context.Context, reso // Delete - Delete a FleetUpdateStrategy // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 func (client *FleetUpdateStrategiesClient) deleteOperation(ctx context.Context, resourceGroupName string, fleetName string, updateStrategyName string, options *FleetUpdateStrategiesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "FleetUpdateStrategiesClient.BeginDelete" @@ -211,7 +207,7 @@ func (client *FleetUpdateStrategiesClient) deleteCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-02-preview") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.IfMatch != nil { @@ -223,7 +219,7 @@ func (client *FleetUpdateStrategiesClient) deleteCreateRequest(ctx context.Conte // Get - Get a FleetUpdateStrategy // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fleetName - The name of the Fleet resource. // - updateStrategyName - The name of the UpdateStrategy resource. @@ -252,7 +248,7 @@ func (client *FleetUpdateStrategiesClient) Get(ctx context.Context, resourceGrou } // getCreateRequest creates the Get request. -func (client *FleetUpdateStrategiesClient) getCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, updateStrategyName string, options *FleetUpdateStrategiesClientGetOptions) (*policy.Request, error) { +func (client *FleetUpdateStrategiesClient) getCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, updateStrategyName string, _ *FleetUpdateStrategiesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -275,7 +271,7 @@ func (client *FleetUpdateStrategiesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-02-preview") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -292,7 +288,7 @@ func (client *FleetUpdateStrategiesClient) getHandleResponse(resp *http.Response // NewListByFleetPager - List FleetUpdateStrategy resources by Fleet // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fleetName - The name of the Fleet resource. // - options - FleetUpdateStrategiesClientListByFleetOptions contains the optional parameters for the FleetUpdateStrategiesClient.NewListByFleetPager @@ -321,7 +317,7 @@ func (client *FleetUpdateStrategiesClient) NewListByFleetPager(resourceGroupName } // listByFleetCreateRequest creates the ListByFleet request. -func (client *FleetUpdateStrategiesClient) listByFleetCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, options *FleetUpdateStrategiesClientListByFleetOptions) (*policy.Request, error) { +func (client *FleetUpdateStrategiesClient) listByFleetCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, _ *FleetUpdateStrategiesClientListByFleetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -340,7 +336,7 @@ func (client *FleetUpdateStrategiesClient) listByFleetCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-02-preview") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetupdatestrategies_client_example_test.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetupdatestrategies_client_example_test.go index c8b715d965c1..08d3428f2166 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetupdatestrategies_client_example_test.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetupdatestrategies_client_example_test.go @@ -1,135 +1,99 @@ -//go:build go1.18 -// +build go1.18 - // 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) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armcontainerservicefleet_test import ( "context" - "log" - "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/containerservicefleet/armcontainerservicefleet" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/UpdateStrategies_ListByFleet.json -func ExampleFleetUpdateStrategiesClient_NewListByFleetPager() { +// Generated from example definition: 2025-03-01/FleetUpdateStrategies_CreateOrUpdate_MaximumSet_Gen.json +func ExampleFleetUpdateStrategiesClient_BeginCreateOrUpdate_createAFleetUpdateStrategyGeneratedByMaximumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewFleetUpdateStrategiesClient().NewListByFleetPager("rg1", "fleet1", 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.FleetUpdateStrategyListResult = armcontainerservicefleet.FleetUpdateStrategyListResult{ - // Value: []*armcontainerservicefleet.FleetUpdateStrategy{ - // { - // Name: to.Ptr("strategy1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets/updateStrategies"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateStrategies/strategy1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // CreatedBy: to.Ptr("@contoso.com"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // LastModifiedBy: to.Ptr("@contoso.com"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // ETag: to.Ptr("\"EtagValue\""), - // Properties: &armcontainerservicefleet.FleetUpdateStrategyProperties{ - // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetUpdateStrategyProvisioningStateSucceeded), - // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ - // Stages: []*armcontainerservicefleet.UpdateStage{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitInSeconds: to.Ptr[int32](3600), - // Groups: []*armcontainerservicefleet.UpdateGroup{ - // { - // Name: to.Ptr("group-a"), - // }}, - // }}, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/UpdateStrategies_Get.json -func ExampleFleetUpdateStrategiesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) + poller, err := clientFactory.NewFleetUpdateStrategiesClient().BeginCreateOrUpdate(ctx, "rgfleets", "fleet1", "fleet1", armcontainerservicefleet.FleetUpdateStrategy{ + Properties: &armcontainerservicefleet.FleetUpdateStrategyProperties{ + Strategy: &armcontainerservicefleet.UpdateRunStrategy{ + Stages: []*armcontainerservicefleet.UpdateStage{ + { + Name: to.Ptr("stage1"), + Groups: []*armcontainerservicefleet.UpdateGroup{ + { + Name: to.Ptr("group-a"), + }, + }, + AfterStageWaitInSeconds: to.Ptr[int32](3600), + }, + }, + }, + }, + }, &FleetUpdateStrategiesClientBeginCreateOrUpdateOptions{ + ifMatch: to.Ptr("bttptpmhheves"), + ifNoneMatch: to.Ptr("tlx")}) if err != nil { - log.Fatalf("failed to create client: %v", err) + log.Fatalf("failed to finish the request: %v", err) } - res, err := clientFactory.NewFleetUpdateStrategiesClient().Get(ctx, "rg1", "fleet1", "strategy1", nil) + res, err := poller.PollUntilDone(ctx, nil) if err != nil { - log.Fatalf("failed to finish the request: %v", err) + 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.FleetUpdateStrategy = armcontainerservicefleet.FleetUpdateStrategy{ - // Name: to.Ptr("strategy1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets/updateStrategies"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateStrategies/strategy1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // CreatedBy: to.Ptr("@contoso.com"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // LastModifiedBy: to.Ptr("@contoso.com"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // ETag: to.Ptr("\"EtagValue\""), - // Properties: &armcontainerservicefleet.FleetUpdateStrategyProperties{ - // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetUpdateStrategyProvisioningStateSucceeded), - // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ - // Stages: []*armcontainerservicefleet.UpdateStage{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitInSeconds: to.Ptr[int32](3600), - // Groups: []*armcontainerservicefleet.UpdateGroup{ - // { - // Name: to.Ptr("group-a"), - // }}, - // }}, + // res = armcontainerservicefleet.FleetUpdateStrategiesClientCreateOrUpdateResponse{ + // FleetUpdateStrategy: &armcontainerservicefleet.FleetUpdateStrategy{ + // Properties: &armcontainerservicefleet.FleetUpdateStrategyProperties{ + // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ + // Stages: []*armcontainerservicefleet.UpdateStage{ + // { + // Name: to.Ptr("stage1"), + // Groups: []*armcontainerservicefleet.UpdateGroup{ + // { + // Name: to.Ptr("group-a"), + // }, + // }, + // AfterStageWaitInSeconds: to.Ptr[int32](3600), + // }, + // }, + // }, + // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetUpdateStrategyProvisioningStateSucceeded), + // }, + // ETag: to.Ptr("\"EtagValue\""), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateStrategies/strategy1"), + // Name: to.Ptr("strategy1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/updateStrategies"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("someUser"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // LastModifiedBy: to.Ptr("someOtherUser"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/UpdateStrategies_CreateOrUpdate.json -func ExampleFleetUpdateStrategiesClient_BeginCreateOrUpdate() { +// Generated from example definition: 2025-03-01/UpdateStrategies_CreateOrUpdate.json +func ExampleFleetUpdateStrategiesClient_BeginCreateOrUpdate_createAFleetUpdateStrategy() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -138,18 +102,18 @@ func ExampleFleetUpdateStrategiesClient_BeginCreateOrUpdate() { Strategy: &armcontainerservicefleet.UpdateRunStrategy{ Stages: []*armcontainerservicefleet.UpdateStage{ { - Name: to.Ptr("stage1"), - AfterStageWaitInSeconds: to.Ptr[int32](3600), + Name: to.Ptr("stage1"), Groups: []*armcontainerservicefleet.UpdateGroup{ { Name: to.Ptr("group-a"), - }}, - }}, + }, + }, + AfterStageWaitInSeconds: to.Ptr[int32](3600), + }, + }, }, }, - }, &armcontainerservicefleet.FleetUpdateStrategiesClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: nil, - }) + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -160,53 +124,317 @@ func ExampleFleetUpdateStrategiesClient_BeginCreateOrUpdate() { // 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.FleetUpdateStrategy = armcontainerservicefleet.FleetUpdateStrategy{ - // Name: to.Ptr("strategy1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets/updateStrategies"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateStrategies/strategy1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // CreatedBy: to.Ptr("@contoso.com"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // LastModifiedBy: to.Ptr("@contoso.com"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // ETag: to.Ptr("\"EtagValue\""), - // Properties: &armcontainerservicefleet.FleetUpdateStrategyProperties{ - // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetUpdateStrategyProvisioningStateSucceeded), - // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ - // Stages: []*armcontainerservicefleet.UpdateStage{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitInSeconds: to.Ptr[int32](3600), - // Groups: []*armcontainerservicefleet.UpdateGroup{ - // { - // Name: to.Ptr("group-a"), - // }}, - // }}, + // res = armcontainerservicefleet.FleetUpdateStrategiesClientCreateOrUpdateResponse{ + // FleetUpdateStrategy: &armcontainerservicefleet.FleetUpdateStrategy{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateStrategies/strategy1"), + // Name: to.Ptr("strategy1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/updateStrategies"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("@contoso.com"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // LastModifiedBy: to.Ptr("@contoso.com"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), // }, + // Properties: &armcontainerservicefleet.FleetUpdateStrategyProperties{ + // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetUpdateStrategyProvisioningStateSucceeded), + // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ + // Stages: []*armcontainerservicefleet.UpdateStage{ + // { + // Name: to.Ptr("stage1"), + // Groups: []*armcontainerservicefleet.UpdateGroup{ + // { + // Name: to.Ptr("group-a"), + // }, + // }, + // AfterStageWaitInSeconds: to.Ptr[int32](3600), + // }, + // }, + // }, + // }, + // ETag: to.Ptr("\"EtagValue\""), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/UpdateStrategies_Delete.json -func ExampleFleetUpdateStrategiesClient_BeginDelete() { +// Generated from example definition: 2025-03-01/FleetUpdateStrategies_Delete_MaximumSet_Gen.json +func ExampleFleetUpdateStrategiesClient_BeginDelete_deleteAFleetUpdateStrategyResourceGeneratedByMaximumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFleetUpdateStrategiesClient().BeginDelete(ctx, "rgfleets", "fleet1", "fleet1", &FleetUpdateStrategiesClientBeginDeleteOptions{ + ifMatch: to.Ptr("saqprswlk")}) + 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 = armcontainerservicefleet.FleetUpdateStrategiesClientDeleteResponse{ + // } +} + +// Generated from example definition: 2025-03-01/UpdateStrategies_Delete.json +func ExampleFleetUpdateStrategiesClient_BeginDelete_deleteAFleetUpdateStrategyResource() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewFleetUpdateStrategiesClient().BeginDelete(ctx, "rg1", "fleet1", "strategy1", &armcontainerservicefleet.FleetUpdateStrategiesClientBeginDeleteOptions{IfMatch: nil}) + poller, err := clientFactory.NewFleetUpdateStrategiesClient().BeginDelete(ctx, "rg1", "fleet1", "strategy1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + 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 = armcontainerservicefleet.FleetUpdateStrategiesClientDeleteResponse{ + // } +} + +// Generated from example definition: 2025-03-01/FleetUpdateStrategies_Get_MaximumSet_Gen.json +func ExampleFleetUpdateStrategiesClient_Get_getAFleetUpdateStrategyResourceGeneratedByMaximumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFleetUpdateStrategiesClient().Get(ctx, "rgfleets", "fleet1", "fleet1", 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 = armcontainerservicefleet.FleetUpdateStrategiesClientGetResponse{ + // FleetUpdateStrategy: &armcontainerservicefleet.FleetUpdateStrategy{ + // Properties: &armcontainerservicefleet.FleetUpdateStrategyProperties{ + // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ + // Stages: []*armcontainerservicefleet.UpdateStage{ + // { + // Name: to.Ptr("stage1"), + // Groups: []*armcontainerservicefleet.UpdateGroup{ + // { + // Name: to.Ptr("group-a"), + // }, + // }, + // AfterStageWaitInSeconds: to.Ptr[int32](3600), + // }, + // }, + // }, + // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetUpdateStrategyProvisioningStateSucceeded), + // }, + // ETag: to.Ptr("\"EtagValue\""), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateStrategies/strategy1"), + // Name: to.Ptr("strategy1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/updateStrategies"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("someUser"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // LastModifiedBy: to.Ptr("someOtherUser"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-03-01/UpdateStrategies_Get.json +func ExampleFleetUpdateStrategiesClient_Get_getAFleetUpdateStrategyResource() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFleetUpdateStrategiesClient().Get(ctx, "rg1", "fleet1", "strategy1", 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 = armcontainerservicefleet.FleetUpdateStrategiesClientGetResponse{ + // FleetUpdateStrategy: &armcontainerservicefleet.FleetUpdateStrategy{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateStrategies/strategy1"), + // Name: to.Ptr("strategy1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/updateStrategies"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("@contoso.com"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // LastModifiedBy: to.Ptr("@contoso.com"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // }, + // Properties: &armcontainerservicefleet.FleetUpdateStrategyProperties{ + // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetUpdateStrategyProvisioningStateSucceeded), + // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ + // Stages: []*armcontainerservicefleet.UpdateStage{ + // { + // Name: to.Ptr("stage1"), + // Groups: []*armcontainerservicefleet.UpdateGroup{ + // { + // Name: to.Ptr("group-a"), + // }, + // }, + // AfterStageWaitInSeconds: to.Ptr[int32](3600), + // }, + // }, + // }, + // }, + // ETag: to.Ptr("\"EtagValue\""), + // }, + // } +} + +// Generated from example definition: 2025-03-01/FleetUpdateStrategies_ListByFleet_MaximumSet_Gen.json +func ExampleFleetUpdateStrategiesClient_NewListByFleetPager_listTheFleetUpdateStrategyResourcesByFleetGeneratedByMaximumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewFleetUpdateStrategiesClient().NewListByFleetPager("rgfleets", "fleet1", 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 = armcontainerservicefleet.FleetUpdateStrategiesClientListByFleetResponse{ + // FleetUpdateStrategyListResult: armcontainerservicefleet.FleetUpdateStrategyListResult{ + // Value: []*armcontainerservicefleet.FleetUpdateStrategy{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateStrategies/strategy1"), + // Name: to.Ptr("strategy1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/updateStrategies"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("@contoso.com"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // LastModifiedBy: to.Ptr("@contoso.com"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // }, + // Properties: &armcontainerservicefleet.FleetUpdateStrategyProperties{ + // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetUpdateStrategyProvisioningStateSucceeded), + // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ + // Stages: []*armcontainerservicefleet.UpdateStage{ + // { + // Name: to.Ptr("stage1"), + // Groups: []*armcontainerservicefleet.UpdateGroup{ + // { + // Name: to.Ptr("group-a"), + // }, + // }, + // AfterStageWaitInSeconds: to.Ptr[int32](3600), + // }, + // }, + // }, + // }, + // ETag: to.Ptr("\"EtagValue\""), + // }, + // }, + // NextLink: to.Ptr("http://nextlink.contoso.com"), + // }, + // } + } +} + +// Generated from example definition: 2025-03-01/UpdateStrategies_ListByFleet.json +func ExampleFleetUpdateStrategiesClient_NewListByFleetPager_listTheFleetUpdateStrategyResourcesByFleet() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewFleetUpdateStrategiesClient().NewListByFleetPager("rg1", "fleet1", 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 = armcontainerservicefleet.FleetUpdateStrategiesClientListByFleetResponse{ + // FleetUpdateStrategyListResult: armcontainerservicefleet.FleetUpdateStrategyListResult{ + // Value: []*armcontainerservicefleet.FleetUpdateStrategy{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateStrategies/strategy1"), + // Name: to.Ptr("strategy1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/updateStrategies"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("@contoso.com"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // LastModifiedBy: to.Ptr("@contoso.com"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // }, + // Properties: &armcontainerservicefleet.FleetUpdateStrategyProperties{ + // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetUpdateStrategyProvisioningStateSucceeded), + // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ + // Stages: []*armcontainerservicefleet.UpdateStage{ + // { + // Name: to.Ptr("stage1"), + // Groups: []*armcontainerservicefleet.UpdateGroup{ + // { + // Name: to.Ptr("group-a"), + // }, + // }, + // AfterStageWaitInSeconds: to.Ptr[int32](3600), + // }, + // }, + // }, + // }, + // ETag: to.Ptr("\"EtagValue\""), + // }, + // }, + // NextLink: to.Ptr("http://nextlink.contoso.com"), + // }, + // } + } } diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/go.mod b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/go.mod index df9791218f16..0f0a2f0d8485 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/go.mod +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/go.mod @@ -1,4 +1,4 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/v2 go 1.23.0 diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/models.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/models.go index c085634fd587..e5a367f8a4ee 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/models.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/models.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // 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) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armcontainerservicefleet @@ -43,18 +39,18 @@ type AutoUpgradeProfile struct { // The resource-specific properties for this resource. Properties *AutoUpgradeProfileProperties + // READ-ONLY; The name of the AutoUpgradeProfile resource. + Name *string + // READ-ONLY; If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. - // Entity tags are used for comparing two or more entities from the same requested resource. - // HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range - // (section 14.27) header fields. + // Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in + // the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header + // fields. ETag *string // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource - Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData @@ -76,9 +72,12 @@ type AutoUpgradeProfileProperties struct { // REQUIRED; Configures how auto-upgrade will be run. Channel *UpgradeChannel - // If set to False: the auto upgrade has effect - target managed clusters will be upgraded on schedule. If set to True: the - // auto upgrade has no effect - no upgrade will be run on the target managed - // clusters. This is a boolean and not an enum because enabled/disabled are all available states of the auto upgrade profile. + // The status of the auto upgrade profile. + AutoUpgradeProfileStatus *AutoUpgradeProfileStatus + + // If set to False: the auto upgrade has effect - target managed clusters will be upgraded on schedule. + // If set to True: the auto upgrade has no effect - no upgrade will be run on the target managed clusters. + // This is a boolean and not an enum because enabled/disabled are all available states of the auto upgrade profile. // By default, this is set to False. Disabled *bool @@ -93,15 +92,34 @@ type AutoUpgradeProfileProperties struct { ProvisioningState *AutoUpgradeProfileProvisioningState } +// AutoUpgradeProfileStatus is the status of an auto upgrade profile. +type AutoUpgradeProfileStatus struct { + // READ-ONLY; The error details of the last trigger. + LastTriggerError *ErrorDetail + + // READ-ONLY; The status of the last AutoUpgrade trigger. + LastTriggerStatus *AutoUpgradeLastTriggerStatus + + // READ-ONLY; The target Kubernetes version or node image versions of the last trigger. + LastTriggerUpgradeVersions []*string + + // READ-ONLY; The UTC time of the last attempt to automatically create and start an UpdateRun as triggered by the release + // of new versions. + LastTriggeredAt *time.Time +} + // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. - Info any + Info *ErrorAdditionalInfoInfo // READ-ONLY; The additional info type. Type *string } +type ErrorAdditionalInfoInfo struct { +} + // ErrorDetail - The error detail. type ErrorDetail struct { // READ-ONLY; The error additional info. @@ -125,6 +143,9 @@ type Fleet struct { // REQUIRED; The geo-location where the resource lives Location *string + // READ-ONLY; The name of the Fleet resource. + Name *string + // Managed identity. Identity *ManagedServiceIdentity @@ -135,17 +156,14 @@ type Fleet struct { Tags map[string]*string // READ-ONLY; If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. - // Entity tags are used for comparing two or more entities from the same requested resource. - // HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range - // (section 14.27) header fields. + // Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in + // the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header + // fields. ETag *string // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource - Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData @@ -203,18 +221,18 @@ type FleetMember struct { // The resource-specific properties for this resource. Properties *FleetMemberProperties + // READ-ONLY; The name of the Fleet member resource. + Name *string + // READ-ONLY; If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. - // Entity tags are used for comparing two or more entities from the same requested resource. - // HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range - // (section 14.27) header fields. + // Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in + // the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header + // fields. ETag *string // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource - Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData @@ -233,8 +251,7 @@ type FleetMemberListResult struct { // FleetMemberProperties - A member of the Fleet. It contains a reference to an existing Kubernetes cluster on Azure. type FleetMemberProperties struct { - // REQUIRED; The ARM resource id of the cluster that joins the Fleet. Must be a valid Azure resource id. e.g.: - // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. + // REQUIRED; The ARM resource id of the cluster that joins the Fleet. Must be a valid Azure resource id. e.g.: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. ClusterResourceID *string // The group this member belongs to for multi-cluster update management. @@ -242,6 +259,18 @@ type FleetMemberProperties struct { // READ-ONLY; The status of the last operation. ProvisioningState *FleetMemberProvisioningState + + // READ-ONLY; Status information of the last operation for fleet member. + Status *FleetMemberStatus +} + +// FleetMemberStatus - Status information for the fleet member +type FleetMemberStatus struct { + // READ-ONLY; The last operation error of the fleet member + LastOperationError *ErrorDetail + + // READ-ONLY; The last operation ID for the fleet member + LastOperationID *string } // FleetMemberUpdate - The type used for update operations of the FleetMember. @@ -272,6 +301,18 @@ type FleetProperties struct { // READ-ONLY; The status of the last operation. ProvisioningState *FleetProvisioningState + + // READ-ONLY; Status information for the fleet. + Status *FleetStatus +} + +// FleetStatus - Status information for the fleet. +type FleetStatus struct { + // READ-ONLY; The last operation error for the fleet. + LastOperationError *ErrorDetail + + // READ-ONLY; The last operation ID for the fleet. + LastOperationID *string } // FleetUpdateStrategy - Defines a multi-stage process to perform update operations across members of a Fleet. @@ -279,18 +320,18 @@ type FleetUpdateStrategy struct { // The resource-specific properties for this resource. Properties *FleetUpdateStrategyProperties + // READ-ONLY; The name of the UpdateStrategy resource. + Name *string + // READ-ONLY; If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. - // Entity tags are used for comparing two or more entities from the same requested resource. - // HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range - // (section 14.27) header fields. + // Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in + // the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header + // fields. ETag *string // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource - Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData @@ -336,14 +377,10 @@ type ManagedClusterUpgradeSpec struct { // ManagedServiceIdentity - Managed service identity (system assigned and/or user assigned identities) type ManagedServiceIdentity struct { - // REQUIRED; Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + // REQUIRED; The type of managed identity assigned to this resource. Type *ManagedServiceIdentityType - // The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM - // resource ids in the form: - // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - // The dictionary values can be empty objects ({}) in - // requests. + // The identities assigned to this resource by the user. UserAssignedIdentities map[string]*UserAssignedIdentity // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned @@ -378,10 +415,9 @@ type NodeImageSelection struct { Type *NodeImageSelectionType // Custom node image versions to upgrade the nodes to. This field is required if node image selection type is Custom. Otherwise, - // it must be empty. For each node image family (e.g., - // 'AKSUbuntu-1804gen2containerd'), this field can contain at most one version (e.g., only one of 'AKSUbuntu-1804gen2containerd-2023.01.12' - // or 'AKSUbuntu-1804gen2containerd-2023.02.12', not both). If the - // nodes belong to a family without a matching image version in this field, they are not upgraded. + // it must be empty. For each node image family (e.g., 'AKSUbuntu-1804gen2containerd'), this field can contain at most one + // version (e.g., only one of 'AKSUbuntu-1804gen2containerd-2023.01.12' or 'AKSUbuntu-1804gen2containerd-2023.02.12', not + // both). If the nodes belong to a family without a matching image version in this field, they are not upgraded. CustomNodeImageVersions []*NodeImageVersion } @@ -402,11 +438,11 @@ type Operation struct { // Localized display information for this particular operation. Display *OperationDisplay - // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + // READ-ONLY; Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. ActionType *ActionType - // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane - // operations. + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + // Resource Manager/control-plane operations. IsDataAction *bool // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", @@ -418,7 +454,7 @@ type Operation struct { Origin *Origin } -// OperationDisplay - Localized display information for this particular operation. +// OperationDisplay - Localized display information for and operation. type OperationDisplay struct { // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. Description *string @@ -439,11 +475,11 @@ type OperationDisplay struct { // OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to // get the next set of results. type OperationListResult struct { - // READ-ONLY; URL to get the next set of operation list results (if there are any). - NextLink *string - - // READ-ONLY; List of operations supported by the resource provider + // REQUIRED; The Operation items on this page Value []*Operation + + // The link to the next page of items + NextLink *string } // SkipProperties - The properties of a skip operation containing multiple skip requests. @@ -454,8 +490,9 @@ type SkipProperties struct { // SkipTarget - The definition of a single skip request. type SkipTarget struct { - // REQUIRED; The skip target's name. To skip a member/group/stage, use the member/group/stage's name; Tp skip an after stage - // wait, use the parent stage's name. + // REQUIRED; The skip target's name. + // To skip a member/group/stage, use the member/group/stage's name; + // Tp skip an after stage wait, use the parent stage's name. Name *string // REQUIRED; The skip target type. @@ -485,7 +522,8 @@ type SystemData struct { // UpdateGroup - A group to be updated. type UpdateGroup struct { - // REQUIRED; Name of the group. It must match a group name of an existing fleet member. + // REQUIRED; Name of the group. + // It must match a group name of an existing fleet member. Name *string } @@ -506,18 +544,18 @@ type UpdateRun struct { // The resource-specific properties for this resource. Properties *UpdateRunProperties + // READ-ONLY; The name of the UpdateRun resource. + Name *string + // READ-ONLY; If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. - // Entity tags are used for comparing two or more entities from the same requested resource. - // HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range - // (section 14.27) header fields. + // Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in + // the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header + // fields. ETag *string // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource - Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData @@ -540,9 +578,10 @@ type UpdateRunProperties struct { // run is started. ManagedClusterUpdate *ManagedClusterUpdate - // The strategy defines the order in which the clusters will be updated. If not set, all members will be updated sequentially. - // The UpdateRun status will show a single UpdateStage and a single UpdateGroup - // targeting all members. The strategy of the UpdateRun can be modified until the run is started. + // The strategy defines the order in which the clusters will be updated. + // If not set, all members will be updated sequentially. The UpdateRun status will show a single UpdateStage and a single + // UpdateGroup targeting all members. + // The strategy of the UpdateRun can be modified until the run is started. Strategy *UpdateRunStrategy // The resource id of the FleetUpdateStrategy resource to reference. @@ -553,11 +592,14 @@ type UpdateRunProperties struct { // 2023-08-15-preview) // Setting both "updateStrategyId" and "strategy" is invalid. // UpdateRuns created by "updateStrategyId" snapshot the referenced UpdateStrategy at the time of creation and store it in - // the "strategy" field. Subsequent changes to the referenced FleetUpdateStrategy - // resource do not propagate. UpdateRunStrategy changes can be made directly on the "strategy" field before launching the - // UpdateRun. + // the "strategy" field. + // Subsequent changes to the referenced FleetUpdateStrategy resource do not propagate. + // UpdateRunStrategy changes can be made directly on the "strategy" field before launching the UpdateRun. UpdateStrategyID *string + // READ-ONLY; AutoUpgradeProfileId is the id of an auto upgrade profile resource. + AutoUpgradeProfileID *string + // READ-ONLY; The provisioning state of the UpdateRun resource. ProvisioningState *UpdateRunProvisioningState @@ -567,8 +609,8 @@ type UpdateRunProperties struct { // UpdateRunStatus - The status of a UpdateRun. type UpdateRunStatus struct { - // READ-ONLY; The node image upgrade specs for the update run. It is only set in update run when NodeImageSelection.type is - // Consistent. + // READ-ONLY; The node image upgrade specs for the update run. It is only set in update run when `NodeImageSelection.type` + // is `Consistent`. NodeImageSelection *NodeImageSelectionStatus // READ-ONLY; The stages composing an update run. Stages are run sequentially withing an UpdateRun. @@ -579,8 +621,9 @@ type UpdateRunStatus struct { } // UpdateRunStrategy - Defines the update sequence of the clusters via stages and groups. -// Stages within a run are executed sequentially one after another. Groups within a stage are executed in parallel. Member -// clusters within a group are updated sequentially one after another. +// Stages within a run are executed sequentially one after another. +// Groups within a stage are executed in parallel. +// Member clusters within a group are updated sequentially one after another. // A valid strategy contains no duplicate groups within or across stages. type UpdateRunStrategy struct { // REQUIRED; The list of stages that compose this update run. Min size: 1. diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/models_serde.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/models_serde.go index c47fff2ecb32..a45ae7ba7b99 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/models_serde.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/models_serde.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // 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) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armcontainerservicefleet @@ -190,6 +186,7 @@ func (a *AutoUpgradeProfileListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AutoUpgradeProfileProperties. func (a AutoUpgradeProfileProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "autoUpgradeProfileStatus", a.AutoUpgradeProfileStatus) populate(objectMap, "channel", a.Channel) populate(objectMap, "disabled", a.Disabled) populate(objectMap, "nodeImageSelection", a.NodeImageSelection) @@ -207,6 +204,9 @@ func (a *AutoUpgradeProfileProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "autoUpgradeProfileStatus": + err = unpopulate(val, "AutoUpgradeProfileStatus", &a.AutoUpgradeProfileStatus) + delete(rawMsg, key) case "channel": err = unpopulate(val, "Channel", &a.Channel) delete(rawMsg, key) @@ -230,10 +230,49 @@ func (a *AutoUpgradeProfileProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AutoUpgradeProfileStatus. +func (a AutoUpgradeProfileStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "lastTriggerError", a.LastTriggerError) + populate(objectMap, "lastTriggerStatus", a.LastTriggerStatus) + populate(objectMap, "lastTriggerUpgradeVersions", a.LastTriggerUpgradeVersions) + populateDateTimeRFC3339(objectMap, "lastTriggeredAt", a.LastTriggeredAt) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutoUpgradeProfileStatus. +func (a *AutoUpgradeProfileStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "lastTriggerError": + err = unpopulate(val, "LastTriggerError", &a.LastTriggerError) + delete(rawMsg, key) + case "lastTriggerStatus": + err = unpopulate(val, "LastTriggerStatus", &a.LastTriggerStatus) + delete(rawMsg, key) + case "lastTriggerUpgradeVersions": + err = unpopulate(val, "LastTriggerUpgradeVersions", &a.LastTriggerUpgradeVersions) + delete(rawMsg, key) + case "lastTriggeredAt": + err = unpopulateDateTimeRFC3339(val, "LastTriggeredAt", &a.LastTriggeredAt) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateAny(objectMap, "info", e.Info) + populate(objectMap, "info", e.Info) populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } @@ -587,6 +626,7 @@ func (f FleetMemberProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "clusterResourceId", f.ClusterResourceID) populate(objectMap, "group", f.Group) populate(objectMap, "provisioningState", f.ProvisioningState) + populate(objectMap, "status", f.Status) return json.Marshal(objectMap) } @@ -608,6 +648,40 @@ func (f *FleetMemberProperties) UnmarshalJSON(data []byte) error { case "provisioningState": err = unpopulate(val, "ProvisioningState", &f.ProvisioningState) delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &f.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FleetMemberStatus. +func (f FleetMemberStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "lastOperationError", f.LastOperationError) + populate(objectMap, "lastOperationId", f.LastOperationID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetMemberStatus. +func (f *FleetMemberStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "lastOperationError": + err = unpopulate(val, "LastOperationError", &f.LastOperationError) + delete(rawMsg, key) + case "lastOperationId": + err = unpopulate(val, "LastOperationID", &f.LastOperationID) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", f, err) @@ -706,6 +780,7 @@ func (f FleetProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "hubProfile", f.HubProfile) populate(objectMap, "provisioningState", f.ProvisioningState) + populate(objectMap, "status", f.Status) return json.Marshal(objectMap) } @@ -724,6 +799,40 @@ func (f *FleetProperties) UnmarshalJSON(data []byte) error { case "provisioningState": err = unpopulate(val, "ProvisioningState", &f.ProvisioningState) delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &f.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FleetStatus. +func (f FleetStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "lastOperationError", f.LastOperationError) + populate(objectMap, "lastOperationId", f.LastOperationID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetStatus. +func (f *FleetStatus) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "lastOperationError": + err = unpopulate(val, "LastOperationError", &f.LastOperationError) + delete(rawMsg, key) + case "lastOperationId": + err = unpopulate(val, "LastOperationID", &f.LastOperationID) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", f, err) @@ -1431,6 +1540,7 @@ func (u *UpdateRunListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UpdateRunProperties. func (u UpdateRunProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "autoUpgradeProfileId", u.AutoUpgradeProfileID) populate(objectMap, "managedClusterUpdate", u.ManagedClusterUpdate) populate(objectMap, "provisioningState", u.ProvisioningState) populate(objectMap, "status", u.Status) @@ -1448,6 +1558,9 @@ func (u *UpdateRunProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "autoUpgradeProfileId": + err = unpopulate(val, "AutoUpgradeProfileID", &u.AutoUpgradeProfileID) + delete(rawMsg, key) case "managedClusterUpdate": err = unpopulate(val, "ManagedClusterUpdate", &u.ManagedClusterUpdate) delete(rawMsg, key) @@ -1718,16 +1831,6 @@ func populate(m map[string]any, k string, v any) { } } -func populateAny(m map[string]any, k string, v any) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else { - m[k] = v - } -} - func populateByteArray[T any](m map[string]any, k string, b []T, convert func() any) { if azcore.IsNullValue(b) { m[k] = nil diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/operations_client.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/operations_client.go index b7c326265fb2..ba72e7d8b4a0 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/operations_client.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/operations_client.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // 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) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armcontainerservicefleet @@ -39,7 +35,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - List the operations for the provider // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -65,14 +61,14 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption } // listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.ContainerService/operations" 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", "2024-05-02-preview") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/operations_client_example_test.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/operations_client_example_test.go index 367681de662a..5ccfc216afc7 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/operations_client_example_test.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/operations_client_example_test.go @@ -1,30 +1,24 @@ -//go:build go1.18 -// +build go1.18 - // 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) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armcontainerservicefleet_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/Operations_List.json -func ExampleOperationsClient_NewListPager() { +// Generated from example definition: 2025-03-01/Operations_List.json +func ExampleOperationsClient_NewListPager_listTheOperationsForTheProvider() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) + clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -39,18 +33,94 @@ func ExampleOperationsClient_NewListPager() { _ = 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.OperationListResult = armcontainerservicefleet.OperationListResult{ - // Value: []*armcontainerservicefleet.Operation{ - // { - // Name: to.Ptr("Microsoft.ContainerService/locations/operations/read"), - // Display: &armcontainerservicefleet.OperationDisplay{ - // Description: to.Ptr("Gets the status of an asynchronous operation"), - // Operation: to.Ptr("Get Operation"), - // Provider: to.Ptr("Microsoft Container Service"), - // Resource: to.Ptr("Operation"), + // page = armcontainerservicefleet.OperationsClientListResponse{ + // OperationListResult: armcontainerservicefleet.OperationListResult{ + // Value: []*armcontainerservicefleet.Operation{ + // { + // Display: &armcontainerservicefleet.OperationDisplay{ + // Description: to.Ptr("Gets the status of an asynchronous operation"), + // Operation: to.Ptr("Get Operation"), + // Provider: to.Ptr("Microsoft Container Service"), + // Resource: to.Ptr("Operation"), + // }, + // Name: to.Ptr("Microsoft.ContainerService/locations/operations/read"), + // Origin: to.Ptr(armcontainerservicefleet.OriginUserSystem), // }, - // Origin: to.Ptr(armcontainerservicefleet.OriginUserSystem), - // }}, + // }, + // }, + // } + } +} + +// Generated from example definition: 2025-03-01/Operations_List_MaximumSet_Gen.json +func ExampleOperationsClient_NewListPager_listTheOperationsForTheProviderGeneratedByMaximumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewOperationsClient().NewListPager(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 = armcontainerservicefleet.OperationsClientListResponse{ + // OperationListResult: armcontainerservicefleet.OperationListResult{ + // Value: []*armcontainerservicefleet.Operation{ + // { + // Display: &armcontainerservicefleet.OperationDisplay{ + // Operation: to.Ptr("Get Operation"), + // Provider: to.Ptr("Microsoft Container Service"), + // Resource: to.Ptr("Operation"), + // Description: to.Ptr("yvruoknlkuvuqxsodwkgqznxaig"), + // }, + // Name: to.Ptr("Microsoft.ContainerService/locations/operations/read"), + // Origin: to.Ptr(armcontainerservicefleet.OriginUserSystem), + // IsDataAction: to.Ptr(true), + // ActionType: to.Ptr(armcontainerservicefleet.ActionTypeInternal), + // }, + // }, + // NextLink: to.Ptr("http://nextlink.contoso.com"), + // }, + // } + } +} + +// Generated from example definition: 2025-03-01/Operations_List_MinimumSet_Gen.json +func ExampleOperationsClient_NewListPager_listTheOperationsForTheProviderGeneratedByMinimumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewOperationsClient().NewListPager(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 = armcontainerservicefleet.OperationsClientListResponse{ + // OperationListResult: armcontainerservicefleet.OperationListResult{ + // }, // } } } diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/options.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/options.go index f9afbafa7752..1fcae7c4801e 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/options.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/options.go @@ -1,34 +1,37 @@ -//go:build go1.18 -// +build go1.18 - // 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) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armcontainerservicefleet +// AutoUpgradeProfileOperationsClientBeginGenerateUpdateRunOptions contains the optional parameters for the AutoUpgradeProfileOperationsClient.BeginGenerateUpdateRun +// method. +type AutoUpgradeProfileOperationsClientBeginGenerateUpdateRunOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + // AutoUpgradeProfilesClientBeginCreateOrUpdateOptions contains the optional parameters for the AutoUpgradeProfilesClient.BeginCreateOrUpdate // method. type AutoUpgradeProfilesClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // The request should only proceed if an entity matches this string. IfMatch *string // The request should only proceed if no entity matches this string. IfNoneMatch *string - - // Resumes the LRO from the provided token. - ResumeToken string } // AutoUpgradeProfilesClientBeginDeleteOptions contains the optional parameters for the AutoUpgradeProfilesClient.BeginDelete // method. type AutoUpgradeProfilesClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // The request should only proceed if an entity matches this string. IfMatch *string - - // Resumes the LRO from the provided token. - ResumeToken string } // AutoUpgradeProfilesClientGetOptions contains the optional parameters for the AutoUpgradeProfilesClient.Get method. @@ -44,32 +47,33 @@ type AutoUpgradeProfilesClientListByFleetOptions struct { // FleetMembersClientBeginCreateOptions contains the optional parameters for the FleetMembersClient.BeginCreate method. type FleetMembersClientBeginCreateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // The request should only proceed if an entity matches this string. IfMatch *string // The request should only proceed if no entity matches this string. IfNoneMatch *string - - // Resumes the LRO from the provided token. - ResumeToken string } // FleetMembersClientBeginDeleteOptions contains the optional parameters for the FleetMembersClient.BeginDelete method. type FleetMembersClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // The request should only proceed if an entity matches this string. IfMatch *string +} - // Resumes the LRO from the provided token. +// FleetMembersClientBeginUpdateAsyncOptions contains the optional parameters for the FleetMembersClient.BeginUpdateAsync +// method. +type FleetMembersClientBeginUpdateAsyncOptions struct { + // Resumes the long-running operation from the provided token. ResumeToken string -} -// FleetMembersClientBeginUpdateOptions contains the optional parameters for the FleetMembersClient.BeginUpdate method. -type FleetMembersClientBeginUpdateOptions struct { // The request should only proceed if an entity matches this string. IfMatch *string - - // Resumes the LRO from the provided token. - ResumeToken string } // FleetMembersClientGetOptions contains the optional parameters for the FleetMembersClient.Get method. @@ -85,24 +89,24 @@ type FleetMembersClientListByFleetOptions struct { // FleetUpdateStrategiesClientBeginCreateOrUpdateOptions contains the optional parameters for the FleetUpdateStrategiesClient.BeginCreateOrUpdate // method. type FleetUpdateStrategiesClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // The request should only proceed if an entity matches this string. IfMatch *string // The request should only proceed if no entity matches this string. IfNoneMatch *string - - // Resumes the LRO from the provided token. - ResumeToken string } // FleetUpdateStrategiesClientBeginDeleteOptions contains the optional parameters for the FleetUpdateStrategiesClient.BeginDelete // method. type FleetUpdateStrategiesClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // The request should only proceed if an entity matches this string. IfMatch *string - - // Resumes the LRO from the provided token. - ResumeToken string } // FleetUpdateStrategiesClientGetOptions contains the optional parameters for the FleetUpdateStrategiesClient.Get method. @@ -116,34 +120,34 @@ type FleetUpdateStrategiesClientListByFleetOptions struct { // placeholder for future optional parameters } -// FleetsClientBeginCreateOrUpdateOptions contains the optional parameters for the FleetsClient.BeginCreateOrUpdate method. -type FleetsClientBeginCreateOrUpdateOptions struct { +// FleetsClientBeginCreateOptions contains the optional parameters for the FleetsClient.BeginCreate method. +type FleetsClientBeginCreateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // The request should only proceed if an entity matches this string. IfMatch *string // The request should only proceed if no entity matches this string. IfNoneMatch *string - - // Resumes the LRO from the provided token. - ResumeToken string } // FleetsClientBeginDeleteOptions contains the optional parameters for the FleetsClient.BeginDelete method. type FleetsClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // The request should only proceed if an entity matches this string. IfMatch *string +} - // Resumes the LRO from the provided token. +// FleetsClientBeginUpdateAsyncOptions contains the optional parameters for the FleetsClient.BeginUpdateAsync method. +type FleetsClientBeginUpdateAsyncOptions struct { + // Resumes the long-running operation from the provided token. ResumeToken string -} -// FleetsClientBeginUpdateOptions contains the optional parameters for the FleetsClient.BeginUpdate method. -type FleetsClientBeginUpdateOptions struct { // The request should only proceed if an entity matches this string. IfMatch *string - - // Resumes the LRO from the provided token. - ResumeToken string } // FleetsClientGetOptions contains the optional parameters for the FleetsClient.Get method. @@ -176,50 +180,50 @@ type OperationsClientListOptions struct { // UpdateRunsClientBeginCreateOrUpdateOptions contains the optional parameters for the UpdateRunsClient.BeginCreateOrUpdate // method. type UpdateRunsClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // The request should only proceed if an entity matches this string. IfMatch *string // The request should only proceed if no entity matches this string. IfNoneMatch *string - - // Resumes the LRO from the provided token. - ResumeToken string } // UpdateRunsClientBeginDeleteOptions contains the optional parameters for the UpdateRunsClient.BeginDelete method. type UpdateRunsClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // The request should only proceed if an entity matches this string. IfMatch *string - - // Resumes the LRO from the provided token. - ResumeToken string } // UpdateRunsClientBeginSkipOptions contains the optional parameters for the UpdateRunsClient.BeginSkip method. type UpdateRunsClientBeginSkipOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // The request should only proceed if an entity matches this string. IfMatch *string - - // Resumes the LRO from the provided token. - ResumeToken string } // UpdateRunsClientBeginStartOptions contains the optional parameters for the UpdateRunsClient.BeginStart method. type UpdateRunsClientBeginStartOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // The request should only proceed if an entity matches this string. IfMatch *string - - // Resumes the LRO from the provided token. - ResumeToken string } // UpdateRunsClientBeginStopOptions contains the optional parameters for the UpdateRunsClient.BeginStop method. type UpdateRunsClientBeginStopOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // The request should only proceed if an entity matches this string. IfMatch *string - - // Resumes the LRO from the provided token. - ResumeToken string } // UpdateRunsClientGetOptions contains the optional parameters for the UpdateRunsClient.Get method. diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/responses.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/responses.go index 1f1ef2529f37..5dc5938e8964 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/responses.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/responses.go @@ -1,13 +1,15 @@ -//go:build go1.18 -// +build go1.18 - // 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) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armcontainerservicefleet +// AutoUpgradeProfileOperationsClientGenerateUpdateRunResponse contains the response from method AutoUpgradeProfileOperationsClient.BeginGenerateUpdateRun. +type AutoUpgradeProfileOperationsClientGenerateUpdateRunResponse struct { + // The request should only proceed if an entity matches this string. + IfMatch *string +} + // AutoUpgradeProfilesClientCreateOrUpdateResponse contains the response from method AutoUpgradeProfilesClient.BeginCreateOrUpdate. type AutoUpgradeProfilesClientCreateOrUpdateResponse struct { // The AutoUpgradeProfile resource. @@ -54,8 +56,8 @@ type FleetMembersClientListByFleetResponse struct { FleetMemberListResult } -// FleetMembersClientUpdateResponse contains the response from method FleetMembersClient.BeginUpdate. -type FleetMembersClientUpdateResponse struct { +// FleetMembersClientUpdateAsyncResponse contains the response from method FleetMembersClient.BeginUpdateAsync. +type FleetMembersClientUpdateAsyncResponse struct { // A member of the Fleet. It contains a reference to an existing Kubernetes cluster on Azure. FleetMember } @@ -83,8 +85,8 @@ type FleetUpdateStrategiesClientListByFleetResponse struct { FleetUpdateStrategyListResult } -// FleetsClientCreateOrUpdateResponse contains the response from method FleetsClient.BeginCreateOrUpdate. -type FleetsClientCreateOrUpdateResponse struct { +// FleetsClientCreateResponse contains the response from method FleetsClient.BeginCreate. +type FleetsClientCreateResponse struct { // The Fleet resource. Fleet } @@ -118,8 +120,8 @@ type FleetsClientListCredentialsResponse struct { FleetCredentialResults } -// FleetsClientUpdateResponse contains the response from method FleetsClient.BeginUpdate. -type FleetsClientUpdateResponse struct { +// FleetsClientUpdateAsyncResponse contains the response from method FleetsClient.BeginUpdateAsync. +type FleetsClientUpdateAsyncResponse struct { // The Fleet resource. Fleet } diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/time_rfc3339.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/time_rfc3339.go index 939f8984c901..1a61211ed140 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/time_rfc3339.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/time_rfc3339.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // 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) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armcontainerservicefleet @@ -60,6 +56,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } 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 diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/tsp-location.yaml b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/tsp-location.yaml new file mode 100644 index 000000000000..44bc417e8a7e --- /dev/null +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/containerservice/Fleet.Management +commit: 88ad03595e8e35c4422e55fb93f7e822fee6e1ce +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/updateruns_client.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/updateruns_client.go index 316d134b26a8..a622b09dc282 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/updateruns_client.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/updateruns_client.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // 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) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armcontainerservicefleet @@ -28,7 +24,7 @@ type UpdateRunsClient struct { } // NewUpdateRunsClient creates a new instance of UpdateRunsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewUpdateRunsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*UpdateRunsClient, error) { @@ -46,7 +42,7 @@ func NewUpdateRunsClient(subscriptionID string, credential azcore.TokenCredentia // BeginCreateOrUpdate - Create a UpdateRun // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fleetName - The name of the Fleet resource. // - updateRunName - The name of the UpdateRun resource. @@ -74,7 +70,7 @@ func (client *UpdateRunsClient) BeginCreateOrUpdate(ctx context.Context, resourc // CreateOrUpdate - Create a UpdateRun // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 func (client *UpdateRunsClient) createOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, updateRunName string, resource UpdateRun, options *UpdateRunsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "UpdateRunsClient.BeginCreateOrUpdate" @@ -120,7 +116,7 @@ func (client *UpdateRunsClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-02-preview") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.IfMatch != nil { @@ -129,6 +125,7 @@ func (client *UpdateRunsClient) createOrUpdateCreateRequest(ctx context.Context, if options != nil && options.IfNoneMatch != nil { req.Raw().Header["If-None-Match"] = []string{*options.IfNoneMatch} } + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } @@ -138,7 +135,7 @@ func (client *UpdateRunsClient) createOrUpdateCreateRequest(ctx context.Context, // BeginDelete - Delete a UpdateRun // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fleetName - The name of the Fleet resource. // - updateRunName - The name of the UpdateRun resource. @@ -150,8 +147,7 @@ func (client *UpdateRunsClient) BeginDelete(ctx context.Context, resourceGroupNa return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[UpdateRunsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -164,7 +160,7 @@ func (client *UpdateRunsClient) BeginDelete(ctx context.Context, resourceGroupNa // Delete - Delete a UpdateRun // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 func (client *UpdateRunsClient) deleteOperation(ctx context.Context, resourceGroupName string, fleetName string, updateRunName string, options *UpdateRunsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "UpdateRunsClient.BeginDelete" @@ -210,7 +206,7 @@ func (client *UpdateRunsClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-02-preview") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.IfMatch != nil { @@ -222,7 +218,7 @@ func (client *UpdateRunsClient) deleteCreateRequest(ctx context.Context, resourc // Get - Get a UpdateRun // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fleetName - The name of the Fleet resource. // - updateRunName - The name of the UpdateRun resource. @@ -250,7 +246,7 @@ func (client *UpdateRunsClient) Get(ctx context.Context, resourceGroupName strin } // getCreateRequest creates the Get request. -func (client *UpdateRunsClient) getCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, updateRunName string, options *UpdateRunsClientGetOptions) (*policy.Request, error) { +func (client *UpdateRunsClient) getCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, updateRunName string, _ *UpdateRunsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -273,7 +269,7 @@ func (client *UpdateRunsClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-02-preview") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -290,7 +286,7 @@ func (client *UpdateRunsClient) getHandleResponse(resp *http.Response) (UpdateRu // NewListByFleetPager - List UpdateRun resources by Fleet // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fleetName - The name of the Fleet resource. // - options - UpdateRunsClientListByFleetOptions contains the optional parameters for the UpdateRunsClient.NewListByFleetPager @@ -319,7 +315,7 @@ func (client *UpdateRunsClient) NewListByFleetPager(resourceGroupName string, fl } // listByFleetCreateRequest creates the ListByFleet request. -func (client *UpdateRunsClient) listByFleetCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, options *UpdateRunsClientListByFleetOptions) (*policy.Request, error) { +func (client *UpdateRunsClient) listByFleetCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, _ *UpdateRunsClientListByFleetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -338,7 +334,7 @@ func (client *UpdateRunsClient) listByFleetCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-02-preview") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -356,7 +352,7 @@ func (client *UpdateRunsClient) listByFleetHandleResponse(resp *http.Response) ( // BeginSkip - Skips one or a combination of member/group/stage/afterStageWait(s) of an update run. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fleetName - The name of the Fleet resource. // - updateRunName - The name of the UpdateRun resource. @@ -369,8 +365,7 @@ func (client *UpdateRunsClient) BeginSkip(ctx context.Context, resourceGroupName return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[UpdateRunsClientSkipResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -383,7 +378,7 @@ func (client *UpdateRunsClient) BeginSkip(ctx context.Context, resourceGroupName // Skip - Skips one or a combination of member/group/stage/afterStageWait(s) of an update run. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 func (client *UpdateRunsClient) skip(ctx context.Context, resourceGroupName string, fleetName string, updateRunName string, body SkipProperties, options *UpdateRunsClientBeginSkipOptions) (*http.Response, error) { var err error const operationName = "UpdateRunsClient.BeginSkip" @@ -429,12 +424,13 @@ func (client *UpdateRunsClient) skipCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-02-preview") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} } + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { return nil, err } @@ -444,7 +440,7 @@ func (client *UpdateRunsClient) skipCreateRequest(ctx context.Context, resourceG // BeginStart - Starts an UpdateRun. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fleetName - The name of the Fleet resource. // - updateRunName - The name of the UpdateRun resource. @@ -456,8 +452,7 @@ func (client *UpdateRunsClient) BeginStart(ctx context.Context, resourceGroupNam return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[UpdateRunsClientStartResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -470,7 +465,7 @@ func (client *UpdateRunsClient) BeginStart(ctx context.Context, resourceGroupNam // Start - Starts an UpdateRun. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 func (client *UpdateRunsClient) start(ctx context.Context, resourceGroupName string, fleetName string, updateRunName string, options *UpdateRunsClientBeginStartOptions) (*http.Response, error) { var err error const operationName = "UpdateRunsClient.BeginStart" @@ -516,7 +511,7 @@ func (client *UpdateRunsClient) startCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-02-preview") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.IfMatch != nil { @@ -528,7 +523,7 @@ func (client *UpdateRunsClient) startCreateRequest(ctx context.Context, resource // BeginStop - Stops an UpdateRun. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fleetName - The name of the Fleet resource. // - updateRunName - The name of the UpdateRun resource. @@ -540,8 +535,7 @@ func (client *UpdateRunsClient) BeginStop(ctx context.Context, resourceGroupName return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[UpdateRunsClientStopResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -554,7 +548,7 @@ func (client *UpdateRunsClient) BeginStop(ctx context.Context, resourceGroupName // Stop - Stops an UpdateRun. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-05-02-preview +// Generated from API version 2025-03-01 func (client *UpdateRunsClient) stop(ctx context.Context, resourceGroupName string, fleetName string, updateRunName string, options *UpdateRunsClientBeginStopOptions) (*http.Response, error) { var err error const operationName = "UpdateRunsClient.BeginStop" @@ -600,7 +594,7 @@ func (client *UpdateRunsClient) stopCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-05-02-preview") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.IfMatch != nil { diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/updateruns_client_example_test.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/updateruns_client_example_test.go index ccc21395b32d..f69ce8e5dda6 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/updateruns_client_example_test.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/updateruns_client_example_test.go @@ -1,35 +1,843 @@ -//go:build go1.18 -// +build go1.18 - // 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) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armcontainerservicefleet_test import ( "context" - "log" - "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/containerservicefleet/armcontainerservicefleet" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/UpdateRuns_ListByFleet.json -func ExampleUpdateRunsClient_NewListByFleetPager() { +// Generated from example definition: 2025-03-01/UpdateRuns_CreateOrUpdate.json +func ExampleUpdateRunsClient_BeginCreateOrUpdate_createAnUpdateRun() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewUpdateRunsClient().BeginCreateOrUpdate(ctx, "rg1", "fleet1", "run1", armcontainerservicefleet.UpdateRun{ + Properties: &armcontainerservicefleet.UpdateRunProperties{ + UpdateStrategyID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateStrategies/strategy1"), + Strategy: &armcontainerservicefleet.UpdateRunStrategy{ + Stages: []*armcontainerservicefleet.UpdateStage{ + { + Name: to.Ptr("stage1"), + Groups: []*armcontainerservicefleet.UpdateGroup{ + { + Name: to.Ptr("group-a"), + }, + }, + AfterStageWaitInSeconds: to.Ptr[int32](3600), + }, + }, + }, + ManagedClusterUpdate: &armcontainerservicefleet.ManagedClusterUpdate{ + Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ + Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), + KubernetesVersion: to.Ptr("1.26.1"), + }, + NodeImageSelection: &armcontainerservicefleet.NodeImageSelection{ + Type: to.Ptr(armcontainerservicefleet.NodeImageSelectionTypeLatest), + }, + }, + }, + }, 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 = armcontainerservicefleet.UpdateRunsClientCreateOrUpdateResponse{ + // UpdateRun: &armcontainerservicefleet.UpdateRun{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateRuns/run1"), + // Name: to.Ptr("run1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/updateRuns"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("@contoso.com"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // LastModifiedBy: to.Ptr("@contoso.com"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // }, + // Properties: &armcontainerservicefleet.UpdateRunProperties{ + // ProvisioningState: to.Ptr(armcontainerservicefleet.UpdateRunProvisioningStateSucceeded), + // UpdateStrategyID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateStrategies/strategy1"), + // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ + // Stages: []*armcontainerservicefleet.UpdateStage{ + // { + // Name: to.Ptr("stage1"), + // Groups: []*armcontainerservicefleet.UpdateGroup{ + // { + // Name: to.Ptr("group-a"), + // }, + // }, + // AfterStageWaitInSeconds: to.Ptr[int32](3600), + // }, + // }, + // }, + // ManagedClusterUpdate: &armcontainerservicefleet.ManagedClusterUpdate{ + // Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ + // Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), + // KubernetesVersion: to.Ptr("1.26.1"), + // }, + // NodeImageSelection: &armcontainerservicefleet.NodeImageSelection{ + // Type: to.Ptr(armcontainerservicefleet.NodeImageSelectionTypeLatest), + // }, + // }, + // Status: &armcontainerservicefleet.UpdateRunStatus{ + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // }, + // Stages: []*armcontainerservicefleet.UpdateStageStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // }, + // Name: to.Ptr("stage1"), + // Groups: []*armcontainerservicefleet.UpdateGroupStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // }, + // Name: to.Ptr("group-a"), + // Members: []*armcontainerservicefleet.MemberUpdateStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // }, + // Name: to.Ptr("member-one"), + // ClusterResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myClusters/providers/Microsoft.ContainerService/managedClusters/myCluster"), + // }, + // }, + // }, + // }, + // AfterStageWaitStatus: &armcontainerservicefleet.WaitStatus{ + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // }, + // WaitDurationInSeconds: to.Ptr[int32](3600), + // }, + // }, + // }, + // }, + // }, + // ETag: to.Ptr("\"EtagValue\""), + // }, + // } +} + +// Generated from example definition: 2025-03-01/UpdateRuns_CreateOrUpdate_MaximumSet_Gen.json +func ExampleUpdateRunsClient_BeginCreateOrUpdate_createAnUpdateRunGeneratedByMaximumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewUpdateRunsClient().BeginCreateOrUpdate(ctx, "rgfleets", "fleet1", "fleet1", armcontainerservicefleet.UpdateRun{ + Properties: &armcontainerservicefleet.UpdateRunProperties{ + UpdateStrategyID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateStrategies/strategy1"), + Strategy: &armcontainerservicefleet.UpdateRunStrategy{ + Stages: []*armcontainerservicefleet.UpdateStage{ + { + Name: to.Ptr("stage1"), + Groups: []*armcontainerservicefleet.UpdateGroup{ + { + Name: to.Ptr("group-a"), + }, + }, + AfterStageWaitInSeconds: to.Ptr[int32](3600), + }, + }, + }, + ManagedClusterUpdate: &armcontainerservicefleet.ManagedClusterUpdate{ + Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ + Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), + KubernetesVersion: to.Ptr("1.26.1"), + }, + NodeImageSelection: &armcontainerservicefleet.NodeImageSelection{ + Type: to.Ptr(armcontainerservicefleet.NodeImageSelectionTypeLatest), + CustomNodeImageVersions: []*armcontainerservicefleet.NodeImageVersion{ + {}, + }, + }, + }, + Status: &armcontainerservicefleet.UpdateRunStatus{ + Status: &armcontainerservicefleet.UpdateStatus{ + State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + Error: &armcontainerservicefleet.ErrorDetail{}, + }, + NodeImageSelection: &armcontainerservicefleet.NodeImageSelectionStatus{}, + }, + AutoUpgradeProfileID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.ContainerService/fleets/fleet1/autoUpgradeProfiles/aup1"), + }, + }, &UpdateRunsClientBeginCreateOrUpdateOptions{ + ifMatch: to.Ptr("wyolpuaxgybeygcbz"), + ifNoneMatch: to.Ptr("rwrhonlormgshamadufoo")}) + 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 = armcontainerservicefleet.UpdateRunsClientCreateOrUpdateResponse{ + // UpdateRun: &armcontainerservicefleet.UpdateRun{ + // Properties: &armcontainerservicefleet.UpdateRunProperties{ + // UpdateStrategyID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateStrategies/strategy1"), + // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ + // Stages: []*armcontainerservicefleet.UpdateStage{ + // { + // Name: to.Ptr("stage1"), + // Groups: []*armcontainerservicefleet.UpdateGroup{ + // { + // Name: to.Ptr("group-a"), + // }, + // }, + // AfterStageWaitInSeconds: to.Ptr[int32](3600), + // }, + // }, + // }, + // ManagedClusterUpdate: &armcontainerservicefleet.ManagedClusterUpdate{ + // Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ + // Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), + // KubernetesVersion: to.Ptr("1.26.1"), + // }, + // NodeImageSelection: &armcontainerservicefleet.NodeImageSelection{ + // Type: to.Ptr(armcontainerservicefleet.NodeImageSelectionTypeLatest), + // CustomNodeImageVersions: []*armcontainerservicefleet.NodeImageVersion{ + // { + // Version: to.Ptr("wkcmcqhecdbsoskkny"), + // }, + // }, + // }, + // }, + // ProvisioningState: to.Ptr(armcontainerservicefleet.UpdateRunProvisioningStateSucceeded), + // Status: &armcontainerservicefleet.UpdateRunStatus{ + // Status: &armcontainerservicefleet.UpdateStatus{ + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.768Z"); return t}()), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.768Z"); return t}()), + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // Error: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("ezwocfahsfmbddlqgloysjkthkn"), + // Message: to.Ptr("udtnrxlgadzqlogclb"), + // Target: to.Ptr("l"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("fzgprz"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // }, + // Stages: []*armcontainerservicefleet.UpdateStageStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // Error: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("ezwocfahsfmbddlqgloysjkthkn"), + // Message: to.Ptr("udtnrxlgadzqlogclb"), + // Target: to.Ptr("l"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("fzgprz"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // }, + // Name: to.Ptr("stage1"), + // Groups: []*armcontainerservicefleet.UpdateGroupStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // Error: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("ezwocfahsfmbddlqgloysjkthkn"), + // Message: to.Ptr("udtnrxlgadzqlogclb"), + // Target: to.Ptr("l"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("fzgprz"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // }, + // Name: to.Ptr("group-a"), + // Members: []*armcontainerservicefleet.MemberUpdateStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // Error: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("ezwocfahsfmbddlqgloysjkthkn"), + // Message: to.Ptr("udtnrxlgadzqlogclb"), + // Target: to.Ptr("l"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("fzgprz"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // }, + // Name: to.Ptr("member-one"), + // ClusterResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myClusters/providers/Microsoft.ContainerService/managedClusters/myCluster"), + // OperationID: to.Ptr("islvvdetacuskjzmkcxc"), + // Message: to.Ptr("xrvhotarzemcgeen"), + // }, + // }, + // }, + // }, + // AfterStageWaitStatus: &armcontainerservicefleet.WaitStatus{ + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // Error: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("ezwocfahsfmbddlqgloysjkthkn"), + // Message: to.Ptr("udtnrxlgadzqlogclb"), + // Target: to.Ptr("l"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("fzgprz"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // }, + // WaitDurationInSeconds: to.Ptr[int32](3600), + // }, + // }, + // }, + // NodeImageSelection: &armcontainerservicefleet.NodeImageSelectionStatus{ + // SelectedNodeImageVersions: []*armcontainerservicefleet.NodeImageVersion{ + // { + // Version: to.Ptr("wkcmcqhecdbsoskkny"), + // }, + // }, + // }, + // }, + // AutoUpgradeProfileID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.ContainerService/fleets/fleet1/autoUpgradeProfiles/aup1"), + // }, + // ETag: to.Ptr("\"EtagValue\""), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateRuns/run1"), + // Name: to.Ptr("run1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/updateRuns"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("someUser"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // LastModifiedBy: to.Ptr("someOtherUser"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-03-01/UpdateRuns_Delete.json +func ExampleUpdateRunsClient_BeginDelete_deleteAnUpdateRunResource() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewUpdateRunsClient().BeginDelete(ctx, "rg1", "fleet1", "run1", 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 = armcontainerservicefleet.UpdateRunsClientDeleteResponse{ + // } +} + +// Generated from example definition: 2025-03-01/UpdateRuns_Delete_MaximumSet_Gen.json +func ExampleUpdateRunsClient_BeginDelete_deleteAnUpdateRunResourceGeneratedByMaximumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewUpdateRunsClient().BeginDelete(ctx, "rgfleets", "fleet1", "fleet1", &UpdateRunsClientBeginDeleteOptions{ + ifMatch: to.Ptr("xnbwucfeufeagpa")}) + 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 = armcontainerservicefleet.UpdateRunsClientDeleteResponse{ + // } +} + +// Generated from example definition: 2025-03-01/UpdateRuns_Get.json +func ExampleUpdateRunsClient_Get_getsAnUpdateRunResource() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewUpdateRunsClient().Get(ctx, "rg1", "fleet1", "run1", 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 = armcontainerservicefleet.UpdateRunsClientGetResponse{ + // UpdateRun: &armcontainerservicefleet.UpdateRun{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateRuns/run1"), + // Name: to.Ptr("run1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/updateRuns"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("@contoso.com"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // LastModifiedBy: to.Ptr("@contoso.com"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // }, + // Properties: &armcontainerservicefleet.UpdateRunProperties{ + // ProvisioningState: to.Ptr(armcontainerservicefleet.UpdateRunProvisioningStateSucceeded), + // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ + // Stages: []*armcontainerservicefleet.UpdateStage{ + // { + // Name: to.Ptr("stage1"), + // Groups: []*armcontainerservicefleet.UpdateGroup{ + // { + // Name: to.Ptr("group-a"), + // }, + // }, + // AfterStageWaitInSeconds: to.Ptr[int32](3600), + // }, + // }, + // }, + // ManagedClusterUpdate: &armcontainerservicefleet.ManagedClusterUpdate{ + // Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ + // Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), + // KubernetesVersion: to.Ptr("1.26.1"), + // }, + // NodeImageSelection: &armcontainerservicefleet.NodeImageSelection{ + // Type: to.Ptr(armcontainerservicefleet.NodeImageSelectionTypeLatest), + // }, + // }, + // Status: &armcontainerservicefleet.UpdateRunStatus{ + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // }, + // Stages: []*armcontainerservicefleet.UpdateStageStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // }, + // Name: to.Ptr("stage1"), + // Groups: []*armcontainerservicefleet.UpdateGroupStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // }, + // Name: to.Ptr("group-a"), + // Members: []*armcontainerservicefleet.MemberUpdateStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // }, + // Name: to.Ptr("member-one"), + // ClusterResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myClusters/providers/Microsoft.ContainerService/managedClusters/myCluster"), + // }, + // }, + // }, + // }, + // AfterStageWaitStatus: &armcontainerservicefleet.WaitStatus{ + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // }, + // WaitDurationInSeconds: to.Ptr[int32](3600), + // }, + // }, + // }, + // }, + // }, + // ETag: to.Ptr("\"EtagValue\""), + // }, + // } +} + +// Generated from example definition: 2025-03-01/UpdateRuns_Get_MaximumSet_Gen.json +func ExampleUpdateRunsClient_Get_getsAnUpdateRunResourceGeneratedByMaximumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewUpdateRunsClient().Get(ctx, "rgfleets", "fleet1", "fleet1", 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 = armcontainerservicefleet.UpdateRunsClientGetResponse{ + // UpdateRun: &armcontainerservicefleet.UpdateRun{ + // Properties: &armcontainerservicefleet.UpdateRunProperties{ + // UpdateStrategyID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateStrategies/strategy1"), + // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ + // Stages: []*armcontainerservicefleet.UpdateStage{ + // { + // Name: to.Ptr("stage1"), + // Groups: []*armcontainerservicefleet.UpdateGroup{ + // { + // Name: to.Ptr("group-a"), + // }, + // }, + // AfterStageWaitInSeconds: to.Ptr[int32](3600), + // }, + // }, + // }, + // ManagedClusterUpdate: &armcontainerservicefleet.ManagedClusterUpdate{ + // Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ + // Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), + // KubernetesVersion: to.Ptr("1.26.1"), + // }, + // NodeImageSelection: &armcontainerservicefleet.NodeImageSelection{ + // Type: to.Ptr(armcontainerservicefleet.NodeImageSelectionTypeLatest), + // CustomNodeImageVersions: []*armcontainerservicefleet.NodeImageVersion{ + // { + // Version: to.Ptr("wkcmcqhecdbsoskkny"), + // }, + // }, + // }, + // }, + // ProvisioningState: to.Ptr(armcontainerservicefleet.UpdateRunProvisioningStateSucceeded), + // Status: &armcontainerservicefleet.UpdateRunStatus{ + // Status: &armcontainerservicefleet.UpdateStatus{ + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.768Z"); return t}()), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.768Z"); return t}()), + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // Error: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("ezwocfahsfmbddlqgloysjkthkn"), + // Message: to.Ptr("udtnrxlgadzqlogclb"), + // Target: to.Ptr("l"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("fzgprz"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // }, + // Stages: []*armcontainerservicefleet.UpdateStageStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // Error: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("ezwocfahsfmbddlqgloysjkthkn"), + // Message: to.Ptr("udtnrxlgadzqlogclb"), + // Target: to.Ptr("l"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("fzgprz"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // }, + // Name: to.Ptr("stage1"), + // Groups: []*armcontainerservicefleet.UpdateGroupStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // Error: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("ezwocfahsfmbddlqgloysjkthkn"), + // Message: to.Ptr("udtnrxlgadzqlogclb"), + // Target: to.Ptr("l"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("fzgprz"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // }, + // Name: to.Ptr("group-a"), + // Members: []*armcontainerservicefleet.MemberUpdateStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // Error: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("ezwocfahsfmbddlqgloysjkthkn"), + // Message: to.Ptr("udtnrxlgadzqlogclb"), + // Target: to.Ptr("l"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("fzgprz"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // }, + // Name: to.Ptr("member-one"), + // ClusterResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myClusters/providers/Microsoft.ContainerService/managedClusters/myCluster"), + // OperationID: to.Ptr("islvvdetacuskjzmkcxc"), + // Message: to.Ptr("xrvhotarzemcgeen"), + // }, + // }, + // }, + // }, + // AfterStageWaitStatus: &armcontainerservicefleet.WaitStatus{ + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // Error: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("ezwocfahsfmbddlqgloysjkthkn"), + // Message: to.Ptr("udtnrxlgadzqlogclb"), + // Target: to.Ptr("l"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("fzgprz"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // }, + // WaitDurationInSeconds: to.Ptr[int32](3600), + // }, + // }, + // }, + // NodeImageSelection: &armcontainerservicefleet.NodeImageSelectionStatus{ + // SelectedNodeImageVersions: []*armcontainerservicefleet.NodeImageVersion{ + // { + // Version: to.Ptr("wkcmcqhecdbsoskkny"), + // }, + // }, + // }, + // }, + // AutoUpgradeProfileID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.ContainerService/fleets/fleet1/autoUpgradeProfiles/aup1"), + // }, + // ETag: to.Ptr("\"EtagValue\""), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateRuns/run1"), + // Name: to.Ptr("run1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/updateRuns"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("someUser"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // LastModifiedBy: to.Ptr("someOtherUser"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-03-01/UpdateRuns_ListByFleet.json +func ExampleUpdateRunsClient_NewListByFleetPager_listsTheUpdateRunResourcesByFleet() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewUpdateRunsClient().NewListByFleetPager("rg1", "fleet1", 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 = armcontainerservicefleet.UpdateRunsClientListByFleetResponse{ + // UpdateRunListResult: armcontainerservicefleet.UpdateRunListResult{ + // Value: []*armcontainerservicefleet.UpdateRun{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateRuns/run1"), + // Name: to.Ptr("run1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/updateRuns"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("@contoso.com"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // LastModifiedBy: to.Ptr("@contoso.com"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // }, + // Properties: &armcontainerservicefleet.UpdateRunProperties{ + // ProvisioningState: to.Ptr(armcontainerservicefleet.UpdateRunProvisioningStateSucceeded), + // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ + // Stages: []*armcontainerservicefleet.UpdateStage{ + // { + // Name: to.Ptr("stage1"), + // Groups: []*armcontainerservicefleet.UpdateGroup{ + // { + // Name: to.Ptr("group-a"), + // }, + // }, + // AfterStageWaitInSeconds: to.Ptr[int32](3600), + // }, + // }, + // }, + // ManagedClusterUpdate: &armcontainerservicefleet.ManagedClusterUpdate{ + // Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ + // Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), + // KubernetesVersion: to.Ptr("1.26.1"), + // }, + // NodeImageSelection: &armcontainerservicefleet.NodeImageSelection{ + // Type: to.Ptr(armcontainerservicefleet.NodeImageSelectionTypeLatest), + // }, + // }, + // Status: &armcontainerservicefleet.UpdateRunStatus{ + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // }, + // Stages: []*armcontainerservicefleet.UpdateStageStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // }, + // Name: to.Ptr("stage1"), + // Groups: []*armcontainerservicefleet.UpdateGroupStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // }, + // Name: to.Ptr("group-a"), + // Members: []*armcontainerservicefleet.MemberUpdateStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // }, + // Name: to.Ptr("member-one"), + // ClusterResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myClusters/providers/Microsoft.ContainerService/managedClusters/myCluster"), + // }, + // }, + // }, + // }, + // AfterStageWaitStatus: &armcontainerservicefleet.WaitStatus{ + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // }, + // WaitDurationInSeconds: to.Ptr[int32](3600), + // }, + // }, + // }, + // }, + // }, + // ETag: to.Ptr("\"EtagValue\""), + // }, + // }, + // NextLink: to.Ptr("http://nextlink.contoso.com"), + // }, + // } + } +} + +// Generated from example definition: 2025-03-01/UpdateRuns_ListByFleet_MaximumSet_Gen.json +func ExampleUpdateRunsClient_NewListByFleetPager_listsTheUpdateRunResourcesByFleetGeneratedByMaximumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewUpdateRunsClient().NewListByFleetPager("rg1", "fleet1", nil) + pager := clientFactory.NewUpdateRunsClient().NewListByFleetPager("rgfleets", "fleet1", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -40,210 +848,345 @@ func ExampleUpdateRunsClient_NewListByFleetPager() { _ = 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.UpdateRunListResult = armcontainerservicefleet.UpdateRunListResult{ - // Value: []*armcontainerservicefleet.UpdateRun{ - // { - // Name: to.Ptr("run1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets/updateRuns"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateRuns/run1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // CreatedBy: to.Ptr("@contoso.com"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // LastModifiedBy: to.Ptr("@contoso.com"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // ETag: to.Ptr("\"EtagValue\""), - // Properties: &armcontainerservicefleet.UpdateRunProperties{ - // ManagedClusterUpdate: &armcontainerservicefleet.ManagedClusterUpdate{ - // NodeImageSelection: &armcontainerservicefleet.NodeImageSelection{ - // Type: to.Ptr(armcontainerservicefleet.NodeImageSelectionTypeLatest), + // page = armcontainerservicefleet.UpdateRunsClientListByFleetResponse{ + // UpdateRunListResult: armcontainerservicefleet.UpdateRunListResult{ + // Value: []*armcontainerservicefleet.UpdateRun{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateRuns/run1"), + // Name: to.Ptr("run1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/updateRuns"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("@contoso.com"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // LastModifiedBy: to.Ptr("@contoso.com"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // }, + // Properties: &armcontainerservicefleet.UpdateRunProperties{ + // ProvisioningState: to.Ptr(armcontainerservicefleet.UpdateRunProvisioningStateSucceeded), + // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ + // Stages: []*armcontainerservicefleet.UpdateStage{ + // { + // Name: to.Ptr("stage1"), + // Groups: []*armcontainerservicefleet.UpdateGroup{ + // { + // Name: to.Ptr("group-a"), + // }, + // }, + // AfterStageWaitInSeconds: to.Ptr[int32](3600), + // }, + // }, // }, - // Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ - // Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), - // KubernetesVersion: to.Ptr("1.26.1"), + // ManagedClusterUpdate: &armcontainerservicefleet.ManagedClusterUpdate{ + // Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ + // Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), + // KubernetesVersion: to.Ptr("1.26.1"), + // }, + // NodeImageSelection: &armcontainerservicefleet.NodeImageSelection{ + // Type: to.Ptr(armcontainerservicefleet.NodeImageSelectionTypeLatest), + // CustomNodeImageVersions: []*armcontainerservicefleet.NodeImageVersion{ + // { + // Version: to.Ptr("wkcmcqhecdbsoskkny"), + // }, + // }, + // }, // }, - // }, - // ProvisioningState: to.Ptr(armcontainerservicefleet.UpdateRunProvisioningStateSucceeded), - // Status: &armcontainerservicefleet.UpdateRunStatus{ - // Stages: []*armcontainerservicefleet.UpdateStageStatus{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitStatus: &armcontainerservicefleet.WaitStatus{ + // Status: &armcontainerservicefleet.UpdateRunStatus{ + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.763Z"); return t}()), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.763Z"); return t}()), + // Error: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("ezwocfahsfmbddlqgloysjkthkn"), + // Message: to.Ptr("udtnrxlgadzqlogclb"), + // Target: to.Ptr("l"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("fzgprz"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // }, + // Stages: []*armcontainerservicefleet.UpdateStageStatus{ + // { // Status: &armcontainerservicefleet.UpdateStatus{ // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // Error: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("ezwocfahsfmbddlqgloysjkthkn"), + // Message: to.Ptr("udtnrxlgadzqlogclb"), + // Target: to.Ptr("l"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("fzgprz"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, // }, - // WaitDurationInSeconds: to.Ptr[int32](3600), - // }, - // Groups: []*armcontainerservicefleet.UpdateGroupStatus{ - // { - // Name: to.Ptr("group-a"), - // Members: []*armcontainerservicefleet.MemberUpdateStatus{ - // { - // Name: to.Ptr("member-one"), - // ClusterResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myClusters/providers/Microsoft.ContainerService/managedClusters/myCluster"), - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // Name: to.Ptr("stage1"), + // Groups: []*armcontainerservicefleet.UpdateGroupStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // Error: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("ezwocfahsfmbddlqgloysjkthkn"), + // Message: to.Ptr("udtnrxlgadzqlogclb"), + // Target: to.Ptr("l"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("fzgprz"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, // }, - // }}, + // }, + // Name: to.Ptr("group-a"), + // Members: []*armcontainerservicefleet.MemberUpdateStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // Error: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("ezwocfahsfmbddlqgloysjkthkn"), + // Message: to.Ptr("udtnrxlgadzqlogclb"), + // Target: to.Ptr("l"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("fzgprz"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // }, + // Name: to.Ptr("member-one"), + // ClusterResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myClusters/providers/Microsoft.ContainerService/managedClusters/myCluster"), + // OperationID: to.Ptr("islvvdetacuskjzmkcxc"), + // Message: to.Ptr("xrvhotarzemcgeen"), + // }, + // }, + // }, + // }, + // AfterStageWaitStatus: &armcontainerservicefleet.WaitStatus{ // Status: &armcontainerservicefleet.UpdateStatus{ // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // Error: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("ezwocfahsfmbddlqgloysjkthkn"), + // Message: to.Ptr("udtnrxlgadzqlogclb"), + // Target: to.Ptr("l"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("fzgprz"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // WaitDurationInSeconds: to.Ptr[int32](3600), + // }, // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), - // }, - // }, - // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ - // Stages: []*armcontainerservicefleet.UpdateStage{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitInSeconds: to.Ptr[int32](3600), - // Groups: []*armcontainerservicefleet.UpdateGroup{ + // }, + // NodeImageSelection: &armcontainerservicefleet.NodeImageSelectionStatus{ + // SelectedNodeImageVersions: []*armcontainerservicefleet.NodeImageVersion{ // { - // Name: to.Ptr("group-a"), - // }}, - // }}, + // Version: to.Ptr("wkcmcqhecdbsoskkny"), + // }, + // }, + // }, + // }, + // UpdateStrategyID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.ContainerService/fleets/fleet1/updateStrategies/strategy1"), + // AutoUpgradeProfileID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.ContainerService/fleets/fleet1/autoUpgradeProfiles/aup1"), // }, + // ETag: to.Ptr("\"EtagValue\""), // }, - // }}, + // }, + // NextLink: to.Ptr("http://nextlink.contoso.com"), + // }, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/UpdateRuns_Get.json -func ExampleUpdateRunsClient_Get() { +// Generated from example definition: 2025-03-01/UpdateRuns_Skip.json +func ExampleUpdateRunsClient_BeginSkip_skipsOneOrMoreMemberGroupStageAfterStageWaitSOfAnUpdateRun() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewUpdateRunsClient().Get(ctx, "rg1", "fleet1", "run1", nil) + poller, err := clientFactory.NewUpdateRunsClient().BeginSkip(ctx, "rg1", "fleet1", "run1", armcontainerservicefleet.SkipProperties{ + Targets: []*armcontainerservicefleet.SkipTarget{ + { + Type: to.Ptr(armcontainerservicefleet.TargetTypeMember), + Name: to.Ptr("member-one"), + }, + { + Type: to.Ptr(armcontainerservicefleet.TargetTypeAfterStageWait), + Name: to.Ptr("stage1"), + }, + }, + }, 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.UpdateRun = armcontainerservicefleet.UpdateRun{ - // Name: to.Ptr("run1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets/updateRuns"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateRuns/run1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // CreatedBy: to.Ptr("@contoso.com"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // LastModifiedBy: to.Ptr("@contoso.com"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // ETag: to.Ptr("\"EtagValue\""), - // Properties: &armcontainerservicefleet.UpdateRunProperties{ - // ManagedClusterUpdate: &armcontainerservicefleet.ManagedClusterUpdate{ - // NodeImageSelection: &armcontainerservicefleet.NodeImageSelection{ - // Type: to.Ptr(armcontainerservicefleet.NodeImageSelectionTypeLatest), + // res = armcontainerservicefleet.UpdateRunsClientSkipResponse{ + // UpdateRun: &armcontainerservicefleet.UpdateRun{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateRuns/run1"), + // Name: to.Ptr("run1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/updateRuns"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("@contoso.com"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:09:08.395Z"); return t}()), + // LastModifiedBy: to.Ptr("@contoso.com"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // }, + // Properties: &armcontainerservicefleet.UpdateRunProperties{ + // ProvisioningState: to.Ptr(armcontainerservicefleet.UpdateRunProvisioningStateSucceeded), + // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ + // Stages: []*armcontainerservicefleet.UpdateStage{ + // { + // Name: to.Ptr("stage1"), + // Groups: []*armcontainerservicefleet.UpdateGroup{ + // { + // Name: to.Ptr("group-a"), + // }, + // { + // Name: to.Ptr("group-b"), + // }, + // }, + // AfterStageWaitInSeconds: to.Ptr[int32](3600), + // }, + // }, // }, - // Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ - // Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), - // KubernetesVersion: to.Ptr("1.26.1"), + // ManagedClusterUpdate: &armcontainerservicefleet.ManagedClusterUpdate{ + // Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ + // Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), + // KubernetesVersion: to.Ptr("1.26.1"), + // }, + // NodeImageSelection: &armcontainerservicefleet.NodeImageSelection{ + // Type: to.Ptr(armcontainerservicefleet.NodeImageSelectionTypeLatest), + // }, // }, - // }, - // ProvisioningState: to.Ptr(armcontainerservicefleet.UpdateRunProvisioningStateSucceeded), - // Status: &armcontainerservicefleet.UpdateRunStatus{ - // Stages: []*armcontainerservicefleet.UpdateStageStatus{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitStatus: &armcontainerservicefleet.WaitStatus{ + // Status: &armcontainerservicefleet.UpdateRunStatus{ + // Status: &armcontainerservicefleet.UpdateStatus{ + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // State: to.Ptr(armcontainerservicefleet.UpdateStateRunning), + // }, + // Stages: []*armcontainerservicefleet.UpdateStageStatus{ + // { // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // State: to.Ptr(armcontainerservicefleet.UpdateStateRunning), // }, - // WaitDurationInSeconds: to.Ptr[int32](3600), - // }, - // Groups: []*armcontainerservicefleet.UpdateGroupStatus{ - // { - // Name: to.Ptr("group-a"), - // Members: []*armcontainerservicefleet.MemberUpdateStatus{ - // { - // Name: to.Ptr("member-one"), - // ClusterResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myClusters/providers/Microsoft.ContainerService/managedClusters/myCluster"), - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // Name: to.Ptr("stage1"), + // Groups: []*armcontainerservicefleet.UpdateGroupStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // State: to.Ptr(armcontainerservicefleet.UpdateStateSkipped), + // }, + // Name: to.Ptr("group-a"), + // Members: []*armcontainerservicefleet.MemberUpdateStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateSkipped), + // }, + // Name: to.Ptr("member-one"), + // ClusterResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myClusters/providers/Microsoft.ContainerService/managedClusters/myCluster-1"), + // }, + // }, + // }, + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // State: to.Ptr(armcontainerservicefleet.UpdateStateRunning), + // }, + // Name: to.Ptr("group-b"), + // Members: []*armcontainerservicefleet.MemberUpdateStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateRunning), + // }, + // Name: to.Ptr("member-two"), + // ClusterResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myClusters/providers/Microsoft.ContainerService/managedClusters/myCluster-2"), // }, - // }}, + // }, + // }, + // }, + // AfterStageWaitStatus: &armcontainerservicefleet.WaitStatus{ // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // State: to.Ptr(armcontainerservicefleet.UpdateStateSkipped), // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // WaitDurationInSeconds: to.Ptr[int32](3600), + // }, // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // }, // }, // }, - // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ - // Stages: []*armcontainerservicefleet.UpdateStage{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitInSeconds: to.Ptr[int32](3600), - // Groups: []*armcontainerservicefleet.UpdateGroup{ - // { - // Name: to.Ptr("group-a"), - // }}, - // }}, - // }, + // ETag: to.Ptr("\"EtagValue\""), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/UpdateRuns_CreateOrUpdate.json -func ExampleUpdateRunsClient_BeginCreateOrUpdate() { +// Generated from example definition: 2025-03-01/UpdateRuns_Skip_MaximumSet_Gen.json +func ExampleUpdateRunsClient_BeginSkip_skipsOneOrMoreMemberGroupStageAfterStageWaitSOfAnUpdateRunGeneratedByMaximumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewUpdateRunsClient().BeginCreateOrUpdate(ctx, "rg1", "fleet1", "run1", armcontainerservicefleet.UpdateRun{ - Properties: &armcontainerservicefleet.UpdateRunProperties{ - ManagedClusterUpdate: &armcontainerservicefleet.ManagedClusterUpdate{ - NodeImageSelection: &armcontainerservicefleet.NodeImageSelection{ - Type: to.Ptr(armcontainerservicefleet.NodeImageSelectionTypeLatest), - }, - Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ - Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), - KubernetesVersion: to.Ptr("1.26.1"), - }, + poller, err := clientFactory.NewUpdateRunsClient().BeginSkip(ctx, "rgfleets", "fleet1", "fleet1", armcontainerservicefleet.SkipProperties{ + Targets: []*armcontainerservicefleet.SkipTarget{ + { + Type: to.Ptr(armcontainerservicefleet.TargetTypeMember), + Name: to.Ptr("member-one"), }, - Strategy: &armcontainerservicefleet.UpdateRunStrategy{ - Stages: []*armcontainerservicefleet.UpdateStage{ - { - Name: to.Ptr("stage1"), - AfterStageWaitInSeconds: to.Ptr[int32](3600), - Groups: []*armcontainerservicefleet.UpdateGroup{ - { - Name: to.Ptr("group-a"), - }}, - }}, + { + Type: to.Ptr(armcontainerservicefleet.TargetTypeAfterStageWait), + Name: to.Ptr("stage1"), }, - UpdateStrategyID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateStrategies/strategy1"), }, - }, &armcontainerservicefleet.UpdateRunsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: nil, - }) + }, &UpdateRunsClientBeginSkipOptions{ + ifMatch: to.Ptr("rncfubdzrhcihvpqflbsjvoau")}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -254,122 +1197,298 @@ func ExampleUpdateRunsClient_BeginCreateOrUpdate() { // 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.UpdateRun = armcontainerservicefleet.UpdateRun{ - // Name: to.Ptr("run1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets/updateRuns"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateRuns/run1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // CreatedBy: to.Ptr("@contoso.com"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // LastModifiedBy: to.Ptr("@contoso.com"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // ETag: to.Ptr("\"EtagValue\""), - // Properties: &armcontainerservicefleet.UpdateRunProperties{ - // ManagedClusterUpdate: &armcontainerservicefleet.ManagedClusterUpdate{ - // NodeImageSelection: &armcontainerservicefleet.NodeImageSelection{ - // Type: to.Ptr(armcontainerservicefleet.NodeImageSelectionTypeLatest), + // res = armcontainerservicefleet.UpdateRunsClientSkipResponse{ + // UpdateRun: &armcontainerservicefleet.UpdateRun{ + // Properties: &armcontainerservicefleet.UpdateRunProperties{ + // UpdateStrategyID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateStrategies/strategy1"), + // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ + // Stages: []*armcontainerservicefleet.UpdateStage{ + // { + // Name: to.Ptr("stage1"), + // Groups: []*armcontainerservicefleet.UpdateGroup{ + // { + // Name: to.Ptr("group-a"), + // }, + // }, + // AfterStageWaitInSeconds: to.Ptr[int32](3600), + // }, + // }, // }, - // Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ - // Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), - // KubernetesVersion: to.Ptr("1.26.1"), + // ManagedClusterUpdate: &armcontainerservicefleet.ManagedClusterUpdate{ + // Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ + // Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), + // KubernetesVersion: to.Ptr("1.26.1"), + // }, + // NodeImageSelection: &armcontainerservicefleet.NodeImageSelection{ + // Type: to.Ptr(armcontainerservicefleet.NodeImageSelectionTypeLatest), + // CustomNodeImageVersions: []*armcontainerservicefleet.NodeImageVersion{ + // { + // Version: to.Ptr("wkcmcqhecdbsoskkny"), + // }, + // }, + // }, // }, - // }, - // ProvisioningState: to.Ptr(armcontainerservicefleet.UpdateRunProvisioningStateSucceeded), - // Status: &armcontainerservicefleet.UpdateRunStatus{ - // Stages: []*armcontainerservicefleet.UpdateStageStatus{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitStatus: &armcontainerservicefleet.WaitStatus{ + // ProvisioningState: to.Ptr(armcontainerservicefleet.UpdateRunProvisioningStateSucceeded), + // Status: &armcontainerservicefleet.UpdateRunStatus{ + // Status: &armcontainerservicefleet.UpdateStatus{ + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.768Z"); return t}()), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.768Z"); return t}()), + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // Error: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("ezwocfahsfmbddlqgloysjkthkn"), + // Message: to.Ptr("udtnrxlgadzqlogclb"), + // Target: to.Ptr("l"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("fzgprz"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // }, + // Stages: []*armcontainerservicefleet.UpdateStageStatus{ + // { // Status: &armcontainerservicefleet.UpdateStatus{ // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // Error: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("ezwocfahsfmbddlqgloysjkthkn"), + // Message: to.Ptr("udtnrxlgadzqlogclb"), + // Target: to.Ptr("l"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("fzgprz"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, // }, - // WaitDurationInSeconds: to.Ptr[int32](3600), - // }, - // Groups: []*armcontainerservicefleet.UpdateGroupStatus{ - // { - // Name: to.Ptr("group-a"), - // Members: []*armcontainerservicefleet.MemberUpdateStatus{ - // { - // Name: to.Ptr("member-one"), - // ClusterResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myClusters/providers/Microsoft.ContainerService/managedClusters/myCluster"), - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // Name: to.Ptr("stage1"), + // Groups: []*armcontainerservicefleet.UpdateGroupStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // Error: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("ezwocfahsfmbddlqgloysjkthkn"), + // Message: to.Ptr("udtnrxlgadzqlogclb"), + // Target: to.Ptr("l"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("fzgprz"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // }, + // Name: to.Ptr("group-a"), + // Members: []*armcontainerservicefleet.MemberUpdateStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // Error: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("ezwocfahsfmbddlqgloysjkthkn"), + // Message: to.Ptr("udtnrxlgadzqlogclb"), + // Target: to.Ptr("l"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("fzgprz"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // }, + // Name: to.Ptr("member-one"), + // ClusterResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myClusters/providers/Microsoft.ContainerService/managedClusters/myCluster"), + // OperationID: to.Ptr("islvvdetacuskjzmkcxc"), + // Message: to.Ptr("xrvhotarzemcgeen"), // }, - // }}, + // }, + // }, + // }, + // AfterStageWaitStatus: &armcontainerservicefleet.WaitStatus{ // Status: &armcontainerservicefleet.UpdateStatus{ // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // Error: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("ezwocfahsfmbddlqgloysjkthkn"), + // Message: to.Ptr("udtnrxlgadzqlogclb"), + // Target: to.Ptr("l"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("fzgprz"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // WaitDurationInSeconds: to.Ptr[int32](3600), + // }, + // }, + // }, + // NodeImageSelection: &armcontainerservicefleet.NodeImageSelectionStatus{ + // SelectedNodeImageVersions: []*armcontainerservicefleet.NodeImageVersion{ + // { + // Version: to.Ptr("wkcmcqhecdbsoskkny"), + // }, // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // }, // }, + // AutoUpgradeProfileID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.ContainerService/fleets/fleet1/autoUpgradeProfiles/aup1"), // }, - // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ - // Stages: []*armcontainerservicefleet.UpdateStage{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitInSeconds: to.Ptr[int32](3600), - // Groups: []*armcontainerservicefleet.UpdateGroup{ - // { - // Name: to.Ptr("group-a"), - // }}, - // }}, + // ETag: to.Ptr("\"EtagValue\""), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateRuns/run1"), + // Name: to.Ptr("run1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/updateRuns"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("someUser"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // LastModifiedBy: to.Ptr("someOtherUser"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), // }, - // UpdateStrategyID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateStrategies/strategy1"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/UpdateRuns_Delete.json -func ExampleUpdateRunsClient_BeginDelete() { +// Generated from example definition: 2025-03-01/UpdateRuns_Start.json +func ExampleUpdateRunsClient_BeginStart_startsAnUpdateRun() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewUpdateRunsClient().BeginDelete(ctx, "rg1", "fleet1", "run1", &armcontainerservicefleet.UpdateRunsClientBeginDeleteOptions{IfMatch: nil}) + poller, err := clientFactory.NewUpdateRunsClient().BeginStart(ctx, "rg1", "fleet1", "run1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } - _, err = poller.PollUntilDone(ctx, nil) + 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 = armcontainerservicefleet.UpdateRunsClientStartResponse{ + // UpdateRun: &armcontainerservicefleet.UpdateRun{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateRuns/run1"), + // Name: to.Ptr("run1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/updateRuns"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("@contoso.com"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:09:08.395Z"); return t}()), + // LastModifiedBy: to.Ptr("@contoso.com"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // }, + // Properties: &armcontainerservicefleet.UpdateRunProperties{ + // ProvisioningState: to.Ptr(armcontainerservicefleet.UpdateRunProvisioningStateSucceeded), + // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ + // Stages: []*armcontainerservicefleet.UpdateStage{ + // { + // Name: to.Ptr("stage1"), + // Groups: []*armcontainerservicefleet.UpdateGroup{ + // { + // Name: to.Ptr("group-a"), + // }, + // }, + // AfterStageWaitInSeconds: to.Ptr[int32](3600), + // }, + // }, + // }, + // ManagedClusterUpdate: &armcontainerservicefleet.ManagedClusterUpdate{ + // Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ + // Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), + // KubernetesVersion: to.Ptr("1.26.1"), + // }, + // NodeImageSelection: &armcontainerservicefleet.NodeImageSelection{ + // Type: to.Ptr(armcontainerservicefleet.NodeImageSelectionTypeLatest), + // }, + // }, + // Status: &armcontainerservicefleet.UpdateRunStatus{ + // Status: &armcontainerservicefleet.UpdateStatus{ + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // State: to.Ptr(armcontainerservicefleet.UpdateStateRunning), + // }, + // Stages: []*armcontainerservicefleet.UpdateStageStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // State: to.Ptr(armcontainerservicefleet.UpdateStateRunning), + // }, + // Name: to.Ptr("stage1"), + // Groups: []*armcontainerservicefleet.UpdateGroupStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // State: to.Ptr(armcontainerservicefleet.UpdateStateRunning), + // }, + // Name: to.Ptr("group-a"), + // Members: []*armcontainerservicefleet.MemberUpdateStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateRunning), + // }, + // Name: to.Ptr("member-one"), + // ClusterResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myClusters/providers/Microsoft.ContainerService/managedClusters/myCluster"), + // }, + // }, + // }, + // }, + // AfterStageWaitStatus: &armcontainerservicefleet.WaitStatus{ + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // }, + // WaitDurationInSeconds: to.Ptr[int32](3600), + // }, + // }, + // }, + // }, + // }, + // ETag: to.Ptr("\"EtagValue\""), + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/UpdateRuns_Skip.json -func ExampleUpdateRunsClient_BeginSkip() { +// Generated from example definition: 2025-03-01/UpdateRuns_Start_MaximumSet_Gen.json +func ExampleUpdateRunsClient_BeginStart_startsAnUpdateRunGeneratedByMaximumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewUpdateRunsClient().BeginSkip(ctx, "rg1", "fleet1", "run1", armcontainerservicefleet.SkipProperties{ - Targets: []*armcontainerservicefleet.SkipTarget{ - { - Name: to.Ptr("member-one"), - Type: to.Ptr(armcontainerservicefleet.TargetTypeMember), - }, - { - Name: to.Ptr("stage1"), - Type: to.Ptr(armcontainerservicefleet.TargetTypeAfterStageWait), - }}, - }, &armcontainerservicefleet.UpdateRunsClientBeginSkipOptions{IfMatch: nil}) + poller, err := clientFactory.NewUpdateRunsClient().BeginStart(ctx, "rgfleets", "fleet1", "fleet1", &UpdateRunsClientBeginStartOptions{ + ifMatch: to.Ptr("bvhjlqeindkmljbbiypbqiaqgtkhlu")}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -380,111 +1499,193 @@ func ExampleUpdateRunsClient_BeginSkip() { // 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.UpdateRun = armcontainerservicefleet.UpdateRun{ - // Name: to.Ptr("run1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets/updateRuns"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateRuns/run1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:09:08.395Z"); return t}()), - // CreatedBy: to.Ptr("@contoso.com"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // LastModifiedBy: to.Ptr("@contoso.com"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // ETag: to.Ptr("\"EtagValue\""), - // Properties: &armcontainerservicefleet.UpdateRunProperties{ - // ManagedClusterUpdate: &armcontainerservicefleet.ManagedClusterUpdate{ - // NodeImageSelection: &armcontainerservicefleet.NodeImageSelection{ - // Type: to.Ptr(armcontainerservicefleet.NodeImageSelectionTypeLatest), + // res = armcontainerservicefleet.UpdateRunsClientStartResponse{ + // UpdateRun: &armcontainerservicefleet.UpdateRun{ + // Properties: &armcontainerservicefleet.UpdateRunProperties{ + // UpdateStrategyID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateStrategies/strategy1"), + // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ + // Stages: []*armcontainerservicefleet.UpdateStage{ + // { + // Name: to.Ptr("stage1"), + // Groups: []*armcontainerservicefleet.UpdateGroup{ + // { + // Name: to.Ptr("group-a"), + // }, + // }, + // AfterStageWaitInSeconds: to.Ptr[int32](3600), + // }, + // }, // }, - // Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ - // Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), - // KubernetesVersion: to.Ptr("1.26.1"), + // ManagedClusterUpdate: &armcontainerservicefleet.ManagedClusterUpdate{ + // Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ + // Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), + // KubernetesVersion: to.Ptr("1.26.1"), + // }, + // NodeImageSelection: &armcontainerservicefleet.NodeImageSelection{ + // Type: to.Ptr(armcontainerservicefleet.NodeImageSelectionTypeLatest), + // CustomNodeImageVersions: []*armcontainerservicefleet.NodeImageVersion{ + // { + // Version: to.Ptr("wkcmcqhecdbsoskkny"), + // }, + // }, + // }, // }, - // }, - // ProvisioningState: to.Ptr(armcontainerservicefleet.UpdateRunProvisioningStateSucceeded), - // Status: &armcontainerservicefleet.UpdateRunStatus{ - // Stages: []*armcontainerservicefleet.UpdateStageStatus{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitStatus: &armcontainerservicefleet.WaitStatus{ - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateSkipped), + // ProvisioningState: to.Ptr(armcontainerservicefleet.UpdateRunProvisioningStateSucceeded), + // Status: &armcontainerservicefleet.UpdateRunStatus{ + // Status: &armcontainerservicefleet.UpdateStatus{ + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.768Z"); return t}()), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.768Z"); return t}()), + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // Error: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("ezwocfahsfmbddlqgloysjkthkn"), + // Message: to.Ptr("udtnrxlgadzqlogclb"), + // Target: to.Ptr("l"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("fzgprz"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, // }, - // WaitDurationInSeconds: to.Ptr[int32](3600), // }, - // Groups: []*armcontainerservicefleet.UpdateGroupStatus{ - // { - // Name: to.Ptr("group-a"), - // Members: []*armcontainerservicefleet.MemberUpdateStatus{ - // { - // Name: to.Ptr("member-one"), - // ClusterResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myClusters/providers/Microsoft.ContainerService/managedClusters/myCluster-1"), - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateSkipped), + // }, + // Stages: []*armcontainerservicefleet.UpdateStageStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // Error: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("ezwocfahsfmbddlqgloysjkthkn"), + // Message: to.Ptr("udtnrxlgadzqlogclb"), + // Target: to.Ptr("l"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("fzgprz"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // State: to.Ptr(armcontainerservicefleet.UpdateStateSkipped), + // }, // }, // }, - // { - // Name: to.Ptr("group-b"), - // Members: []*armcontainerservicefleet.MemberUpdateStatus{ - // { - // Name: to.Ptr("member-two"), - // ClusterResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myClusters/providers/Microsoft.ContainerService/managedClusters/myCluster-2"), - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateRunning), + // Name: to.Ptr("stage1"), + // Groups: []*armcontainerservicefleet.UpdateGroupStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // Error: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("ezwocfahsfmbddlqgloysjkthkn"), + // Message: to.Ptr("udtnrxlgadzqlogclb"), + // Target: to.Ptr("l"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("fzgprz"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // }, + // Name: to.Ptr("group-a"), + // Members: []*armcontainerservicefleet.MemberUpdateStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // Error: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("ezwocfahsfmbddlqgloysjkthkn"), + // Message: to.Ptr("udtnrxlgadzqlogclb"), + // Target: to.Ptr("l"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("fzgprz"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // }, + // Name: to.Ptr("member-one"), + // ClusterResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myClusters/providers/Microsoft.ContainerService/managedClusters/myCluster"), + // OperationID: to.Ptr("islvvdetacuskjzmkcxc"), + // Message: to.Ptr("xrvhotarzemcgeen"), // }, - // }}, + // }, + // }, + // }, + // AfterStageWaitStatus: &armcontainerservicefleet.WaitStatus{ // Status: &armcontainerservicefleet.UpdateStatus{ - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // State: to.Ptr(armcontainerservicefleet.UpdateStateRunning), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // State: to.Ptr(armcontainerservicefleet.UpdateStateRunning), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // State: to.Ptr(armcontainerservicefleet.UpdateStateRunning), - // }, - // }, - // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ - // Stages: []*armcontainerservicefleet.UpdateStage{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitInSeconds: to.Ptr[int32](3600), - // Groups: []*armcontainerservicefleet.UpdateGroup{ - // { - // Name: to.Ptr("group-a"), + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // Error: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("ezwocfahsfmbddlqgloysjkthkn"), + // Message: to.Ptr("udtnrxlgadzqlogclb"), + // Target: to.Ptr("l"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("fzgprz"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // }, + // WaitDurationInSeconds: to.Ptr[int32](3600), // }, + // }, + // }, + // NodeImageSelection: &armcontainerservicefleet.NodeImageSelectionStatus{ + // SelectedNodeImageVersions: []*armcontainerservicefleet.NodeImageVersion{ // { - // Name: to.Ptr("group-b"), - // }}, - // }}, + // Version: to.Ptr("wkcmcqhecdbsoskkny"), + // }, + // }, + // }, + // }, + // AutoUpgradeProfileID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.ContainerService/fleets/fleet1/autoUpgradeProfiles/aup1"), + // }, + // ETag: to.Ptr("\"EtagValue\""), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateRuns/run1"), + // Name: to.Ptr("run1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/updateRuns"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("someUser"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // LastModifiedBy: to.Ptr("someOtherUser"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/UpdateRuns_Start.json -func ExampleUpdateRunsClient_BeginStart() { +// Generated from example definition: 2025-03-01/UpdateRuns_Stop.json +func ExampleUpdateRunsClient_BeginStop_stopsAnUpdateRun() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewUpdateRunsClient().BeginStart(ctx, "rg1", "fleet1", "run1", &armcontainerservicefleet.UpdateRunsClientBeginStartOptions{IfMatch: nil}) + poller, err := clientFactory.NewUpdateRunsClient().BeginStop(ctx, "rg1", "fleet1", "run1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -495,93 +1696,101 @@ func ExampleUpdateRunsClient_BeginStart() { // 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.UpdateRun = armcontainerservicefleet.UpdateRun{ - // Name: to.Ptr("run1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets/updateRuns"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateRuns/run1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:09:08.395Z"); return t}()), - // CreatedBy: to.Ptr("@contoso.com"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // LastModifiedBy: to.Ptr("@contoso.com"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // ETag: to.Ptr("\"EtagValue\""), - // Properties: &armcontainerservicefleet.UpdateRunProperties{ - // ManagedClusterUpdate: &armcontainerservicefleet.ManagedClusterUpdate{ - // NodeImageSelection: &armcontainerservicefleet.NodeImageSelection{ - // Type: to.Ptr(armcontainerservicefleet.NodeImageSelectionTypeLatest), + // res = armcontainerservicefleet.UpdateRunsClientStopResponse{ + // UpdateRun: &armcontainerservicefleet.UpdateRun{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateRuns/run1"), + // Name: to.Ptr("run1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/updateRuns"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("@contoso.com"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:09:08.395Z"); return t}()), + // LastModifiedBy: to.Ptr("@contoso.com"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // }, + // Properties: &armcontainerservicefleet.UpdateRunProperties{ + // ProvisioningState: to.Ptr(armcontainerservicefleet.UpdateRunProvisioningStateSucceeded), + // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ + // Stages: []*armcontainerservicefleet.UpdateStage{ + // { + // Name: to.Ptr("stage1"), + // Groups: []*armcontainerservicefleet.UpdateGroup{ + // { + // Name: to.Ptr("group-a"), + // }, + // }, + // AfterStageWaitInSeconds: to.Ptr[int32](3600), + // }, + // }, // }, - // Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ - // Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), - // KubernetesVersion: to.Ptr("1.26.1"), + // ManagedClusterUpdate: &armcontainerservicefleet.ManagedClusterUpdate{ + // Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ + // Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), + // KubernetesVersion: to.Ptr("1.26.1"), + // }, + // NodeImageSelection: &armcontainerservicefleet.NodeImageSelection{ + // Type: to.Ptr(armcontainerservicefleet.NodeImageSelectionTypeLatest), + // }, // }, - // }, - // ProvisioningState: to.Ptr(armcontainerservicefleet.UpdateRunProvisioningStateSucceeded), - // Status: &armcontainerservicefleet.UpdateRunStatus{ - // Stages: []*armcontainerservicefleet.UpdateStageStatus{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitStatus: &armcontainerservicefleet.WaitStatus{ + // Status: &armcontainerservicefleet.UpdateRunStatus{ + // Status: &armcontainerservicefleet.UpdateStatus{ + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // State: to.Ptr(armcontainerservicefleet.UpdateStateStopping), + // }, + // Stages: []*armcontainerservicefleet.UpdateStageStatus{ + // { // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // State: to.Ptr(armcontainerservicefleet.UpdateStateStopping), // }, - // WaitDurationInSeconds: to.Ptr[int32](3600), - // }, - // Groups: []*armcontainerservicefleet.UpdateGroupStatus{ - // { - // Name: to.Ptr("group-a"), - // Members: []*armcontainerservicefleet.MemberUpdateStatus{ - // { - // Name: to.Ptr("member-one"), - // ClusterResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myClusters/providers/Microsoft.ContainerService/managedClusters/myCluster"), - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateRunning), + // Name: to.Ptr("stage1"), + // Groups: []*armcontainerservicefleet.UpdateGroupStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), + // State: to.Ptr(armcontainerservicefleet.UpdateStateStopping), + // }, + // Name: to.Ptr("group-a"), + // Members: []*armcontainerservicefleet.MemberUpdateStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateStopping), + // }, + // Name: to.Ptr("member-one"), + // ClusterResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myClusters/providers/Microsoft.ContainerService/managedClusters/myCluster"), // }, - // }}, + // }, + // }, + // }, + // AfterStageWaitStatus: &armcontainerservicefleet.WaitStatus{ // Status: &armcontainerservicefleet.UpdateStatus{ - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // State: to.Ptr(armcontainerservicefleet.UpdateStateRunning), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // State: to.Ptr(armcontainerservicefleet.UpdateStateRunning), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // State: to.Ptr(armcontainerservicefleet.UpdateStateRunning), + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // }, + // WaitDurationInSeconds: to.Ptr[int32](3600), + // }, + // }, + // }, // }, // }, - // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ - // Stages: []*armcontainerservicefleet.UpdateStage{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitInSeconds: to.Ptr[int32](3600), - // Groups: []*armcontainerservicefleet.UpdateGroup{ - // { - // Name: to.Ptr("group-a"), - // }}, - // }}, - // }, + // ETag: to.Ptr("\"EtagValue\""), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/ad60d7f8eba124edc6999677c55aba2184e303b0/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/UpdateRuns_Stop.json -func ExampleUpdateRunsClient_BeginStop() { +// Generated from example definition: 2025-03-01/UpdateRuns_Stop_MaximumSet_Gen.json +func ExampleUpdateRunsClient_BeginStop_stopsAnUpdateRunGeneratedByMaximumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcontainerservicefleet.NewClientFactory("", cred, nil) + clientFactory, err := armcontainerservicefleet.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewUpdateRunsClient().BeginStop(ctx, "rg1", "fleet1", "run1", &armcontainerservicefleet.UpdateRunsClientBeginStopOptions{IfMatch: nil}) + poller, err := clientFactory.NewUpdateRunsClient().BeginStop(ctx, "rgfleets", "fleet1", "fleet1", &UpdateRunsClientBeginStopOptions{ + ifMatch: to.Ptr("jb")}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -592,76 +1801,176 @@ func ExampleUpdateRunsClient_BeginStop() { // 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.UpdateRun = armcontainerservicefleet.UpdateRun{ - // Name: to.Ptr("run1"), - // Type: to.Ptr("Microsoft.ContainerService/fleets/updateRuns"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateRuns/run1"), - // SystemData: &armcontainerservicefleet.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:09:08.395Z"); return t}()), - // CreatedBy: to.Ptr("@contoso.com"), - // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // LastModifiedBy: to.Ptr("@contoso.com"), - // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), - // }, - // ETag: to.Ptr("\"EtagValue\""), - // Properties: &armcontainerservicefleet.UpdateRunProperties{ - // ManagedClusterUpdate: &armcontainerservicefleet.ManagedClusterUpdate{ - // NodeImageSelection: &armcontainerservicefleet.NodeImageSelection{ - // Type: to.Ptr(armcontainerservicefleet.NodeImageSelectionTypeLatest), + // res = armcontainerservicefleet.UpdateRunsClientStopResponse{ + // UpdateRun: &armcontainerservicefleet.UpdateRun{ + // Properties: &armcontainerservicefleet.UpdateRunProperties{ + // UpdateStrategyID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateStrategies/strategy1"), + // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ + // Stages: []*armcontainerservicefleet.UpdateStage{ + // { + // Name: to.Ptr("stage1"), + // Groups: []*armcontainerservicefleet.UpdateGroup{ + // { + // Name: to.Ptr("group-a"), + // }, + // }, + // AfterStageWaitInSeconds: to.Ptr[int32](3600), + // }, + // }, // }, - // Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ - // Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), - // KubernetesVersion: to.Ptr("1.26.1"), + // ManagedClusterUpdate: &armcontainerservicefleet.ManagedClusterUpdate{ + // Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ + // Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), + // KubernetesVersion: to.Ptr("1.26.1"), + // }, + // NodeImageSelection: &armcontainerservicefleet.NodeImageSelection{ + // Type: to.Ptr(armcontainerservicefleet.NodeImageSelectionTypeLatest), + // CustomNodeImageVersions: []*armcontainerservicefleet.NodeImageVersion{ + // { + // Version: to.Ptr("wkcmcqhecdbsoskkny"), + // }, + // }, + // }, // }, - // }, - // ProvisioningState: to.Ptr(armcontainerservicefleet.UpdateRunProvisioningStateSucceeded), - // Status: &armcontainerservicefleet.UpdateRunStatus{ - // Stages: []*armcontainerservicefleet.UpdateStageStatus{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitStatus: &armcontainerservicefleet.WaitStatus{ + // ProvisioningState: to.Ptr(armcontainerservicefleet.UpdateRunProvisioningStateSucceeded), + // Status: &armcontainerservicefleet.UpdateRunStatus{ + // Status: &armcontainerservicefleet.UpdateStatus{ + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.768Z"); return t}()), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.768Z"); return t}()), + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // Error: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("ezwocfahsfmbddlqgloysjkthkn"), + // Message: to.Ptr("udtnrxlgadzqlogclb"), + // Target: to.Ptr("l"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("fzgprz"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // }, + // Stages: []*armcontainerservicefleet.UpdateStageStatus{ + // { // Status: &armcontainerservicefleet.UpdateStatus{ // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // Error: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("ezwocfahsfmbddlqgloysjkthkn"), + // Message: to.Ptr("udtnrxlgadzqlogclb"), + // Target: to.Ptr("l"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("fzgprz"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, // }, - // WaitDurationInSeconds: to.Ptr[int32](3600), - // }, - // Groups: []*armcontainerservicefleet.UpdateGroupStatus{ - // { - // Name: to.Ptr("group-a"), - // Members: []*armcontainerservicefleet.MemberUpdateStatus{ - // { - // Name: to.Ptr("member-one"), - // ClusterResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myClusters/providers/Microsoft.ContainerService/managedClusters/myCluster"), - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateStopping), + // Name: to.Ptr("stage1"), + // Groups: []*armcontainerservicefleet.UpdateGroupStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // Error: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("ezwocfahsfmbddlqgloysjkthkn"), + // Message: to.Ptr("udtnrxlgadzqlogclb"), + // Target: to.Ptr("l"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("fzgprz"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // }, + // Name: to.Ptr("group-a"), + // Members: []*armcontainerservicefleet.MemberUpdateStatus{ + // { + // Status: &armcontainerservicefleet.UpdateStatus{ + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // Error: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("ezwocfahsfmbddlqgloysjkthkn"), + // Message: to.Ptr("udtnrxlgadzqlogclb"), + // Target: to.Ptr("l"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("fzgprz"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // }, + // Name: to.Ptr("member-one"), + // ClusterResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myClusters/providers/Microsoft.ContainerService/managedClusters/myCluster"), + // OperationID: to.Ptr("islvvdetacuskjzmkcxc"), + // Message: to.Ptr("xrvhotarzemcgeen"), // }, - // }}, + // }, + // }, + // }, + // AfterStageWaitStatus: &armcontainerservicefleet.WaitStatus{ // Status: &armcontainerservicefleet.UpdateStatus{ - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // State: to.Ptr(armcontainerservicefleet.UpdateStateStopping), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // State: to.Ptr(armcontainerservicefleet.UpdateStateStopping), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-03-01T01:10:08.395Z"); return t}()), - // State: to.Ptr(armcontainerservicefleet.UpdateStateStopping), + // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // CompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-02-14T23:29:32.767Z"); return t}()), + // Error: &armcontainerservicefleet.ErrorDetail{ + // Code: to.Ptr("ezwocfahsfmbddlqgloysjkthkn"), + // Message: to.Ptr("udtnrxlgadzqlogclb"), + // Target: to.Ptr("l"), + // Details: []*armcontainerservicefleet.ErrorDetail{ + // }, + // AdditionalInfo: []*armcontainerservicefleet.ErrorAdditionalInfo{ + // { + // Type: to.Ptr("fzgprz"), + // Info: &armcontainerservicefleet.ErrorAdditionalInfoInfo{ + // }, + // }, + // }, + // }, + // }, + // WaitDurationInSeconds: to.Ptr[int32](3600), + // }, + // }, + // }, + // NodeImageSelection: &armcontainerservicefleet.NodeImageSelectionStatus{ + // SelectedNodeImageVersions: []*armcontainerservicefleet.NodeImageVersion{ + // { + // Version: to.Ptr("wkcmcqhecdbsoskkny"), + // }, + // }, + // }, // }, + // AutoUpgradeProfileID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rgfleets/providers/Microsoft.ContainerService/fleets/fleet1/autoUpgradeProfiles/aup1"), // }, - // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ - // Stages: []*armcontainerservicefleet.UpdateStage{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitInSeconds: to.Ptr[int32](3600), - // Groups: []*armcontainerservicefleet.UpdateGroup{ - // { - // Name: to.Ptr("group-a"), - // }}, - // }}, + // ETag: to.Ptr("\"EtagValue\""), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateRuns/run1"), + // Name: to.Ptr("run1"), + // Type: to.Ptr("Microsoft.ContainerService/fleets/updateRuns"), + // SystemData: &armcontainerservicefleet.SystemData{ + // CreatedBy: to.Ptr("someUser"), + // CreatedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), + // LastModifiedBy: to.Ptr("someOtherUser"), + // LastModifiedByType: to.Ptr(armcontainerservicefleet.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-23T05:40:40.657Z"); return t}()), // }, // }, // }