diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/CHANGELOG.md b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/CHANGELOG.md index 25f9336c7764..0956939f08c5 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/CHANGELOG.md +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/CHANGELOG.md @@ -1,5 +1,42 @@ # Release History +## 0.2.0 (2023-08-31) +### Breaking Changes + +- Operation `*FleetMembersClient.Update` has been changed to LRO, use `*FleetMembersClient.BeginUpdate` instead. +- Operation `*FleetsClient.Update` has been changed to LRO, use `*FleetsClient.BeginUpdate` instead. + +### Features Added + +- New value `UpdateStateSkipped` added to enum type `UpdateState` +- New enum type `FleetUpdateStrategyProvisioningState` with values `FleetUpdateStrategyProvisioningStateCanceled`, `FleetUpdateStrategyProvisioningStateFailed`, `FleetUpdateStrategyProvisioningStateSucceeded` +- New enum type `ManagedServiceIdentityType` with values `ManagedServiceIdentityTypeNone`, `ManagedServiceIdentityTypeSystemAssigned`, `ManagedServiceIdentityTypeSystemAssignedUserAssigned`, `ManagedServiceIdentityTypeUserAssigned` +- New enum type `NodeImageSelectionType` with values `NodeImageSelectionTypeConsistent`, `NodeImageSelectionTypeLatest` +- New function `*ClientFactory.NewFleetUpdateStrategiesClient() *FleetUpdateStrategiesClient` +- New function `NewFleetUpdateStrategiesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*FleetUpdateStrategiesClient, error)` +- New function `*FleetUpdateStrategiesClient.BeginCreateOrUpdate(context.Context, string, string, string, FleetUpdateStrategy, *FleetUpdateStrategiesClientBeginCreateOrUpdateOptions) (*runtime.Poller[FleetUpdateStrategiesClientCreateOrUpdateResponse], error)` +- New function `*FleetUpdateStrategiesClient.BeginDelete(context.Context, string, string, string, *FleetUpdateStrategiesClientBeginDeleteOptions) (*runtime.Poller[FleetUpdateStrategiesClientDeleteResponse], error)` +- New function `*FleetUpdateStrategiesClient.Get(context.Context, string, string, string, *FleetUpdateStrategiesClientGetOptions) (FleetUpdateStrategiesClientGetResponse, error)` +- New function `*FleetUpdateStrategiesClient.NewListByFleetPager(string, string, *FleetUpdateStrategiesClientListByFleetOptions) *runtime.Pager[FleetUpdateStrategiesClientListByFleetResponse]` +- New struct `APIServerAccessProfile` +- New struct `AgentProfile` +- New struct `FleetUpdateStrategy` +- New struct `FleetUpdateStrategyListResult` +- New struct `FleetUpdateStrategyProperties` +- New struct `ManagedServiceIdentity` +- New struct `NodeImageSelection` +- New struct `NodeImageSelectionStatus` +- New struct `NodeImageVersion` +- New struct `UserAssignedIdentity` +- New field `Identity` in struct `Fleet` +- New field `APIServerAccessProfile`, `AgentProfile` in struct `FleetHubProfile` +- New field `Identity` in struct `FleetPatch` +- New field `NodeImageSelection` in struct `ManagedClusterUpdate` +- New field `Message` in struct `MemberUpdateStatus` +- New field `UpdateStrategyID` in struct `UpdateRunProperties` +- New field `NodeImageSelection` in struct `UpdateRunStatus` + + ## 0.1.0 (2023-06-23) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/autorest.md b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/autorest.md index 7469d1e1e6fc..495564594639 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/autorest.md +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/de14cb8751b978b1877597b13292818e80f8c661/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/de14cb8751b978b1877597b13292818e80f8c661/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 -tag: package-2023-03-preview +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/client_factory.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/client_factory.go index 477ac8452175..be16bcbb2c10 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/client_factory.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/client_factory.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcontainerservicefleet @@ -38,8 +37,13 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, }, nil } -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) +func (c *ClientFactory) NewFleetMembersClient() *FleetMembersClient { + subClient, _ := NewFleetMembersClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +func (c *ClientFactory) NewFleetUpdateStrategiesClient() *FleetUpdateStrategiesClient { + subClient, _ := NewFleetUpdateStrategiesClient(c.subscriptionID, c.credential, c.options) return subClient } @@ -48,8 +52,8 @@ func (c *ClientFactory) NewFleetsClient() *FleetsClient { return subClient } -func (c *ClientFactory) NewFleetMembersClient() *FleetMembersClient { - subClient, _ := NewFleetMembersClient(c.subscriptionID, c.credential, c.options) +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/constants.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/constants.go index 18346c90dc7d..22b7a938549e 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/constants.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/constants.go @@ -3,15 +3,14 @@ // 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. +// 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. -// DO NOT EDIT. package armcontainerservicefleet const ( moduleName = "armcontainerservicefleet" - moduleVersion = "v0.1.0" + moduleVersion = "v0.2.0" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -55,12 +54,15 @@ const ( // FleetMemberProvisioningStateCanceled - Resource creation was canceled. FleetMemberProvisioningStateCanceled FleetMemberProvisioningState = "Canceled" // FleetMemberProvisioningStateFailed - Resource creation failed. - FleetMemberProvisioningStateFailed FleetMemberProvisioningState = "Failed" + FleetMemberProvisioningStateFailed FleetMemberProvisioningState = "Failed" + // FleetMemberProvisioningStateJoining - The provisioning state of a member joining a fleet. FleetMemberProvisioningStateJoining FleetMemberProvisioningState = "Joining" + // FleetMemberProvisioningStateLeaving - The provisioning state of a member leaving a fleet. FleetMemberProvisioningStateLeaving FleetMemberProvisioningState = "Leaving" // FleetMemberProvisioningStateSucceeded - Resource has been created. FleetMemberProvisioningStateSucceeded FleetMemberProvisioningState = "Succeeded" - FleetMemberProvisioningStateUpdating FleetMemberProvisioningState = "Updating" + // FleetMemberProvisioningStateUpdating - The provisioning state of a member being updated. + FleetMemberProvisioningStateUpdating FleetMemberProvisioningState = "Updating" ) // PossibleFleetMemberProvisioningStateValues returns the possible values for the FleetMemberProvisioningState const type. @@ -81,13 +83,16 @@ type FleetProvisioningState string const ( // FleetProvisioningStateCanceled - Resource creation was canceled. FleetProvisioningStateCanceled FleetProvisioningState = "Canceled" + // FleetProvisioningStateCreating - The provisioning state of a fleet being created. FleetProvisioningStateCreating FleetProvisioningState = "Creating" + // FleetProvisioningStateDeleting - The provisioning state of a fleet being deleted. FleetProvisioningStateDeleting FleetProvisioningState = "Deleting" // FleetProvisioningStateFailed - Resource creation failed. FleetProvisioningStateFailed FleetProvisioningState = "Failed" // FleetProvisioningStateSucceeded - Resource has been created. FleetProvisioningStateSucceeded FleetProvisioningState = "Succeeded" - FleetProvisioningStateUpdating FleetProvisioningState = "Updating" + // FleetProvisioningStateUpdating - The provisioning state of a fleet being updated. + FleetProvisioningStateUpdating FleetProvisioningState = "Updating" ) // PossibleFleetProvisioningStateValues returns the possible values for the FleetProvisioningState const type. @@ -102,6 +107,27 @@ func PossibleFleetProvisioningStateValues() []FleetProvisioningState { } } +// FleetUpdateStrategyProvisioningState - The provisioning state of the UpdateStrategy resource. +type FleetUpdateStrategyProvisioningState string + +const ( + // FleetUpdateStrategyProvisioningStateCanceled - Resource creation was canceled. + FleetUpdateStrategyProvisioningStateCanceled FleetUpdateStrategyProvisioningState = "Canceled" + // FleetUpdateStrategyProvisioningStateFailed - Resource creation failed. + FleetUpdateStrategyProvisioningStateFailed FleetUpdateStrategyProvisioningState = "Failed" + // FleetUpdateStrategyProvisioningStateSucceeded - Resource has been created. + FleetUpdateStrategyProvisioningStateSucceeded FleetUpdateStrategyProvisioningState = "Succeeded" +) + +// PossibleFleetUpdateStrategyProvisioningStateValues returns the possible values for the FleetUpdateStrategyProvisioningState const type. +func PossibleFleetUpdateStrategyProvisioningStateValues() []FleetUpdateStrategyProvisioningState { + return []FleetUpdateStrategyProvisioningState{ + FleetUpdateStrategyProvisioningStateCanceled, + FleetUpdateStrategyProvisioningStateFailed, + FleetUpdateStrategyProvisioningStateSucceeded, + } +} + // ManagedClusterUpgradeType - The type of upgrade to perform when targeting ManagedClusters. type ManagedClusterUpgradeType string @@ -120,6 +146,51 @@ func PossibleManagedClusterUpgradeTypeValues() []ManagedClusterUpgradeType { } } +// ManagedServiceIdentityType - Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). +type ManagedServiceIdentityType string + +const ( + ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" + ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned, UserAssigned" + ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" +) + +// PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type. +func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { + return []ManagedServiceIdentityType{ + ManagedServiceIdentityTypeNone, + ManagedServiceIdentityTypeSystemAssigned, + ManagedServiceIdentityTypeSystemAssignedUserAssigned, + ManagedServiceIdentityTypeUserAssigned, + } +} + +// NodeImageSelectionType - The node image upgrade type. +type NodeImageSelectionType string + +const ( + // NodeImageSelectionTypeConsistent - The image versions to upgrade nodes to are selected as described below: for each node + // pool in managed clusters affected by the update run, the system selects the latest image version such that it is available + // across all other node pools (in all other clusters) of the same image type. As a result, all node pools of the same image + // type will be upgraded to the same image version. For example, if the latest image version for image type 'AKSUbuntu-1804gen2containerd' + // is 'AKSUbuntu-1804gen2containerd-2021.10.12' for a node pool in cluster A in region X, and is 'AKSUbuntu-1804gen2containerd-2021.10.17' + // for a node pool in cluster B in region Y, the system will upgrade both node pools to image version 'AKSUbuntu-1804gen2containerd-2021.10.12'. + NodeImageSelectionTypeConsistent NodeImageSelectionType = "Consistent" + // NodeImageSelectionTypeLatest - Use the latest image version when upgrading nodes. Clusters may use different image versions + // (e.g., 'AKSUbuntu-1804gen2containerd-2021.10.12' and 'AKSUbuntu-1804gen2containerd-2021.10.19') because, for example, the + // latest available version is different in different regions. + NodeImageSelectionTypeLatest NodeImageSelectionType = "Latest" +) + +// PossibleNodeImageSelectionTypeValues returns the possible values for the NodeImageSelectionType const type. +func PossibleNodeImageSelectionTypeValues() []NodeImageSelectionType { + return []NodeImageSelectionType{ + NodeImageSelectionTypeConsistent, + NodeImageSelectionTypeLatest, + } +} + // Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default // value is "user,system" type Origin string @@ -164,12 +235,20 @@ func PossibleUpdateRunProvisioningStateValues() []UpdateRunProvisioningState { type UpdateState string const ( - UpdateStateCompleted UpdateState = "Completed" - UpdateStateFailed UpdateState = "Failed" + // UpdateStateCompleted - The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has completed. + UpdateStateCompleted UpdateState = "Completed" + // UpdateStateFailed - The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has failed. + UpdateStateFailed UpdateState = "Failed" + // UpdateStateNotStarted - The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has not been started. UpdateStateNotStarted UpdateState = "NotStarted" - UpdateStateRunning UpdateState = "Running" - UpdateStateStopped UpdateState = "Stopped" - UpdateStateStopping UpdateState = "Stopping" + // UpdateStateRunning - The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that is running. + UpdateStateRunning UpdateState = "Running" + // UpdateStateSkipped - The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has been skipped. + UpdateStateSkipped UpdateState = "Skipped" + // UpdateStateStopped - The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has stopped. + UpdateStateStopped UpdateState = "Stopped" + // UpdateStateStopping - The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that is being stopped. + UpdateStateStopping UpdateState = "Stopping" ) // PossibleUpdateStateValues returns the possible values for the UpdateState const type. @@ -179,6 +258,7 @@ func PossibleUpdateStateValues() []UpdateState { UpdateStateFailed, UpdateStateNotStarted, UpdateStateRunning, + UpdateStateSkipped, UpdateStateStopped, UpdateStateStopping, } diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetmembers_client.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetmembers_client.go index 38faa05f1b95..61f9872cf07c 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetmembers_client.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetmembers_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcontainerservicefleet @@ -47,7 +46,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 2023-03-15-preview +// Generated from API version 2023-08-15-preview // - 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. @@ -60,9 +59,10 @@ func (client *FleetMembersClient) BeginCreate(ctx context.Context, resourceGroup if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetMembersClientCreateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetMembersClientCreateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[FleetMembersClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -71,20 +71,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-08-15-preview func (client *FleetMembersClient) create(ctx context.Context, resourceGroupName string, fleetName string, fleetMemberName string, resource FleetMember, options *FleetMembersClientBeginCreateOptions) (*http.Response, error) { + var err error req, err := client.createCreateRequest(ctx, resourceGroupName, fleetName, fleetMemberName, resource, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createCreateRequest creates the Create request. @@ -111,7 +113,7 @@ func (client *FleetMembersClient) createCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-08-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -120,13 +122,16 @@ func (client *FleetMembersClient) createCreateRequest(ctx context.Context, resou req.Raw().Header["If-None-Match"] = []string{*options.IfNoneMatch} } req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, resource) + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete a FleetMember // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-08-15-preview // - 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. @@ -138,9 +143,10 @@ func (client *FleetMembersClient) BeginDelete(ctx context.Context, resourceGroup if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetMembersClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetMembersClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[FleetMembersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -149,20 +155,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-08-15-preview func (client *FleetMembersClient) deleteOperation(ctx context.Context, resourceGroupName string, fleetName string, fleetMemberName string, options *FleetMembersClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, fleetName, fleetMemberName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -189,7 +197,7 @@ func (client *FleetMembersClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-08-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -201,24 +209,27 @@ 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 2023-03-15-preview +// Generated from API version 2023-08-15-preview // - 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. // - options - FleetMembersClientGetOptions contains the optional parameters for the FleetMembersClient.Get method. func (client *FleetMembersClient) Get(ctx context.Context, resourceGroupName string, fleetName string, fleetMemberName string, options *FleetMembersClientGetOptions) (FleetMembersClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, fleetName, fleetMemberName, options) if err != nil { return FleetMembersClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FleetMembersClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FleetMembersClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FleetMembersClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -245,7 +256,7 @@ func (client *FleetMembersClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-08-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -262,7 +273,7 @@ func (client *FleetMembersClient) getHandleResponse(resp *http.Response) (FleetM // NewListByFleetPager - List FleetMember resources by Fleet // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-08-15-preview // - 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 @@ -315,7 +326,7 @@ func (client *FleetMembersClient) listByFleetCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-08-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -330,32 +341,54 @@ func (client *FleetMembersClient) listByFleetHandleResponse(resp *http.Response) return result, nil } -// Update - Update a FleetMember +// BeginUpdate - Update a FleetMember // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-08-15-preview // - 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 - FleetMembersClientUpdateOptions contains the optional parameters for the FleetMembersClient.Update method. -func (client *FleetMembersClient) Update(ctx context.Context, resourceGroupName string, fleetName string, fleetMemberName string, properties FleetMemberUpdate, options *FleetMembersClientUpdateOptions) (FleetMembersClientUpdateResponse, error) { +// - options - FleetMembersClientBeginUpdateOptions contains the optional parameters for the FleetMembersClient.BeginUpdate +// method. +func (client *FleetMembersClient) BeginUpdate(ctx context.Context, resourceGroupName string, fleetName string, fleetMemberName string, properties FleetMemberUpdate, options *FleetMembersClientBeginUpdateOptions) (*runtime.Poller[FleetMembersClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(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.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[FleetMembersClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Update - Update a FleetMember +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-15-preview +func (client *FleetMembersClient) update(ctx context.Context, resourceGroupName string, fleetName string, fleetMemberName string, properties FleetMemberUpdate, options *FleetMembersClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, fleetName, fleetMemberName, properties, options) if err != nil { - return FleetMembersClientUpdateResponse{}, err + return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return FleetMembersClientUpdateResponse{}, err + return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FleetMembersClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return client.updateHandleResponse(resp) + return httpResp, nil } // updateCreateRequest creates the Update request. -func (client *FleetMembersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetMemberName string, properties FleetMemberUpdate, options *FleetMembersClientUpdateOptions) (*policy.Request, error) { +func (client *FleetMembersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetMemberName string, properties FleetMemberUpdate, options *FleetMembersClientBeginUpdateOptions) (*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") @@ -378,20 +411,14 @@ func (client *FleetMembersClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-08-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} } req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, properties) -} - -// updateHandleResponse handles the Update response. -func (client *FleetMembersClient) updateHandleResponse(resp *http.Response) (FleetMembersClientUpdateResponse, error) { - result := FleetMembersClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.FleetMember); err != nil { - return FleetMembersClientUpdateResponse{}, err + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err } - return result, nil + return req, nil } diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetmembers_client_example_test.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetmembers_client_example_test.go deleted file mode 100644 index 599314403991..000000000000 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetmembers_client_example_test.go +++ /dev/null @@ -1,215 +0,0 @@ -//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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/de14cb8751b978b1877597b13292818e80f8c661/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/FleetMembers_ListByFleet.json -func ExampleFleetMembersClient_NewListByFleetPager() { - 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.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), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/de14cb8751b978b1877597b13292818e80f8c661/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/FleetMembers_Get.json -func ExampleFleetMembersClient_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) - 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.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), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/de14cb8751b978b1877597b13292818e80f8c661/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/FleetMembers_Create.json -func ExampleFleetMembersClient_BeginCreate() { - 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) - } - 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, - }) - 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("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: https://github.com/Azure/azure-rest-api-specs/blob/de14cb8751b978b1877597b13292818e80f8c661/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/FleetMembers_Update.json -func ExampleFleetMembersClient_Update() { - 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.NewFleetMembersClient().Update(ctx, "rg1", "fleet1", "member-1", armcontainerservicefleet.FleetMemberUpdate{ - Properties: &armcontainerservicefleet.FleetMemberUpdateProperties{ - Group: to.Ptr("staging"), - }, - }, &armcontainerservicefleet.FleetMembersClientUpdateOptions{IfMatch: 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.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), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/de14cb8751b978b1877597b13292818e80f8c661/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/FleetMembers_Delete.json -func ExampleFleetMembersClient_BeginDelete() { - 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) - } - poller, err := clientFactory.NewFleetMembersClient().BeginDelete(ctx, "rg1", "fleet1", "member-1", &armcontainerservicefleet.FleetMembersClientBeginDeleteOptions{IfMatch: nil}) - 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) - } -} diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleets_client.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleets_client.go index 0da291ce353b..2a544ad06ca6 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleets_client.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleets_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcontainerservicefleet @@ -47,7 +46,7 @@ func NewFleetsClient(subscriptionID string, credential azcore.TokenCredential, o // BeginCreateOrUpdate - Creates or updates a Fleet. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-08-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fleetName - The name of the Fleet resource. // - resource - Resource create parameters. @@ -59,9 +58,10 @@ func (client *FleetsClient) BeginCreateOrUpdate(ctx context.Context, resourceGro if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetsClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetsClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[FleetsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -70,20 +70,22 @@ func (client *FleetsClient) BeginCreateOrUpdate(ctx context.Context, resourceGro // CreateOrUpdate - Creates or updates a Fleet. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-08-15-preview func (client *FleetsClient) createOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, resource Fleet, options *FleetsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, fleetName, resource, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -106,7 +108,7 @@ func (client *FleetsClient) createOrUpdateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-08-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -115,13 +117,16 @@ func (client *FleetsClient) createOrUpdateCreateRequest(ctx context.Context, res req.Raw().Header["If-None-Match"] = []string{*options.IfNoneMatch} } req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, resource) + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete a Fleet // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-08-15-preview // - 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. @@ -131,9 +136,10 @@ func (client *FleetsClient) BeginDelete(ctx context.Context, resourceGroupName s if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetsClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[FleetsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -142,20 +148,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-08-15-preview func (client *FleetsClient) deleteOperation(ctx context.Context, resourceGroupName string, fleetName string, options *FleetsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, fleetName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -178,7 +186,7 @@ func (client *FleetsClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-08-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -190,23 +198,26 @@ 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 2023-03-15-preview +// Generated from API version 2023-08-15-preview // - 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. func (client *FleetsClient) Get(ctx context.Context, resourceGroupName string, fleetName string, options *FleetsClientGetOptions) (FleetsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, fleetName, options) if err != nil { return FleetsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FleetsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FleetsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FleetsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -229,7 +240,7 @@ func (client *FleetsClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-08-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -246,7 +257,7 @@ func (client *FleetsClient) getHandleResponse(resp *http.Response) (FleetsClient // NewListByResourceGroupPager - Lists fleets in the specified subscription and resource group. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-08-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - FleetsClientListByResourceGroupOptions contains the optional parameters for the FleetsClient.NewListByResourceGroupPager // method. @@ -294,7 +305,7 @@ func (client *FleetsClient) listByResourceGroupCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-08-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -311,7 +322,7 @@ func (client *FleetsClient) listByResourceGroupHandleResponse(resp *http.Respons // NewListBySubscriptionPager - Lists fleets in the specified subscription. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-08-15-preview // - options - FleetsClientListBySubscriptionOptions contains the optional parameters for the FleetsClient.NewListBySubscriptionPager // method. func (client *FleetsClient) NewListBySubscriptionPager(options *FleetsClientListBySubscriptionOptions) *runtime.Pager[FleetsClientListBySubscriptionResponse] { @@ -354,7 +365,7 @@ func (client *FleetsClient) listBySubscriptionCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-08-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -372,23 +383,26 @@ 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 2023-03-15-preview +// Generated from API version 2023-08-15-preview // - 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. func (client *FleetsClient) ListCredentials(ctx context.Context, resourceGroupName string, fleetName string, options *FleetsClientListCredentialsOptions) (FleetsClientListCredentialsResponse, error) { + var err error req, err := client.listCredentialsCreateRequest(ctx, resourceGroupName, fleetName, options) if err != nil { return FleetsClientListCredentialsResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return FleetsClientListCredentialsResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FleetsClientListCredentialsResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FleetsClientListCredentialsResponse{}, err } - return client.listCredentialsHandleResponse(resp) + resp, err := client.listCredentialsHandleResponse(httpResp) + return resp, err } // listCredentialsCreateRequest creates the ListCredentials request. @@ -411,7 +425,7 @@ func (client *FleetsClient) listCredentialsCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-08-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -426,31 +440,52 @@ func (client *FleetsClient) listCredentialsHandleResponse(resp *http.Response) ( return result, nil } -// Update - Update a Fleet +// BeginUpdate - Update a Fleet // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-08-15-preview // - 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 - FleetsClientUpdateOptions contains the optional parameters for the FleetsClient.Update method. -func (client *FleetsClient) Update(ctx context.Context, resourceGroupName string, fleetName string, properties FleetPatch, options *FleetsClientUpdateOptions) (FleetsClientUpdateResponse, error) { +// - 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) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, fleetName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[FleetsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Update - Update a Fleet +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-15-preview +func (client *FleetsClient) update(ctx context.Context, resourceGroupName string, fleetName string, properties FleetPatch, options *FleetsClientBeginUpdateOptions) (*http.Response, error) { + var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, fleetName, properties, options) if err != nil { - return FleetsClientUpdateResponse{}, err + return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return FleetsClientUpdateResponse{}, err + return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return FleetsClientUpdateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return client.updateHandleResponse(resp) + return httpResp, nil } // updateCreateRequest creates the Update request. -func (client *FleetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, properties FleetPatch, options *FleetsClientUpdateOptions) (*policy.Request, error) { +func (client *FleetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, properties FleetPatch, options *FleetsClientBeginUpdateOptions) (*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") @@ -469,20 +504,14 @@ func (client *FleetsClient) updateCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-08-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} } req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, properties) -} - -// updateHandleResponse handles the Update response. -func (client *FleetsClient) updateHandleResponse(resp *http.Response) (FleetsClientUpdateResponse, error) { - result := FleetsClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Fleet); err != nil { - return FleetsClientUpdateResponse{}, err + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err } - return result, nil + return req, nil } diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleets_client_example_test.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleets_client_example_test.go deleted file mode 100644 index fa3d75772606..000000000000 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleets_client_example_test.go +++ /dev/null @@ -1,340 +0,0 @@ -//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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/de14cb8751b978b1877597b13292818e80f8c661/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/Fleets_ListBySub.json -func ExampleFleetsClient_NewListBySubscriptionPager() { - 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.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.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{ - // DNSPrefix: to.Ptr("dnsprefix1"), - // Fqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), - // KubernetesVersion: to.Ptr("1.22.4"), - // }, - // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/de14cb8751b978b1877597b13292818e80f8c661/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/Fleets_ListByResourceGroup.json -func ExampleFleetsClient_NewListByResourceGroupPager() { - 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.NewFleetsClient().NewListByResourceGroupPager("rg1", 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.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), - // }, - // 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{ - // DNSPrefix: to.Ptr("dnsprefix1"), - // Fqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), - // KubernetesVersion: to.Ptr("1.22.4"), - // }, - // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/de14cb8751b978b1877597b13292818e80f8c661/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/Fleets_Get.json -func ExampleFleetsClient_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) - 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.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{ - // DNSPrefix: to.Ptr("dnsprefix1"), - // Fqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), - // KubernetesVersion: to.Ptr("1.22.4"), - // }, - // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/de14cb8751b978b1877597b13292818e80f8c661/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/Fleets_CreateOrUpdate.json -func ExampleFleetsClient_BeginCreateOrUpdate() { - 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) - } - 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{ - DNSPrefix: to.Ptr("dnsprefix1"), - }, - }, - }, &armcontainerservicefleet.FleetsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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{ - // DNSPrefix: to.Ptr("dnsprefix1"), - // Fqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), - // KubernetesVersion: to.Ptr("1.22.4"), - // }, - // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/de14cb8751b978b1877597b13292818e80f8c661/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/Fleets_PatchTags.json -func ExampleFleetsClient_Update() { - 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().Update(ctx, "rg1", "fleet1", armcontainerservicefleet.FleetPatch{ - Tags: map[string]*string{ - "env": to.Ptr("prod"), - "tier": to.Ptr("secure"), - }, - }, &armcontainerservicefleet.FleetsClientUpdateOptions{IfMatch: to.Ptr("dfjkwelr7384")}) - 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{ - // "env": to.Ptr("prod"), - // "tier": to.Ptr("secure"), - // }, - // ETag: to.Ptr("23ujdflewrj3="), - // Properties: &armcontainerservicefleet.FleetProperties{ - // HubProfile: &armcontainerservicefleet.FleetHubProfile{ - // DNSPrefix: to.Ptr("dnsprefix1"), - // Fqdn: to.Ptr("dnsprefix1-abcd1234.flt.eastus.azmk8s.io"), - // KubernetesVersion: to.Ptr("1.22.4"), - // }, - // ProvisioningState: to.Ptr(armcontainerservicefleet.FleetProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/de14cb8751b978b1877597b13292818e80f8c661/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/Fleets_Delete.json -func ExampleFleetsClient_BeginDelete() { - 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) - } - poller, err := clientFactory.NewFleetsClient().BeginDelete(ctx, "rg1", "fleet1", &armcontainerservicefleet.FleetsClientBeginDeleteOptions{IfMatch: nil}) - 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: https://github.com/Azure/azure-rest-api-specs/blob/de14cb8751b978b1877597b13292818e80f8c661/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-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=="), - // }}, - // } -} diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetupdatestrategies_client.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetupdatestrategies_client.go new file mode 100644 index 000000000000..19af4f6a67e1 --- /dev/null +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/fleetupdatestrategies_client.go @@ -0,0 +1,343 @@ +//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. + +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" +) + +// FleetUpdateStrategiesClient contains the methods for the FleetUpdateStrategies group. +// Don't use this type directly, use NewFleetUpdateStrategiesClient() instead. +type FleetUpdateStrategiesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewFleetUpdateStrategiesClient creates a new instance of FleetUpdateStrategiesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - 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) { + cl, err := arm.NewClient(moduleName+".FleetUpdateStrategiesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FleetUpdateStrategiesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a FleetUpdateStrategy +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-15-preview +// - 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. +// - resource - Resource create parameters. +// - options - FleetUpdateStrategiesClientBeginCreateOrUpdateOptions contains the optional parameters for the FleetUpdateStrategiesClient.BeginCreateOrUpdate +// method. +func (client *FleetUpdateStrategiesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, updateStrategyName string, resource FleetUpdateStrategy, options *FleetUpdateStrategiesClientBeginCreateOrUpdateOptions) (*runtime.Poller[FleetUpdateStrategiesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, fleetName, updateStrategyName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetUpdateStrategiesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[FleetUpdateStrategiesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Create a FleetUpdateStrategy +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-15-preview +func (client *FleetUpdateStrategiesClient) createOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, updateStrategyName string, resource FleetUpdateStrategy, options *FleetUpdateStrategiesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, fleetName, updateStrategyName, resource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *FleetUpdateStrategiesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, updateStrategyName string, resource FleetUpdateStrategy, options *FleetUpdateStrategiesClientBeginCreateOrUpdateOptions) (*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") + } + 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 updateStrategyName == "" { + return nil, errors.New("parameter updateStrategyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{updateStrategyName}", url.PathEscape(updateStrategyName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-08-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + if options != nil && options.IfNoneMatch != nil { + req.Raw().Header["If-None-Match"] = []string{*options.IfNoneMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a FleetUpdateStrategy +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-15-preview +// - 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. +// - options - FleetUpdateStrategiesClientBeginDeleteOptions contains the optional parameters for the FleetUpdateStrategiesClient.BeginDelete +// method. +func (client *FleetUpdateStrategiesClient) BeginDelete(ctx context.Context, resourceGroupName string, fleetName string, updateStrategyName string, options *FleetUpdateStrategiesClientBeginDeleteOptions) (*runtime.Poller[FleetUpdateStrategiesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, fleetName, updateStrategyName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetUpdateStrategiesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[FleetUpdateStrategiesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Delete - Delete a FleetUpdateStrategy +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-15-preview +func (client *FleetUpdateStrategiesClient) deleteOperation(ctx context.Context, resourceGroupName string, fleetName string, updateStrategyName string, options *FleetUpdateStrategiesClientBeginDeleteOptions) (*http.Response, error) { + var err error + req, err := client.deleteCreateRequest(ctx, resourceGroupName, fleetName, updateStrategyName, 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, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *FleetUpdateStrategiesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, updateStrategyName string, options *FleetUpdateStrategiesClientBeginDeleteOptions) (*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") + } + 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 updateStrategyName == "" { + return nil, errors.New("parameter updateStrategyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{updateStrategyName}", url.PathEscape(updateStrategyName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-08-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a FleetUpdateStrategy +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-08-15-preview +// - 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. +// - options - FleetUpdateStrategiesClientGetOptions contains the optional parameters for the FleetUpdateStrategiesClient.Get +// method. +func (client *FleetUpdateStrategiesClient) Get(ctx context.Context, resourceGroupName string, fleetName string, updateStrategyName string, options *FleetUpdateStrategiesClientGetOptions) (FleetUpdateStrategiesClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, resourceGroupName, fleetName, updateStrategyName, options) + if err != nil { + return FleetUpdateStrategiesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FleetUpdateStrategiesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FleetUpdateStrategiesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *FleetUpdateStrategiesClient) getCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, updateStrategyName string, options *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") + } + 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 updateStrategyName == "" { + return nil, errors.New("parameter updateStrategyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{updateStrategyName}", url.PathEscape(updateStrategyName)) + 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", "2023-08-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FleetUpdateStrategiesClient) getHandleResponse(resp *http.Response) (FleetUpdateStrategiesClientGetResponse, error) { + result := FleetUpdateStrategiesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FleetUpdateStrategy); err != nil { + return FleetUpdateStrategiesClientGetResponse{}, err + } + return result, nil +} + +// NewListByFleetPager - List FleetUpdateStrategy resources by Fleet +// +// Generated from API version 2023-08-15-preview +// - 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 +// method. +func (client *FleetUpdateStrategiesClient) NewListByFleetPager(resourceGroupName string, fleetName string, options *FleetUpdateStrategiesClientListByFleetOptions) *runtime.Pager[FleetUpdateStrategiesClientListByFleetResponse] { + return runtime.NewPager(runtime.PagingHandler[FleetUpdateStrategiesClientListByFleetResponse]{ + More: func(page FleetUpdateStrategiesClientListByFleetResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FleetUpdateStrategiesClientListByFleetResponse) (FleetUpdateStrategiesClientListByFleetResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listByFleetCreateRequest(ctx, resourceGroupName, fleetName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return FleetUpdateStrategiesClientListByFleetResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FleetUpdateStrategiesClientListByFleetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FleetUpdateStrategiesClientListByFleetResponse{}, runtime.NewResponseError(resp) + } + return client.listByFleetHandleResponse(resp) + }, + }) +} + +// listByFleetCreateRequest creates the ListByFleet request. +func (client *FleetUpdateStrategiesClient) listByFleetCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, options *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") + } + 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)) + 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", "2023-08-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByFleetHandleResponse handles the ListByFleet response. +func (client *FleetUpdateStrategiesClient) listByFleetHandleResponse(resp *http.Response) (FleetUpdateStrategiesClientListByFleetResponse, error) { + result := FleetUpdateStrategiesClientListByFleetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FleetUpdateStrategyListResult); err != nil { + return FleetUpdateStrategiesClientListByFleetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/go.mod b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/go.mod index 664b06f594c6..92eb54fba85c 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/go.mod +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservicefle go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect - github.com/google/uuid v1.3.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/crypto v0.7.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.8.0 // indirect - golang.org/x/sys v0.6.0 // indirect golang.org/x/text v0.8.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/go.sum b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/go.sum index 21718b486698..727ce838bdc8 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/go.sum +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/go.sum @@ -1,31 +1,15 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0 h1:8kDqDngH+DmVBiCtIjCFTGa7MBnsIOkF9IccInFEbjk= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.0/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0 h1:vcYCAze6p19qBW7MhZybIsqD8sMV8js0NyQM8JDnVtg= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.3.0/go.mod h1:OQeznEEkTZ9OrhHJoDD8ZDq51FHgXjqtP9z6bEwBq9U= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 h1:SEy2xmstIphdPwNBUi7uhvjyjhVKISfwjfOJmuy7kg4= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1/go.mod h1:bjGvMhVMb+EEm3VRNQawDMUyMMjo+S5ewNjflkep/0Q= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 h1:sXr+ck84g/ZlZUOZiNELInmMgOsuGwdjjVkEIde0OtY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0/go.mod h1:okt5dMMTOFjX/aovMlrjvvXoPMBVSPzk9185BT0+eZM= -github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0 h1:OBhqkivkhkMqLPymWEppkm7vgPQY2XsHoEkaMQ0AdZY= -github.com/AzureAD/microsoft-authentication-library-for-go v1.0.0/go.mod h1:kgDmCTgBzIEPFElEF+FK0SdjAor06dRq2Go927dnQ6o= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= -github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg= -github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= -golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/models.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/models.go index 9c8fa07aaf2e..48d4718a02b8 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/models.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/models.go @@ -3,14 +3,32 @@ // 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. +// 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. -// DO NOT EDIT. package armcontainerservicefleet import "time" +// APIServerAccessProfile - Access profile for the Fleet hub API server. +type APIServerAccessProfile struct { + // Whether to create the Fleet hub as a private cluster or not. + EnablePrivateCluster *bool + + // Whether to enable apiserver vnet integration for the Fleet hub or not. + EnableVnetIntegration *bool + + // The subnet to be used when apiserver vnet integration is enabled. It is required when creating a new Fleet with BYO vnet. + SubnetID *string +} + +// AgentProfile - Agent profile for the Fleet hub. +type AgentProfile struct { + // The ID of the subnet which the Fleet hub node will join on startup. If this is not specified, a vnet and subnet will be + // generated and used. + SubnetID *string +} + // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. @@ -43,6 +61,9 @@ type Fleet struct { // REQUIRED; The geo-location where the resource lives Location *string + // Managed identity. + Identity *ManagedServiceIdentity + // The resource-specific properties for this resource. Properties *FleetProperties @@ -85,6 +106,12 @@ type FleetCredentialResults struct { // FleetHubProfile - The FleetHubProfile configures the fleet hub. type FleetHubProfile struct { + // The access profile for the Fleet hub API server. + APIServerAccessProfile *APIServerAccessProfile + + // The agent profile for the Fleet hub. + AgentProfile *AgentProfile + // DNS prefix used to create the FQDN for the Fleet hub. DNSPrefix *string @@ -162,42 +189,11 @@ type FleetMemberUpdateProperties struct { Group *string } -// FleetMembersClientBeginCreateOptions contains the optional parameters for the FleetMembersClient.BeginCreate method. -type FleetMembersClientBeginCreateOptions struct { - // 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 { - // 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. -type FleetMembersClientGetOptions struct { - // placeholder for future optional parameters -} - -// FleetMembersClientListByFleetOptions contains the optional parameters for the FleetMembersClient.NewListByFleetPager method. -type FleetMembersClientListByFleetOptions struct { - // placeholder for future optional parameters -} - -// FleetMembersClientUpdateOptions contains the optional parameters for the FleetMembersClient.Update method. -type FleetMembersClientUpdateOptions struct { - // The request should only proceed if an entity matches this string. - IfMatch *string -} - // FleetPatch - Properties of a Fleet that can be patched. type FleetPatch struct { + // Managed identity. + Identity *ManagedServiceIdentity + // Resource tags. Tags map[string]*string } @@ -211,56 +207,55 @@ type FleetProperties struct { ProvisioningState *FleetProvisioningState } -// FleetsClientBeginCreateOrUpdateOptions contains the optional parameters for the FleetsClient.BeginCreateOrUpdate method. -type FleetsClientBeginCreateOrUpdateOptions struct { - // 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 -} +// FleetUpdateStrategy - Defines a multi-stage process to perform update operations across members of a Fleet. +type FleetUpdateStrategy struct { + // The resource-specific properties for this resource. + Properties *FleetUpdateStrategyProperties -// FleetsClientBeginDeleteOptions contains the optional parameters for the FleetsClient.BeginDelete method. -type FleetsClientBeginDeleteOptions struct { - // The request should only proceed if an entity matches this string. - IfMatch *string - // Resumes the LRO from the provided token. - ResumeToken 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. + ETag *string -// FleetsClientGetOptions contains the optional parameters for the FleetsClient.Get method. -type FleetsClientGetOptions struct { - // placeholder for future optional parameters -} + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string -// FleetsClientListByResourceGroupOptions contains the optional parameters for the FleetsClient.NewListByResourceGroupPager -// method. -type FleetsClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} + // READ-ONLY; The name of the resource + Name *string -// FleetsClientListBySubscriptionOptions contains the optional parameters for the FleetsClient.NewListBySubscriptionPager -// method. -type FleetsClientListBySubscriptionOptions struct { - // placeholder for future optional parameters + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } -// FleetsClientListCredentialsOptions contains the optional parameters for the FleetsClient.ListCredentials method. -type FleetsClientListCredentialsOptions struct { - // placeholder for future optional parameters +// FleetUpdateStrategyListResult - The response of a FleetUpdateStrategy list operation. +type FleetUpdateStrategyListResult struct { + // REQUIRED; The FleetUpdateStrategy items on this page + Value []*FleetUpdateStrategy + + // The link to the next page of items + NextLink *string } -// FleetsClientUpdateOptions contains the optional parameters for the FleetsClient.Update method. -type FleetsClientUpdateOptions struct { - // The request should only proceed if an entity matches this string. - IfMatch *string +// FleetUpdateStrategyProperties - The properties of the UpdateStrategy. +type FleetUpdateStrategyProperties struct { + // REQUIRED; Defines the update sequence of the clusters. + Strategy *UpdateRunStrategy + + // READ-ONLY; The provisioning state of the UpdateStrategy resource. + ProvisioningState *FleetUpdateStrategyProvisioningState } // ManagedClusterUpdate - The update to be applied to the ManagedClusters. type ManagedClusterUpdate struct { // REQUIRED; The upgrade to apply to the ManagedClusters. Upgrade *ManagedClusterUpgradeSpec + + // The node image upgrade to be applied to the target nodes in update run. + NodeImageSelection *NodeImageSelection } // ManagedClusterUpgradeSpec - The upgrade to apply to a ManagedCluster. @@ -273,11 +268,34 @@ type ManagedClusterUpgradeSpec struct { KubernetesVersion *string } +// 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). + 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. + UserAssignedIdentities map[string]*UserAssignedIdentity + + // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned + // identity. + PrincipalID *string + + // READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *string +} + // MemberUpdateStatus - The status of a member update operation. type MemberUpdateStatus struct { // READ-ONLY; The Azure resource id of the target Kubernetes cluster. ClusterResourceID *string + // READ-ONLY; The status message after processing the member update operation. + Message *string + // READ-ONLY; The name of the FleetMember. Name *string @@ -288,6 +306,24 @@ type MemberUpdateStatus struct { Status *UpdateStatus } +// NodeImageSelection - The node image upgrade to be applied to the target nodes in update run. +type NodeImageSelection struct { + // REQUIRED; The node image upgrade type. + Type *NodeImageSelectionType +} + +// NodeImageSelectionStatus - The node image upgrade specs for the update run. +type NodeImageSelectionStatus struct { + // READ-ONLY; The image versions to upgrade the nodes to. + SelectedNodeImageVersions []*NodeImageVersion +} + +// NodeImageVersion - The node upgrade image version. +type NodeImageVersion struct { + // READ-ONLY; The image version to upgrade the nodes to (e.g., 'AKSUbuntu-1804gen2containerd-2022.12.13'). + Version *string +} + // Operation - Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { // Localized display information for this particular operation. @@ -337,11 +373,6 @@ type OperationListResult struct { Value []*Operation } -// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters -} - // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). @@ -365,8 +396,7 @@ type SystemData struct { // UpdateGroup - A group to be updated. type UpdateGroup struct { - // REQUIRED; The name of the Fleet member group to update. It should match the name of an existing FleetMember group. A group - // can only appear once across all UpdateStages in the UpdateRun. + // REQUIRED; Name of the group. It must match a group name of an existing fleet member. Name *string } @@ -382,7 +412,7 @@ type UpdateGroupStatus struct { Status *UpdateStatus } -// UpdateRun - An UpdateRun is a multi-stage process to perform update operations across members of a Fleet. +// UpdateRun - A multi-stage process to perform update operations across members of a Fleet. type UpdateRun struct { // The resource-specific properties for this resource. Properties *UpdateRunProperties @@ -426,6 +456,19 @@ type UpdateRunProperties struct { // 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. + // When creating a new run, there are three ways to define a strategy for the run: + // 1. Define a new strategy in place: Set the "strategy" field. + // 2. Use an existing strategy: Set the "updateStrategyId" field. (since 2023-08-15-preview) + // 3. Use the default strategy to update all the members one by one: Leave both "updateStrategyId" and "strategy" unset. (since + // 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. + UpdateStrategyID *string + // READ-ONLY; The provisioning state of the UpdateRun resource. ProvisioningState *UpdateRunProvisioningState @@ -435,6 +478,10 @@ 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. + NodeImageSelection *NodeImageSelectionStatus + // READ-ONLY; The stages composing an update run. Stages are run sequentially withing an UpdateRun. Stages []*UpdateStageStatus @@ -442,61 +489,17 @@ type UpdateRunStatus struct { Status *UpdateStatus } -// UpdateRunStrategy - The UpdateRunStrategy configures the sequence of Stages and Groups in which the clusters will be updated. +// 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. +// A valid strategy contains no duplicate groups within or across stages. type UpdateRunStrategy struct { - // REQUIRED; The list of stages that compose this update run. + // REQUIRED; The list of stages that compose this update run. Min size: 1. Stages []*UpdateStage } -// UpdateRunsClientBeginCreateOrUpdateOptions contains the optional parameters for the UpdateRunsClient.BeginCreateOrUpdate -// method. -type UpdateRunsClientBeginCreateOrUpdateOptions struct { - // 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 { - // 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 { - // 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 { - // 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. -type UpdateRunsClientGetOptions struct { - // placeholder for future optional parameters -} - -// UpdateRunsClientListByFleetOptions contains the optional parameters for the UpdateRunsClient.NewListByFleetPager method. -type UpdateRunsClientListByFleetOptions struct { - // placeholder for future optional parameters -} - -// UpdateStage - Contains the groups to be updated by an UpdateRun. Update order: -// * Sequential between stages: Stages run sequentially. The previous stage must complete before the next one starts. -// * Parallel within a stage: Groups within a stage run in parallel. -// * Sequential within a group: Clusters within a group are updated sequentially. +// UpdateStage - Defines a stage which contains the groups to update and the steps to take (e.g., wait for a time period) +// before starting the next stage. type UpdateStage struct { // REQUIRED; The name of the stage. Must be unique within the UpdateRun. Name *string @@ -504,8 +507,7 @@ type UpdateStage struct { // The time in seconds to wait at the end of this stage before starting the next one. Defaults to 0 seconds if unspecified. AfterStageWaitInSeconds *int32 - // A list of group names that compose the stage. The groups will be updated in parallel. Each group name can only appear once - // in the UpdateRun. + // Defines the groups to be executed in parallel in this stage. Duplicate groups are not allowed. Min size: 1. Groups []*UpdateGroup } @@ -539,6 +541,15 @@ type UpdateStatus struct { State *UpdateState } +// UserAssignedIdentity - User assigned identity properties +type UserAssignedIdentity struct { + // READ-ONLY; The client ID of the assigned identity. + ClientID *string + + // READ-ONLY; The principal ID of the assigned identity. + PrincipalID *string +} + // WaitStatus - The status of the wait duration. type WaitStatus struct { // READ-ONLY; The status of the wait duration. diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/models_serde.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/models_serde.go index e09cf8d6e4bd..695c4394e828 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/models_serde.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/models_serde.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcontainerservicefleet @@ -17,6 +16,68 @@ import ( "reflect" ) +// MarshalJSON implements the json.Marshaller interface for type APIServerAccessProfile. +func (a APIServerAccessProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enablePrivateCluster", a.EnablePrivateCluster) + populate(objectMap, "enableVnetIntegration", a.EnableVnetIntegration) + populate(objectMap, "subnetId", a.SubnetID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type APIServerAccessProfile. +func (a *APIServerAccessProfile) 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 "enablePrivateCluster": + err = unpopulate(val, "EnablePrivateCluster", &a.EnablePrivateCluster) + delete(rawMsg, key) + case "enableVnetIntegration": + err = unpopulate(val, "EnableVnetIntegration", &a.EnableVnetIntegration) + delete(rawMsg, key) + case "subnetId": + err = unpopulate(val, "SubnetID", &a.SubnetID) + 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 AgentProfile. +func (a AgentProfile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "subnetId", a.SubnetID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentProfile. +func (a *AgentProfile) 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 "subnetId": + err = unpopulate(val, "SubnetID", &a.SubnetID) + 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) @@ -96,6 +157,7 @@ func (f Fleet) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "eTag", f.ETag) populate(objectMap, "id", f.ID) + populate(objectMap, "identity", f.Identity) populate(objectMap, "location", f.Location) populate(objectMap, "name", f.Name) populate(objectMap, "properties", f.Properties) @@ -120,6 +182,9 @@ func (f *Fleet) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &f.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &f.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &f.Location) delete(rawMsg, key) @@ -207,6 +272,8 @@ func (f *FleetCredentialResults) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type FleetHubProfile. func (f FleetHubProfile) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "apiServerAccessProfile", f.APIServerAccessProfile) + populate(objectMap, "agentProfile", f.AgentProfile) populate(objectMap, "dnsPrefix", f.DNSPrefix) populate(objectMap, "fqdn", f.Fqdn) populate(objectMap, "kubernetesVersion", f.KubernetesVersion) @@ -222,6 +289,12 @@ func (f *FleetHubProfile) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "apiServerAccessProfile": + err = unpopulate(val, "APIServerAccessProfile", &f.APIServerAccessProfile) + delete(rawMsg, key) + case "agentProfile": + err = unpopulate(val, "AgentProfile", &f.AgentProfile) + delete(rawMsg, key) case "dnsPrefix": err = unpopulate(val, "DNSPrefix", &f.DNSPrefix) delete(rawMsg, key) @@ -440,6 +513,7 @@ func (f *FleetMemberUpdateProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type FleetPatch. func (f FleetPatch) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "identity", f.Identity) populate(objectMap, "tags", f.Tags) return json.Marshal(objectMap) } @@ -453,6 +527,9 @@ func (f *FleetPatch) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "identity": + err = unpopulate(val, "Identity", &f.Identity) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &f.Tags) delete(rawMsg, key) @@ -495,9 +572,119 @@ func (f *FleetProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type FleetUpdateStrategy. +func (f FleetUpdateStrategy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "eTag", f.ETag) + populate(objectMap, "id", f.ID) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetUpdateStrategy. +func (f *FleetUpdateStrategy) 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 "eTag": + err = unpopulate(val, "ETag", &f.ETag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + 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 FleetUpdateStrategyListResult. +func (f FleetUpdateStrategyListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetUpdateStrategyListResult. +func (f *FleetUpdateStrategyListResult) 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 "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + 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 FleetUpdateStrategyProperties. +func (f FleetUpdateStrategyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", f.ProvisioningState) + populate(objectMap, "strategy", f.Strategy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetUpdateStrategyProperties. +func (f *FleetUpdateStrategyProperties) 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 "provisioningState": + err = unpopulate(val, "ProvisioningState", &f.ProvisioningState) + delete(rawMsg, key) + case "strategy": + err = unpopulate(val, "Strategy", &f.Strategy) + 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 ManagedClusterUpdate. func (m ManagedClusterUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nodeImageSelection", m.NodeImageSelection) populate(objectMap, "upgrade", m.Upgrade) return json.Marshal(objectMap) } @@ -511,6 +698,9 @@ func (m *ManagedClusterUpdate) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nodeImageSelection": + err = unpopulate(val, "NodeImageSelection", &m.NodeImageSelection) + delete(rawMsg, key) case "upgrade": err = unpopulate(val, "Upgrade", &m.Upgrade) delete(rawMsg, key) @@ -553,10 +743,50 @@ func (m *ManagedClusterUpgradeSpec) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. +func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", m.PrincipalID) + populate(objectMap, "tenantId", m.TenantID) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServiceIdentity. +func (m *ManagedServiceIdentity) 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", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &m.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type MemberUpdateStatus. func (m MemberUpdateStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "clusterResourceId", m.ClusterResourceID) + populate(objectMap, "message", m.Message) populate(objectMap, "name", m.Name) populate(objectMap, "operationId", m.OperationID) populate(objectMap, "status", m.Status) @@ -575,6 +805,9 @@ func (m *MemberUpdateStatus) UnmarshalJSON(data []byte) error { case "clusterResourceId": err = unpopulate(val, "ClusterResourceID", &m.ClusterResourceID) delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &m.Message) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &m.Name) delete(rawMsg, key) @@ -592,6 +825,87 @@ func (m *MemberUpdateStatus) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type NodeImageSelection. +func (n NodeImageSelection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "type", n.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NodeImageSelection. +func (n *NodeImageSelection) 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", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "type": + err = unpopulate(val, "Type", &n.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NodeImageSelectionStatus. +func (n NodeImageSelectionStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "selectedNodeImageVersions", n.SelectedNodeImageVersions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NodeImageSelectionStatus. +func (n *NodeImageSelectionStatus) 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", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "selectedNodeImageVersions": + err = unpopulate(val, "SelectedNodeImageVersions", &n.SelectedNodeImageVersions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type NodeImageVersion. +func (n NodeImageVersion) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "version", n.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type NodeImageVersion. +func (n *NodeImageVersion) 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", n, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "version": + err = unpopulate(val, "Version", &n.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", n, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Operation. func (o Operation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -899,6 +1213,7 @@ func (u UpdateRunProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "provisioningState", u.ProvisioningState) populate(objectMap, "status", u.Status) populate(objectMap, "strategy", u.Strategy) + populate(objectMap, "updateStrategyId", u.UpdateStrategyID) return json.Marshal(objectMap) } @@ -923,6 +1238,9 @@ func (u *UpdateRunProperties) UnmarshalJSON(data []byte) error { case "strategy": err = unpopulate(val, "Strategy", &u.Strategy) delete(rawMsg, key) + case "updateStrategyId": + err = unpopulate(val, "UpdateStrategyID", &u.UpdateStrategyID) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", u, err) @@ -934,6 +1252,7 @@ func (u *UpdateRunProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type UpdateRunStatus. func (u UpdateRunStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nodeImageSelection", u.NodeImageSelection) populate(objectMap, "stages", u.Stages) populate(objectMap, "status", u.Status) return json.Marshal(objectMap) @@ -948,6 +1267,9 @@ func (u *UpdateRunStatus) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nodeImageSelection": + err = unpopulate(val, "NodeImageSelection", &u.NodeImageSelection) + delete(rawMsg, key) case "stages": err = unpopulate(val, "Stages", &u.Stages) delete(rawMsg, key) @@ -1102,6 +1424,37 @@ func (u *UpdateStatus) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentity. +func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity. +func (u *UserAssignedIdentity) 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", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type WaitStatus. func (w WaitStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/operations_client.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/operations_client.go index 820be2880d32..dbd497b88477 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/operations_client.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/operations_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcontainerservicefleet @@ -40,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - List the operations for the provider // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-08-15-preview // - 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]{ @@ -78,7 +77,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-08-15-preview") 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 deleted file mode 100644 index 8a986d24fd1c..000000000000 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/operations_client_example_test.go +++ /dev/null @@ -1,56 +0,0 @@ -//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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/de14cb8751b978b1877597b13292818e80f8c661/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/Operations_List.json -func ExampleOperationsClient_NewListPager() { - 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.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"), - // }, - // Origin: to.Ptr(armcontainerservicefleet.OriginUserSystem), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/options.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/options.go new file mode 100644 index 000000000000..393d8020ce28 --- /dev/null +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/options.go @@ -0,0 +1,190 @@ +//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. + +package armcontainerservicefleet + +// FleetMembersClientBeginCreateOptions contains the optional parameters for the FleetMembersClient.BeginCreate method. +type FleetMembersClientBeginCreateOptions struct { + // 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 { + // The request should only proceed if an entity matches this string. + IfMatch *string + + // Resumes the LRO 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. +type FleetMembersClientGetOptions struct { + // placeholder for future optional parameters +} + +// FleetMembersClientListByFleetOptions contains the optional parameters for the FleetMembersClient.NewListByFleetPager method. +type FleetMembersClientListByFleetOptions struct { + // placeholder for future optional parameters +} + +// FleetUpdateStrategiesClientBeginCreateOrUpdateOptions contains the optional parameters for the FleetUpdateStrategiesClient.BeginCreateOrUpdate +// method. +type FleetUpdateStrategiesClientBeginCreateOrUpdateOptions struct { + // 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 { + // 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. +type FleetUpdateStrategiesClientGetOptions struct { + // placeholder for future optional parameters +} + +// FleetUpdateStrategiesClientListByFleetOptions contains the optional parameters for the FleetUpdateStrategiesClient.NewListByFleetPager +// method. +type FleetUpdateStrategiesClientListByFleetOptions struct { + // placeholder for future optional parameters +} + +// FleetsClientBeginCreateOrUpdateOptions contains the optional parameters for the FleetsClient.BeginCreateOrUpdate method. +type FleetsClientBeginCreateOrUpdateOptions struct { + // 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 { + // The request should only proceed if an entity matches this string. + IfMatch *string + + // Resumes the LRO 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. +type FleetsClientGetOptions struct { + // placeholder for future optional parameters +} + +// FleetsClientListByResourceGroupOptions contains the optional parameters for the FleetsClient.NewListByResourceGroupPager +// method. +type FleetsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// FleetsClientListBySubscriptionOptions contains the optional parameters for the FleetsClient.NewListBySubscriptionPager +// method. +type FleetsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// FleetsClientListCredentialsOptions contains the optional parameters for the FleetsClient.ListCredentials method. +type FleetsClientListCredentialsOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// UpdateRunsClientBeginCreateOrUpdateOptions contains the optional parameters for the UpdateRunsClient.BeginCreateOrUpdate +// method. +type UpdateRunsClientBeginCreateOrUpdateOptions struct { + // 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 { + // 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 { + // 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 { + // 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. +type UpdateRunsClientGetOptions struct { + // placeholder for future optional parameters +} + +// UpdateRunsClientListByFleetOptions contains the optional parameters for the UpdateRunsClient.NewListByFleetPager method. +type UpdateRunsClientListByFleetOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/response_types.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/response_types.go index faebc02e932e..45fc44310741 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/response_types.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/response_types.go @@ -3,14 +3,14 @@ // 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. +// 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. -// DO NOT EDIT. package armcontainerservicefleet // FleetMembersClientCreateResponse contains the response from method FleetMembersClient.BeginCreate. type FleetMembersClientCreateResponse struct { + // A member of the Fleet. It contains a reference to an existing Kubernetes cluster on Azure. FleetMember } @@ -21,21 +21,48 @@ type FleetMembersClientDeleteResponse struct { // FleetMembersClientGetResponse contains the response from method FleetMembersClient.Get. type FleetMembersClientGetResponse struct { + // A member of the Fleet. It contains a reference to an existing Kubernetes cluster on Azure. FleetMember } // FleetMembersClientListByFleetResponse contains the response from method FleetMembersClient.NewListByFleetPager. type FleetMembersClientListByFleetResponse struct { + // The response of a FleetMember list operation. FleetMemberListResult } -// FleetMembersClientUpdateResponse contains the response from method FleetMembersClient.Update. +// FleetMembersClientUpdateResponse contains the response from method FleetMembersClient.BeginUpdate. type FleetMembersClientUpdateResponse struct { + // A member of the Fleet. It contains a reference to an existing Kubernetes cluster on Azure. FleetMember } +// FleetUpdateStrategiesClientCreateOrUpdateResponse contains the response from method FleetUpdateStrategiesClient.BeginCreateOrUpdate. +type FleetUpdateStrategiesClientCreateOrUpdateResponse struct { + // Defines a multi-stage process to perform update operations across members of a Fleet. + FleetUpdateStrategy +} + +// FleetUpdateStrategiesClientDeleteResponse contains the response from method FleetUpdateStrategiesClient.BeginDelete. +type FleetUpdateStrategiesClientDeleteResponse struct { + // placeholder for future response values +} + +// FleetUpdateStrategiesClientGetResponse contains the response from method FleetUpdateStrategiesClient.Get. +type FleetUpdateStrategiesClientGetResponse struct { + // Defines a multi-stage process to perform update operations across members of a Fleet. + FleetUpdateStrategy +} + +// FleetUpdateStrategiesClientListByFleetResponse contains the response from method FleetUpdateStrategiesClient.NewListByFleetPager. +type FleetUpdateStrategiesClientListByFleetResponse struct { + // The response of a FleetUpdateStrategy list operation. + FleetUpdateStrategyListResult +} + // FleetsClientCreateOrUpdateResponse contains the response from method FleetsClient.BeginCreateOrUpdate. type FleetsClientCreateOrUpdateResponse struct { + // The Fleet resource. Fleet } @@ -46,36 +73,43 @@ type FleetsClientDeleteResponse struct { // FleetsClientGetResponse contains the response from method FleetsClient.Get. type FleetsClientGetResponse struct { + // The Fleet resource. Fleet } // FleetsClientListByResourceGroupResponse contains the response from method FleetsClient.NewListByResourceGroupPager. type FleetsClientListByResourceGroupResponse struct { + // The response of a Fleet list operation. FleetListResult } // FleetsClientListBySubscriptionResponse contains the response from method FleetsClient.NewListBySubscriptionPager. type FleetsClientListBySubscriptionResponse struct { + // The response of a Fleet list operation. FleetListResult } // FleetsClientListCredentialsResponse contains the response from method FleetsClient.ListCredentials. type FleetsClientListCredentialsResponse struct { + // The Credential results response. FleetCredentialResults } -// FleetsClientUpdateResponse contains the response from method FleetsClient.Update. +// FleetsClientUpdateResponse contains the response from method FleetsClient.BeginUpdate. type FleetsClientUpdateResponse struct { + // The Fleet resource. Fleet } // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. OperationListResult } // UpdateRunsClientCreateOrUpdateResponse contains the response from method UpdateRunsClient.BeginCreateOrUpdate. type UpdateRunsClientCreateOrUpdateResponse struct { + // A multi-stage process to perform update operations across members of a Fleet. UpdateRun } @@ -86,20 +120,24 @@ type UpdateRunsClientDeleteResponse struct { // UpdateRunsClientGetResponse contains the response from method UpdateRunsClient.Get. type UpdateRunsClientGetResponse struct { + // A multi-stage process to perform update operations across members of a Fleet. UpdateRun } // UpdateRunsClientListByFleetResponse contains the response from method UpdateRunsClient.NewListByFleetPager. type UpdateRunsClientListByFleetResponse struct { + // The response of a UpdateRun list operation. UpdateRunListResult } // UpdateRunsClientStartResponse contains the response from method UpdateRunsClient.BeginStart. type UpdateRunsClientStartResponse struct { + // A multi-stage process to perform update operations across members of a Fleet. UpdateRun } // UpdateRunsClientStopResponse contains the response from method UpdateRunsClient.BeginStop. type UpdateRunsClientStopResponse struct { + // A multi-stage process to perform update operations across members of a Fleet. UpdateRun } diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/time_rfc3339.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/time_rfc3339.go index 41b18f78a91d..d9f5811eaf05 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/time_rfc3339.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/time_rfc3339.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcontainerservicefleet diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/updateruns_client.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/updateruns_client.go index 009fdb3cbb7e..747f7efd9828 100644 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/updateruns_client.go +++ b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/updateruns_client.go @@ -3,9 +3,8 @@ // 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. +// 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. -// DO NOT EDIT. package armcontainerservicefleet @@ -47,7 +46,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 2023-03-15-preview +// Generated from API version 2023-08-15-preview // - 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. @@ -60,9 +59,10 @@ func (client *UpdateRunsClient) BeginCreateOrUpdate(ctx context.Context, resourc if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[UpdateRunsClientCreateOrUpdateResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[UpdateRunsClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[UpdateRunsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -71,20 +71,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-08-15-preview func (client *UpdateRunsClient) createOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, updateRunName string, resource UpdateRun, options *UpdateRunsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, fleetName, updateRunName, resource, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. @@ -111,7 +113,7 @@ func (client *UpdateRunsClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-08-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -120,13 +122,16 @@ func (client *UpdateRunsClient) createOrUpdateCreateRequest(ctx context.Context, req.Raw().Header["If-None-Match"] = []string{*options.IfNoneMatch} } req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, resource) + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil } // BeginDelete - Delete a UpdateRun // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-08-15-preview // - 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. @@ -137,9 +142,10 @@ func (client *UpdateRunsClient) BeginDelete(ctx context.Context, resourceGroupNa if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[UpdateRunsClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[UpdateRunsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[UpdateRunsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -148,20 +154,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-08-15-preview func (client *UpdateRunsClient) deleteOperation(ctx context.Context, resourceGroupName string, fleetName string, updateRunName string, options *UpdateRunsClientBeginDeleteOptions) (*http.Response, error) { + var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, fleetName, updateRunName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. @@ -188,7 +196,7 @@ func (client *UpdateRunsClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-08-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -200,24 +208,27 @@ 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 2023-03-15-preview +// Generated from API version 2023-08-15-preview // - 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. // - options - UpdateRunsClientGetOptions contains the optional parameters for the UpdateRunsClient.Get method. func (client *UpdateRunsClient) Get(ctx context.Context, resourceGroupName string, fleetName string, updateRunName string, options *UpdateRunsClientGetOptions) (UpdateRunsClientGetResponse, error) { + var err error req, err := client.getCreateRequest(ctx, resourceGroupName, fleetName, updateRunName, options) if err != nil { return UpdateRunsClientGetResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return UpdateRunsClientGetResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return UpdateRunsClientGetResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return UpdateRunsClientGetResponse{}, err } - return client.getHandleResponse(resp) + resp, err := client.getHandleResponse(httpResp) + return resp, err } // getCreateRequest creates the Get request. @@ -244,7 +255,7 @@ func (client *UpdateRunsClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-08-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -261,7 +272,7 @@ func (client *UpdateRunsClient) getHandleResponse(resp *http.Response) (UpdateRu // NewListByFleetPager - List UpdateRun resources by Fleet // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-08-15-preview // - 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 @@ -314,7 +325,7 @@ func (client *UpdateRunsClient) listByFleetCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-08-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -332,7 +343,7 @@ func (client *UpdateRunsClient) listByFleetHandleResponse(resp *http.Response) ( // BeginStart - Starts an UpdateRun. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-03-15-preview +// Generated from API version 2023-08-15-preview // - 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. @@ -343,9 +354,10 @@ func (client *UpdateRunsClient) BeginStart(ctx context.Context, resourceGroupNam if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[UpdateRunsClientStartResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[UpdateRunsClientStartResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[UpdateRunsClientStartResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -354,20 +366,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-08-15-preview func (client *UpdateRunsClient) start(ctx context.Context, resourceGroupName string, fleetName string, updateRunName string, options *UpdateRunsClientBeginStartOptions) (*http.Response, error) { + var err error req, err := client.startCreateRequest(ctx, resourceGroupName, fleetName, updateRunName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // startCreateRequest creates the Start request. @@ -394,7 +408,7 @@ func (client *UpdateRunsClient) startCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-08-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} @@ -406,7 +420,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 2023-03-15-preview +// Generated from API version 2023-08-15-preview // - 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. @@ -417,9 +431,10 @@ func (client *UpdateRunsClient) BeginStop(ctx context.Context, resourceGroupName if err != nil { return nil, err } - return runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[UpdateRunsClientStopResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[UpdateRunsClientStopResponse]{ FinalStateVia: runtime.FinalStateViaLocation, }) + return poller, err } else { return runtime.NewPollerFromResumeToken[UpdateRunsClientStopResponse](options.ResumeToken, client.internal.Pipeline(), nil) } @@ -428,20 +443,22 @@ 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 2023-03-15-preview +// Generated from API version 2023-08-15-preview func (client *UpdateRunsClient) stop(ctx context.Context, resourceGroupName string, fleetName string, updateRunName string, options *UpdateRunsClientBeginStopOptions) (*http.Response, error) { + var err error req, err := client.stopCreateRequest(ctx, resourceGroupName, fleetName, updateRunName, options) if err != nil { return nil, err } - resp, err := client.internal.Pipeline().Do(req) + httpResp, err := client.internal.Pipeline().Do(req) if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err } - return resp, nil + return httpResp, nil } // stopCreateRequest creates the Stop request. @@ -468,7 +485,7 @@ func (client *UpdateRunsClient) stopCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-15-preview") + reqQP.Set("api-version", "2023-08-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header["If-Match"] = []string{*options.IfMatch} diff --git a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/updateruns_client_example_test.go b/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/updateruns_client_example_test.go deleted file mode 100644 index b59e3b96a1c4..000000000000 --- a/sdk/resourcemanager/containerservicefleet/armcontainerservicefleet/updateruns_client_example_test.go +++ /dev/null @@ -1,523 +0,0 @@ -//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. - -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" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/de14cb8751b978b1877597b13292818e80f8c661/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/UpdateRuns_ListByFleet.json -func ExampleUpdateRunsClient_NewListByFleetPager() { - 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.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.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{ - // Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ - // Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), - // KubernetesVersion: to.Ptr("1.26.1"), - // }, - // }, - // 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.UpdateStateNotStarted), - // }, - // 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), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), - // }, - // }}, - // 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"), - // }}, - // }}, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/de14cb8751b978b1877597b13292818e80f8c661/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/UpdateRuns_Get.json -func ExampleUpdateRunsClient_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) - 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.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{ - // Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ - // Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), - // KubernetesVersion: to.Ptr("1.26.1"), - // }, - // }, - // 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.UpdateStateNotStarted), - // }, - // 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), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), - // }, - // }}, - // 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"), - // }}, - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/de14cb8751b978b1877597b13292818e80f8c661/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/UpdateRuns_CreateOrUpdate.json -func ExampleUpdateRunsClient_BeginCreateOrUpdate() { - 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) - } - poller, err := clientFactory.NewUpdateRunsClient().BeginCreateOrUpdate(ctx, "rg1", "fleet1", "run1", armcontainerservicefleet.UpdateRun{ - Properties: &armcontainerservicefleet.UpdateRunProperties{ - ManagedClusterUpdate: &armcontainerservicefleet.ManagedClusterUpdate{ - Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ - Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), - KubernetesVersion: to.Ptr("1.26.1"), - }, - }, - Strategy: &armcontainerservicefleet.UpdateRunStrategy{ - Stages: []*armcontainerservicefleet.UpdateStage{ - { - Name: to.Ptr("stage1"), - AfterStageWaitInSeconds: to.Ptr[int32](3600), - Groups: []*armcontainerservicefleet.UpdateGroup{ - { - Name: to.Ptr("group-a"), - }}, - }}, - }, - }, - }, &armcontainerservicefleet.UpdateRunsClientBeginCreateOrUpdateOptions{IfMatch: nil, - IfNoneMatch: 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{ - // Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ - // Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), - // KubernetesVersion: to.Ptr("1.26.1"), - // }, - // }, - // 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.UpdateStateNotStarted), - // }, - // 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), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), - // }, - // }}, - // Status: &armcontainerservicefleet.UpdateStatus{ - // State: to.Ptr(armcontainerservicefleet.UpdateStateNotStarted), - // }, - // }}, - // 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"), - // }}, - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/de14cb8751b978b1877597b13292818e80f8c661/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/UpdateRuns_Delete.json -func ExampleUpdateRunsClient_BeginDelete() { - 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) - } - poller, err := clientFactory.NewUpdateRunsClient().BeginDelete(ctx, "rg1", "fleet1", "run1", &armcontainerservicefleet.UpdateRunsClientBeginDeleteOptions{IfMatch: nil}) - 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: https://github.com/Azure/azure-rest-api-specs/blob/de14cb8751b978b1877597b13292818e80f8c661/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/UpdateRuns_Start.json -func ExampleUpdateRunsClient_BeginStart() { - 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) - } - poller, err := clientFactory.NewUpdateRunsClient().BeginStart(ctx, "rg1", "fleet1", "run1", &armcontainerservicefleet.UpdateRunsClientBeginStartOptions{IfMatch: 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: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{ - // Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ - // Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), - // KubernetesVersion: to.Ptr("1.26.1"), - // }, - // }, - // 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.UpdateStateNotStarted), - // }, - // 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), - // }, - // }}, - // 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"), - // }}, - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/de14cb8751b978b1877597b13292818e80f8c661/specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2023-03-15-preview/examples/UpdateRuns_Stop.json -func ExampleUpdateRunsClient_BeginStop() { - 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) - } - poller, err := clientFactory.NewUpdateRunsClient().BeginStop(ctx, "rg1", "fleet1", "run1", &armcontainerservicefleet.UpdateRunsClientBeginStopOptions{IfMatch: 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: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{ - // Upgrade: &armcontainerservicefleet.ManagedClusterUpgradeSpec{ - // Type: to.Ptr(armcontainerservicefleet.ManagedClusterUpgradeTypeFull), - // KubernetesVersion: to.Ptr("1.26.1"), - // }, - // }, - // 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.UpdateStateNotStarted), - // }, - // 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), - // }, - // }}, - // 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), - // }, - // }, - // Strategy: &armcontainerservicefleet.UpdateRunStrategy{ - // Stages: []*armcontainerservicefleet.UpdateStage{ - // { - // Name: to.Ptr("stage1"), - // AfterStageWaitInSeconds: to.Ptr[int32](3600), - // Groups: []*armcontainerservicefleet.UpdateGroup{ - // { - // Name: to.Ptr("group-a"), - // }}, - // }}, - // }, - // }, - // } -}