diff --git a/sdk/resourcemanager/chaos/armchaos/CHANGELOG.md b/sdk/resourcemanager/chaos/armchaos/CHANGELOG.md index b26141270559..bb2cbe0492ee 100644 --- a/sdk/resourcemanager/chaos/armchaos/CHANGELOG.md +++ b/sdk/resourcemanager/chaos/armchaos/CHANGELOG.md @@ -1,5 +1,75 @@ # Release History +## 1.0.0 (2023-10-27) +### Breaking Changes + +- Type of `ExperimentProperties.Selectors` has been changed from `[]SelectorClassification` to `[]TargetSelectorClassification` +- Type of `ExperimentProperties.Steps` has been changed from `[]*Step` to `[]*ExperimentStep` +- Function `*Action.GetAction` has been removed +- Function `*ContinuousAction.GetAction` has been removed +- Function `*DelayAction.GetAction` has been removed +- Function `*DiscreteAction.GetAction` has been removed +- Function `*ExperimentsClient.GetExecutionDetails` has been removed +- Function `*ExperimentsClient.GetStatus` has been removed +- Function `*ExperimentsClient.NewListAllStatusesPager` has been removed +- Function `*ExperimentsClient.NewListExecutionDetailsPager` has been removed +- Function `*Filter.GetFilter` has been removed +- Function `*ListSelector.GetSelector` has been removed +- Function `*QuerySelector.GetSelector` has been removed +- Function `*Selector.GetSelector` has been removed +- Function `*SimpleFilter.GetFilter` has been removed +- Operation `*ExperimentsClient.Cancel` has been changed to LRO, use `*ExperimentsClient.BeginCancel` instead. +- Operation `*ExperimentsClient.CreateOrUpdate` has been changed to LRO, use `*ExperimentsClient.BeginCreateOrUpdate` instead. +- Operation `*ExperimentsClient.Delete` has been changed to LRO, use `*ExperimentsClient.BeginDelete` instead. +- Operation `*ExperimentsClient.Start` has been changed to LRO, use `*ExperimentsClient.BeginStart` instead. +- Operation `*ExperimentsClient.Update` has been changed to LRO, use `*ExperimentsClient.BeginUpdate` instead. +- Struct `Branch` has been removed +- Struct `ExperimentCancelOperationResult` has been removed +- Struct `ExperimentExecutionDetailsListResult` has been removed +- Struct `ExperimentStartOperationResult` has been removed +- Struct `ExperimentStatus` has been removed +- Struct `ExperimentStatusListResult` has been removed +- Struct `ExperimentStatusProperties` has been removed +- Struct `ListSelector` has been removed +- Struct `QuerySelector` has been removed +- Struct `SimpleFilter` has been removed +- Struct `SimpleFilterParameters` has been removed +- Struct `Step` has been removed +- Field `CreatedDateTime`, `ExperimentID`, `LastActionDateTime`, `StartDateTime`, `StopDateTime` of struct `ExperimentExecutionDetailsProperties` has been removed +- Field `StartOnCreation` of struct `ExperimentProperties` has been removed + +### Features Added + +- New enum type `ProvisioningState` with values `ProvisioningStateCanceled`, `ProvisioningStateCreating`, `ProvisioningStateDeleting`, `ProvisioningStateFailed`, `ProvisioningStateSucceeded`, `ProvisioningStateUpdating` +- New function `*ClientFactory.NewOperationStatusesClient() *OperationStatusesClient` +- New function `*ContinuousAction.GetExperimentAction() *ExperimentAction` +- New function `*DelayAction.GetExperimentAction() *ExperimentAction` +- New function `*DiscreteAction.GetExperimentAction() *ExperimentAction` +- New function `*ExperimentAction.GetExperimentAction() *ExperimentAction` +- New function `*ExperimentsClient.ExecutionDetails(context.Context, string, string, string, *ExperimentsClientExecutionDetailsOptions) (ExperimentsClientExecutionDetailsResponse, error)` +- New function `*ExperimentsClient.GetExecution(context.Context, string, string, string, *ExperimentsClientGetExecutionOptions) (ExperimentsClientGetExecutionResponse, error)` +- New function `*ExperimentsClient.NewListAllExecutionsPager(string, string, *ExperimentsClientListAllExecutionsOptions) *runtime.Pager[ExperimentsClientListAllExecutionsResponse]` +- New function `NewOperationStatusesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*OperationStatusesClient, error)` +- New function `*OperationStatusesClient.Get(context.Context, string, string, *OperationStatusesClientGetOptions) (OperationStatusesClientGetResponse, error)` +- New function `*TargetFilter.GetTargetFilter() *TargetFilter` +- New function `*TargetListSelector.GetTargetSelector() *TargetSelector` +- New function `*TargetQuerySelector.GetTargetSelector() *TargetSelector` +- New function `*TargetSelector.GetTargetSelector() *TargetSelector` +- New function `*TargetSimpleFilter.GetTargetFilter() *TargetFilter` +- New struct `ExperimentBranch` +- New struct `ExperimentExecution` +- New struct `ExperimentExecutionListResult` +- New struct `ExperimentExecutionProperties` +- New struct `ExperimentStep` +- New struct `OperationStatus` +- New struct `TargetListSelector` +- New struct `TargetQuerySelector` +- New struct `TargetSimpleFilter` +- New struct `TargetSimpleFilterParameters` +- New field `LastActionAt`, `StartedAt`, `StoppedAt` in struct `ExperimentExecutionDetailsProperties` +- New field `ProvisioningState` in struct `ExperimentProperties` + + ## 0.7.0 (2023-08-25) ### Breaking Changes diff --git a/sdk/resourcemanager/chaos/armchaos/autorest.md b/sdk/resourcemanager/chaos/armchaos/autorest.md index 52743cf692b1..05c77eb2dd52 100644 --- a/sdk/resourcemanager/chaos/armchaos/autorest.md +++ b/sdk/resourcemanager/chaos/armchaos/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/chaos/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/chaos/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/chaos/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/chaos/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.7.0 -tag: package-2023-04-15-preview +module-version: 1.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/chaos/armchaos/capabilities_client.go b/sdk/resourcemanager/chaos/armchaos/capabilities_client.go index 58c6c71af5e8..d65a847f58fb 100644 --- a/sdk/resourcemanager/chaos/armchaos/capabilities_client.go +++ b/sdk/resourcemanager/chaos/armchaos/capabilities_client.go @@ -46,7 +46,7 @@ func NewCapabilitiesClient(subscriptionID string, credential azcore.TokenCredent // CreateOrUpdate - Create or update a Capability resource that extends a Target resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-15-preview +// Generated from API version 2023-11-01 // - resourceGroupName - String that represents an Azure resource group. // - parentProviderNamespace - String that represents a resource provider namespace. // - parentResourceType - String that represents a resource type. @@ -110,7 +110,7 @@ func (client *CapabilitiesClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-15-preview") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, capability); err != nil { @@ -131,7 +131,7 @@ func (client *CapabilitiesClient) createOrUpdateHandleResponse(resp *http.Respon // Delete - Delete a Capability that extends a Target resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-15-preview +// Generated from API version 2023-11-01 // - resourceGroupName - String that represents an Azure resource group. // - parentProviderNamespace - String that represents a resource provider namespace. // - parentResourceType - String that represents a resource type. @@ -192,7 +192,7 @@ func (client *CapabilitiesClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-15-preview") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -201,7 +201,7 @@ func (client *CapabilitiesClient) deleteCreateRequest(ctx context.Context, resou // Get - Get a Capability resource that extends a Target resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-15-preview +// Generated from API version 2023-11-01 // - resourceGroupName - String that represents an Azure resource group. // - parentProviderNamespace - String that represents a resource provider namespace. // - parentResourceType - String that represents a resource type. @@ -263,7 +263,7 @@ func (client *CapabilitiesClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-15-preview") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -280,7 +280,7 @@ func (client *CapabilitiesClient) getHandleResponse(resp *http.Response) (Capabi // NewListPager - Get a list of Capability resources that extend a Target resource.. // -// Generated from API version 2023-04-15-preview +// Generated from API version 2023-11-01 // - resourceGroupName - String that represents an Azure resource group. // - parentProviderNamespace - String that represents a resource provider namespace. // - parentResourceType - String that represents a resource type. @@ -347,7 +347,7 @@ func (client *CapabilitiesClient) listCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-15-preview") + reqQP.Set("api-version", "2023-11-01") if options != nil && options.ContinuationToken != nil { reqQP.Set("continuationToken", *options.ContinuationToken) } diff --git a/sdk/resourcemanager/chaos/armchaos/capabilities_client_example_test.go b/sdk/resourcemanager/chaos/armchaos/capabilities_client_example_test.go deleted file mode 100644 index b8ad5531f719..000000000000 --- a/sdk/resourcemanager/chaos/armchaos/capabilities_client_example_test.go +++ /dev/null @@ -1,153 +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 armchaos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListCapabilities.json -func ExampleCapabilitiesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCapabilitiesClient().NewListPager("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-VirtualMachine", &armchaos.CapabilitiesClientListOptions{ContinuationToken: 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.CapabilityListResult = armchaos.CapabilityListResult{ - // Value: []*armchaos.Capability{ - // { - // Name: to.Ptr("Shutdown-1.0"), - // Type: to.Ptr("Microsoft.Chaos/targets/capabilities"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0"), - // Properties: &armchaos.CapabilityProperties{ - // Description: to.Ptr("Shutdown an Azure Virtual Machine for a defined period of time."), - // ParametersSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json"), - // Publisher: to.Ptr("Microsoft"), - // TargetType: to.Ptr("VirtualMachine"), - // Urn: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"), - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-14T05:08:38.4662189Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-14T05:08:38.4662189Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetACapability.json -func ExampleCapabilitiesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCapabilitiesClient().Get(ctx, "exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-VirtualMachine", "Shutdown-1.0", 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.Capability = armchaos.Capability{ - // Name: to.Ptr("Shutdown-1.0"), - // Type: to.Ptr("Microsoft.Chaos/targets/capabilities"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0"), - // Properties: &armchaos.CapabilityProperties{ - // Description: to.Ptr("Shutdown an Azure Virtual Machine for a defined period of time."), - // ParametersSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json"), - // Publisher: to.Ptr("Microsoft"), - // TargetType: to.Ptr("VirtualMachine"), - // Urn: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"), - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-14T05:08:38.4662189Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-14T05:08:38.4662189Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/DeleteACapability.json -func ExampleCapabilitiesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewCapabilitiesClient().Delete(ctx, "exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-VirtualMachine", "Shutdown-1.0", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/CreateOrUpdateACapability.json -func ExampleCapabilitiesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCapabilitiesClient().CreateOrUpdate(ctx, "exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-VirtualMachine", "Shutdown-1.0", armchaos.Capability{ - Properties: &armchaos.CapabilityProperties{}, - }, 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.Capability = armchaos.Capability{ - // Name: to.Ptr("Shutdown-1.0"), - // Type: to.Ptr("Microsoft.Chaos/targets/capabilities"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0"), - // Properties: &armchaos.CapabilityProperties{ - // Description: to.Ptr("Shutdown an Azure Virtual Machine for a defined period of time."), - // ParametersSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json"), - // Publisher: to.Ptr("Microsoft"), - // TargetType: to.Ptr("VirtualMachine"), - // Urn: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"), - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-14T05:08:38.4662189Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-14T05:08:38.4662189Z"); return t}()), - // }, - // } -} diff --git a/sdk/resourcemanager/chaos/armchaos/capabilitytypes_client.go b/sdk/resourcemanager/chaos/armchaos/capabilitytypes_client.go index 1771d451e549..36f2d7c023b0 100644 --- a/sdk/resourcemanager/chaos/armchaos/capabilitytypes_client.go +++ b/sdk/resourcemanager/chaos/armchaos/capabilitytypes_client.go @@ -46,7 +46,7 @@ func NewCapabilityTypesClient(subscriptionID string, credential azcore.TokenCred // Get - Get a Capability Type resource for given Target Type and location. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-15-preview +// Generated from API version 2023-11-01 // - locationName - String that represents a Location resource name. // - targetTypeName - String that represents a Target Type resource name. // - capabilityTypeName - String that represents a Capability Type resource name. @@ -93,7 +93,7 @@ func (client *CapabilityTypesClient) getCreateRequest(ctx context.Context, locat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-15-preview") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -110,7 +110,7 @@ func (client *CapabilityTypesClient) getHandleResponse(resp *http.Response) (Cap // NewListPager - Get a list of Capability Type resources for given Target Type and location. // -// Generated from API version 2023-04-15-preview +// Generated from API version 2023-11-01 // - locationName - String that represents a Location resource name. // - targetTypeName - String that represents a Target Type resource name. // - options - CapabilityTypesClientListOptions contains the optional parameters for the CapabilityTypesClient.NewListPager @@ -163,7 +163,7 @@ func (client *CapabilityTypesClient) listCreateRequest(ctx context.Context, loca return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-15-preview") + reqQP.Set("api-version", "2023-11-01") if options != nil && options.ContinuationToken != nil { reqQP.Set("continuationToken", *options.ContinuationToken) } diff --git a/sdk/resourcemanager/chaos/armchaos/capabilitytypes_client_example_test.go b/sdk/resourcemanager/chaos/armchaos/capabilitytypes_client_example_test.go deleted file mode 100644 index f17c8f3053bd..000000000000 --- a/sdk/resourcemanager/chaos/armchaos/capabilitytypes_client_example_test.go +++ /dev/null @@ -1,100 +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 armchaos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListCapabilityTypes.json -func ExampleCapabilityTypesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCapabilityTypesClient().NewListPager("westus2", "Microsoft-VirtualMachine", &armchaos.CapabilityTypesClientListOptions{ContinuationToken: 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.CapabilityTypeListResult = armchaos.CapabilityTypeListResult{ - // Value: []*armchaos.CapabilityType{ - // { - // Name: to.Ptr("Shutdown-1.0"), - // Type: to.Ptr("Microsoft.Chaos/locations/targetTypes/capabilityTypes"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/providers/Microsoft.Chaos/locations/westus2/targetTypes/Microsoft-VirtualMachine/capabilityTypes/Shutdown-1.0"), - // Properties: &armchaos.CapabilityTypeProperties{ - // Description: to.Ptr("Shutdown an Azure Virtual Machine for a defined period of time."), - // DisplayName: to.Ptr("Shutdown VM"), - // Kind: to.Ptr("fault"), - // ParametersSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json"), - // Publisher: to.Ptr("Microsoft"), - // RuntimeProperties: &armchaos.CapabilityTypePropertiesRuntimeProperties{ - // Kind: to.Ptr("continuous"), - // }, - // TargetType: to.Ptr("VirtualMachine"), - // Urn: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetACapabilityType.json -func ExampleCapabilityTypesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCapabilityTypesClient().Get(ctx, "westus2", "Microsoft-VirtualMachine", "Shutdown-1.0", 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.CapabilityType = armchaos.CapabilityType{ - // Name: to.Ptr("Shutdown-1.0"), - // Type: to.Ptr("Microsoft.Chaos/locations/targetTypes/capabilityTypes"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/Microsoft.Chaos/locations/westus2/targetTypes/Microsoft-VirtualMachine/capabilityTypes/Shutdown-1.0"), - // Properties: &armchaos.CapabilityTypeProperties{ - // Description: to.Ptr("Shutdown an Azure Virtual Machine for a defined period of time."), - // DisplayName: to.Ptr("Shutdown VM"), - // Kind: to.Ptr("fault"), - // ParametersSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json"), - // Publisher: to.Ptr("Microsoft"), - // RuntimeProperties: &armchaos.CapabilityTypePropertiesRuntimeProperties{ - // Kind: to.Ptr("continuous"), - // }, - // TargetType: to.Ptr("VirtualMachine"), - // Urn: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"), - // }, - // } -} diff --git a/sdk/resourcemanager/chaos/armchaos/client_factory.go b/sdk/resourcemanager/chaos/armchaos/client_factory.go index b514bb8579e8..0da110ec2202 100644 --- a/sdk/resourcemanager/chaos/armchaos/client_factory.go +++ b/sdk/resourcemanager/chaos/armchaos/client_factory.go @@ -52,6 +52,11 @@ func (c *ClientFactory) NewExperimentsClient() *ExperimentsClient { return subClient } +func (c *ClientFactory) NewOperationStatusesClient() *OperationStatusesClient { + subClient, _ := NewOperationStatusesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + func (c *ClientFactory) NewOperationsClient() *OperationsClient { subClient, _ := NewOperationsClient(c.credential, c.options) return subClient diff --git a/sdk/resourcemanager/chaos/armchaos/constants.go b/sdk/resourcemanager/chaos/armchaos/constants.go index 319b8742894c..226adadd103e 100644 --- a/sdk/resourcemanager/chaos/armchaos/constants.go +++ b/sdk/resourcemanager/chaos/armchaos/constants.go @@ -10,7 +10,7 @@ package armchaos const ( moduleName = "armchaos" - moduleVersion = "v0.7.0" + moduleVersion = "v1.0.0" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -80,6 +80,30 @@ func PossibleOriginValues() []Origin { } } +// ProvisioningState - Current provisioning state for a given Azure Chaos resource. +type ProvisioningState string + +const ( + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreating ProvisioningState = "Creating" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateCanceled, + ProvisioningStateCreating, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, + } +} + // ResourceIdentityType - String of the resource identity type. type ResourceIdentityType string diff --git a/sdk/resourcemanager/chaos/armchaos/experiments_client.go b/sdk/resourcemanager/chaos/armchaos/experiments_client.go index e22bc98b7425..82ddcf74b3fd 100644 --- a/sdk/resourcemanager/chaos/armchaos/experiments_client.go +++ b/sdk/resourcemanager/chaos/armchaos/experiments_client.go @@ -44,33 +44,51 @@ func NewExperimentsClient(subscriptionID string, credential azcore.TokenCredenti return client, nil } -// Cancel - Cancel a running Experiment resource. +// BeginCancel - Cancel a running Experiment resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-15-preview +// Generated from API version 2023-11-01 // - resourceGroupName - String that represents an Azure resource group. // - experimentName - String that represents a Experiment resource name. -// - options - ExperimentsClientCancelOptions contains the optional parameters for the ExperimentsClient.Cancel method. -func (client *ExperimentsClient) Cancel(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientCancelOptions) (ExperimentsClientCancelResponse, error) { +// - options - ExperimentsClientBeginCancelOptions contains the optional parameters for the ExperimentsClient.BeginCancel method. +func (client *ExperimentsClient) BeginCancel(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientBeginCancelOptions) (*runtime.Poller[ExperimentsClientCancelResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.cancel(ctx, resourceGroupName, experimentName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExperimentsClientCancelResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExperimentsClientCancelResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// Cancel - Cancel a running Experiment resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +func (client *ExperimentsClient) cancel(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientBeginCancelOptions) (*http.Response, error) { var err error req, err := client.cancelCreateRequest(ctx, resourceGroupName, experimentName, options) if err != nil { - return ExperimentsClientCancelResponse{}, err + return nil, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return ExperimentsClientCancelResponse{}, err + return nil, err } if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { err = runtime.NewResponseError(httpResp) - return ExperimentsClientCancelResponse{}, err + return nil, err } - resp, err := client.cancelHandleResponse(httpResp) - return resp, err + return httpResp, nil } // cancelCreateRequest creates the Cancel request. -func (client *ExperimentsClient) cancelCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientCancelOptions) (*policy.Request, error) { +func (client *ExperimentsClient) cancelCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientBeginCancelOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/cancel" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -89,50 +107,59 @@ func (client *ExperimentsClient) cancelCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-15-preview") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// cancelHandleResponse handles the Cancel response. -func (client *ExperimentsClient) cancelHandleResponse(resp *http.Response) (ExperimentsClientCancelResponse, error) { - result := ExperimentsClientCancelResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ExperimentCancelOperationResult); err != nil { - return ExperimentsClientCancelResponse{}, err - } - return result, nil -} - -// CreateOrUpdate - Create or update a Experiment resource. +// BeginCreateOrUpdate - Create or update a Experiment resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-15-preview +// Generated from API version 2023-11-01 // - resourceGroupName - String that represents an Azure resource group. // - experimentName - String that represents a Experiment resource name. // - experiment - Experiment resource to be created or updated. -// - options - ExperimentsClientCreateOrUpdateOptions contains the optional parameters for the ExperimentsClient.CreateOrUpdate +// - options - ExperimentsClientBeginCreateOrUpdateOptions contains the optional parameters for the ExperimentsClient.BeginCreateOrUpdate // method. -func (client *ExperimentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, experimentName string, experiment Experiment, options *ExperimentsClientCreateOrUpdateOptions) (ExperimentsClientCreateOrUpdateResponse, error) { +func (client *ExperimentsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, experimentName string, experiment Experiment, options *ExperimentsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ExperimentsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, experimentName, experiment, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExperimentsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExperimentsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + } +} + +// CreateOrUpdate - Create or update a Experiment resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +func (client *ExperimentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, experimentName string, experiment Experiment, options *ExperimentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, experimentName, experiment, options) if err != nil { - return ExperimentsClientCreateOrUpdateResponse{}, err + return nil, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return ExperimentsClientCreateOrUpdateResponse{}, err + return nil, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { err = runtime.NewResponseError(httpResp) - return ExperimentsClientCreateOrUpdateResponse{}, err + return nil, err } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err + return httpResp, nil } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ExperimentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, experiment Experiment, options *ExperimentsClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ExperimentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, experiment Experiment, options *ExperimentsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -151,7 +178,7 @@ func (client *ExperimentsClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-15-preview") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, experiment); err != nil { @@ -160,41 +187,51 @@ func (client *ExperimentsClient) createOrUpdateCreateRequest(ctx context.Context return req, nil } -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *ExperimentsClient) createOrUpdateHandleResponse(resp *http.Response) (ExperimentsClientCreateOrUpdateResponse, error) { - result := ExperimentsClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Experiment); err != nil { - return ExperimentsClientCreateOrUpdateResponse{}, err +// BeginDelete - Delete a Experiment resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - String that represents an Azure resource group. +// - experimentName - String that represents a Experiment resource name. +// - options - ExperimentsClientBeginDeleteOptions contains the optional parameters for the ExperimentsClient.BeginDelete method. +func (client *ExperimentsClient) BeginDelete(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientBeginDeleteOptions) (*runtime.Poller[ExperimentsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, experimentName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExperimentsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExperimentsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) } - return result, nil } // Delete - Delete a Experiment resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-15-preview -// - resourceGroupName - String that represents an Azure resource group. -// - experimentName - String that represents a Experiment resource name. -// - options - ExperimentsClientDeleteOptions contains the optional parameters for the ExperimentsClient.Delete method. -func (client *ExperimentsClient) Delete(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientDeleteOptions) (ExperimentsClientDeleteResponse, error) { +// Generated from API version 2023-11-01 +func (client *ExperimentsClient) deleteOperation(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientBeginDeleteOptions) (*http.Response, error) { var err error req, err := client.deleteCreateRequest(ctx, resourceGroupName, experimentName, options) if err != nil { - return ExperimentsClientDeleteResponse{}, err + return nil, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return ExperimentsClientDeleteResponse{}, err + return nil, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { err = runtime.NewResponseError(httpResp) - return ExperimentsClientDeleteResponse{}, err + return nil, err } - return ExperimentsClientDeleteResponse{}, nil + return httpResp, nil } // deleteCreateRequest creates the Delete request. -func (client *ExperimentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientDeleteOptions) (*policy.Request, error) { +func (client *ExperimentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -213,40 +250,42 @@ func (client *ExperimentsClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-15-preview") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// Get - Get a Experiment resource. +// ExecutionDetails - Execution details of an experiment resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-15-preview +// Generated from API version 2023-11-01 // - resourceGroupName - String that represents an Azure resource group. // - experimentName - String that represents a Experiment resource name. -// - options - ExperimentsClientGetOptions contains the optional parameters for the ExperimentsClient.Get method. -func (client *ExperimentsClient) Get(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientGetOptions) (ExperimentsClientGetResponse, error) { +// - executionID - GUID that represents a Experiment execution detail. +// - options - ExperimentsClientExecutionDetailsOptions contains the optional parameters for the ExperimentsClient.ExecutionDetails +// method. +func (client *ExperimentsClient) ExecutionDetails(ctx context.Context, resourceGroupName string, experimentName string, executionID string, options *ExperimentsClientExecutionDetailsOptions) (ExperimentsClientExecutionDetailsResponse, error) { var err error - req, err := client.getCreateRequest(ctx, resourceGroupName, experimentName, options) + req, err := client.executionDetailsCreateRequest(ctx, resourceGroupName, experimentName, executionID, options) if err != nil { - return ExperimentsClientGetResponse{}, err + return ExperimentsClientExecutionDetailsResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return ExperimentsClientGetResponse{}, err + return ExperimentsClientExecutionDetailsResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return ExperimentsClientGetResponse{}, err + return ExperimentsClientExecutionDetailsResponse{}, err } - resp, err := client.getHandleResponse(httpResp) + resp, err := client.executionDetailsHandleResponse(httpResp) return resp, err } -// getCreateRequest creates the Get request. -func (client *ExperimentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}" +// executionDetailsCreateRequest creates the ExecutionDetails request. +func (client *ExperimentsClient) executionDetailsCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, executionID string, options *ExperimentsClientExecutionDetailsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions/{executionId}/getExecutionDetails" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -259,56 +298,58 @@ func (client *ExperimentsClient) getCreateRequest(ctx context.Context, resourceG return nil, errors.New("parameter experimentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{experimentName}", url.PathEscape(experimentName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if executionID == "" { + return nil, errors.New("parameter executionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{executionId}", url.PathEscape(executionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-15-preview") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// getHandleResponse handles the Get response. -func (client *ExperimentsClient) getHandleResponse(resp *http.Response) (ExperimentsClientGetResponse, error) { - result := ExperimentsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Experiment); err != nil { - return ExperimentsClientGetResponse{}, err +// executionDetailsHandleResponse handles the ExecutionDetails response. +func (client *ExperimentsClient) executionDetailsHandleResponse(resp *http.Response) (ExperimentsClientExecutionDetailsResponse, error) { + result := ExperimentsClientExecutionDetailsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExperimentExecutionDetails); err != nil { + return ExperimentsClientExecutionDetailsResponse{}, err } return result, nil } -// GetExecutionDetails - Get an execution detail of a Experiment resource. +// Get - Get a Experiment resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-15-preview +// Generated from API version 2023-11-01 // - resourceGroupName - String that represents an Azure resource group. // - experimentName - String that represents a Experiment resource name. -// - executionDetailsID - GUID that represents a Experiment execution detail. -// - options - ExperimentsClientGetExecutionDetailsOptions contains the optional parameters for the ExperimentsClient.GetExecutionDetails -// method. -func (client *ExperimentsClient) GetExecutionDetails(ctx context.Context, resourceGroupName string, experimentName string, executionDetailsID string, options *ExperimentsClientGetExecutionDetailsOptions) (ExperimentsClientGetExecutionDetailsResponse, error) { +// - options - ExperimentsClientGetOptions contains the optional parameters for the ExperimentsClient.Get method. +func (client *ExperimentsClient) Get(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientGetOptions) (ExperimentsClientGetResponse, error) { var err error - req, err := client.getExecutionDetailsCreateRequest(ctx, resourceGroupName, experimentName, executionDetailsID, options) + req, err := client.getCreateRequest(ctx, resourceGroupName, experimentName, options) if err != nil { - return ExperimentsClientGetExecutionDetailsResponse{}, err + return ExperimentsClientGetResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return ExperimentsClientGetExecutionDetailsResponse{}, err + return ExperimentsClientGetResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return ExperimentsClientGetExecutionDetailsResponse{}, err + return ExperimentsClientGetResponse{}, err } - resp, err := client.getExecutionDetailsHandleResponse(httpResp) + resp, err := client.getHandleResponse(httpResp) return resp, err } -// getExecutionDetailsCreateRequest creates the GetExecutionDetails request. -func (client *ExperimentsClient) getExecutionDetailsCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, executionDetailsID string, options *ExperimentsClientGetExecutionDetailsOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executionDetails/{executionDetailsId}" +// getCreateRequest creates the Get request. +func (client *ExperimentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -321,59 +362,56 @@ func (client *ExperimentsClient) getExecutionDetailsCreateRequest(ctx context.Co return nil, errors.New("parameter experimentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{experimentName}", url.PathEscape(experimentName)) - if executionDetailsID == "" { - return nil, errors.New("parameter executionDetailsID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{executionDetailsId}", url.PathEscape(executionDetailsID)) 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-04-15-preview") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// getExecutionDetailsHandleResponse handles the GetExecutionDetails response. -func (client *ExperimentsClient) getExecutionDetailsHandleResponse(resp *http.Response) (ExperimentsClientGetExecutionDetailsResponse, error) { - result := ExperimentsClientGetExecutionDetailsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ExperimentExecutionDetails); err != nil { - return ExperimentsClientGetExecutionDetailsResponse{}, err +// getHandleResponse handles the Get response. +func (client *ExperimentsClient) getHandleResponse(resp *http.Response) (ExperimentsClientGetResponse, error) { + result := ExperimentsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Experiment); err != nil { + return ExperimentsClientGetResponse{}, err } return result, nil } -// GetStatus - Get a status of a Experiment resource. +// GetExecution - Get an execution of an Experiment resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-15-preview +// Generated from API version 2023-11-01 // - resourceGroupName - String that represents an Azure resource group. // - experimentName - String that represents a Experiment resource name. -// - statusID - GUID that represents a Experiment status. -// - options - ExperimentsClientGetStatusOptions contains the optional parameters for the ExperimentsClient.GetStatus method. -func (client *ExperimentsClient) GetStatus(ctx context.Context, resourceGroupName string, experimentName string, statusID string, options *ExperimentsClientGetStatusOptions) (ExperimentsClientGetStatusResponse, error) { +// - executionID - GUID that represents a Experiment execution detail. +// - options - ExperimentsClientGetExecutionOptions contains the optional parameters for the ExperimentsClient.GetExecution +// method. +func (client *ExperimentsClient) GetExecution(ctx context.Context, resourceGroupName string, experimentName string, executionID string, options *ExperimentsClientGetExecutionOptions) (ExperimentsClientGetExecutionResponse, error) { var err error - req, err := client.getStatusCreateRequest(ctx, resourceGroupName, experimentName, statusID, options) + req, err := client.getExecutionCreateRequest(ctx, resourceGroupName, experimentName, executionID, options) if err != nil { - return ExperimentsClientGetStatusResponse{}, err + return ExperimentsClientGetExecutionResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return ExperimentsClientGetStatusResponse{}, err + return ExperimentsClientGetExecutionResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return ExperimentsClientGetStatusResponse{}, err + return ExperimentsClientGetExecutionResponse{}, err } - resp, err := client.getStatusHandleResponse(httpResp) + resp, err := client.getExecutionHandleResponse(httpResp) return resp, err } -// getStatusCreateRequest creates the GetStatus request. -func (client *ExperimentsClient) getStatusCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, statusID string, options *ExperimentsClientGetStatusOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/statuses/{statusId}" +// getExecutionCreateRequest creates the GetExecution request. +func (client *ExperimentsClient) getExecutionCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, executionID string, options *ExperimentsClientGetExecutionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions/{executionId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -386,33 +424,33 @@ func (client *ExperimentsClient) getStatusCreateRequest(ctx context.Context, res return nil, errors.New("parameter experimentName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{experimentName}", url.PathEscape(experimentName)) - if statusID == "" { - return nil, errors.New("parameter statusID cannot be empty") + if executionID == "" { + return nil, errors.New("parameter executionID cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{statusId}", url.PathEscape(statusID)) + urlPath = strings.ReplaceAll(urlPath, "{executionId}", url.PathEscape(executionID)) 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-04-15-preview") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// getStatusHandleResponse handles the GetStatus response. -func (client *ExperimentsClient) getStatusHandleResponse(resp *http.Response) (ExperimentsClientGetStatusResponse, error) { - result := ExperimentsClientGetStatusResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ExperimentStatus); err != nil { - return ExperimentsClientGetStatusResponse{}, err +// getExecutionHandleResponse handles the GetExecution response. +func (client *ExperimentsClient) getExecutionHandleResponse(resp *http.Response) (ExperimentsClientGetExecutionResponse, error) { + result := ExperimentsClientGetExecutionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExperimentExecution); err != nil { + return ExperimentsClientGetExecutionResponse{}, err } return result, nil } // NewListPager - Get a list of Experiment resources in a resource group. // -// Generated from API version 2023-04-15-preview +// Generated from API version 2023-11-01 // - resourceGroupName - String that represents an Azure resource group. // - options - ExperimentsClientListOptions contains the optional parameters for the ExperimentsClient.NewListPager method. func (client *ExperimentsClient) NewListPager(resourceGroupName string, options *ExperimentsClientListOptions) *runtime.Pager[ExperimentsClientListResponse] { @@ -459,7 +497,7 @@ func (client *ExperimentsClient) listCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-15-preview") + reqQP.Set("api-version", "2023-11-01") if options != nil && options.Running != nil { reqQP.Set("running", strconv.FormatBool(*options.Running)) } @@ -482,7 +520,7 @@ func (client *ExperimentsClient) listHandleResponse(resp *http.Response) (Experi // NewListAllPager - Get a list of Experiment resources in a subscription. // -// Generated from API version 2023-04-15-preview +// Generated from API version 2023-11-01 // - options - ExperimentsClientListAllOptions contains the optional parameters for the ExperimentsClient.NewListAllPager method. func (client *ExperimentsClient) NewListAllPager(options *ExperimentsClientListAllOptions) *runtime.Pager[ExperimentsClientListAllResponse] { return runtime.NewPager(runtime.PagingHandler[ExperimentsClientListAllResponse]{ @@ -524,7 +562,7 @@ func (client *ExperimentsClient) listAllCreateRequest(ctx context.Context, optio return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-15-preview") + reqQP.Set("api-version", "2023-11-01") if options != nil && options.Running != nil { reqQP.Set("running", strconv.FormatBool(*options.Running)) } @@ -545,44 +583,44 @@ func (client *ExperimentsClient) listAllHandleResponse(resp *http.Response) (Exp return result, nil } -// NewListAllStatusesPager - Get a list of statuses of a Experiment resource. +// NewListAllExecutionsPager - Get a list of executions of an Experiment resource. // -// Generated from API version 2023-04-15-preview +// Generated from API version 2023-11-01 // - resourceGroupName - String that represents an Azure resource group. // - experimentName - String that represents a Experiment resource name. -// - options - ExperimentsClientListAllStatusesOptions contains the optional parameters for the ExperimentsClient.NewListAllStatusesPager +// - options - ExperimentsClientListAllExecutionsOptions contains the optional parameters for the ExperimentsClient.NewListAllExecutionsPager // method. -func (client *ExperimentsClient) NewListAllStatusesPager(resourceGroupName string, experimentName string, options *ExperimentsClientListAllStatusesOptions) *runtime.Pager[ExperimentsClientListAllStatusesResponse] { - return runtime.NewPager(runtime.PagingHandler[ExperimentsClientListAllStatusesResponse]{ - More: func(page ExperimentsClientListAllStatusesResponse) bool { +func (client *ExperimentsClient) NewListAllExecutionsPager(resourceGroupName string, experimentName string, options *ExperimentsClientListAllExecutionsOptions) *runtime.Pager[ExperimentsClientListAllExecutionsResponse] { + return runtime.NewPager(runtime.PagingHandler[ExperimentsClientListAllExecutionsResponse]{ + More: func(page ExperimentsClientListAllExecutionsResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *ExperimentsClientListAllStatusesResponse) (ExperimentsClientListAllStatusesResponse, error) { + Fetcher: func(ctx context.Context, page *ExperimentsClientListAllExecutionsResponse) (ExperimentsClientListAllExecutionsResponse, error) { var req *policy.Request var err error if page == nil { - req, err = client.listAllStatusesCreateRequest(ctx, resourceGroupName, experimentName, options) + req, err = client.listAllExecutionsCreateRequest(ctx, resourceGroupName, experimentName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } if err != nil { - return ExperimentsClientListAllStatusesResponse{}, err + return ExperimentsClientListAllExecutionsResponse{}, err } resp, err := client.internal.Pipeline().Do(req) if err != nil { - return ExperimentsClientListAllStatusesResponse{}, err + return ExperimentsClientListAllExecutionsResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { - return ExperimentsClientListAllStatusesResponse{}, runtime.NewResponseError(resp) + return ExperimentsClientListAllExecutionsResponse{}, runtime.NewResponseError(resp) } - return client.listAllStatusesHandleResponse(resp) + return client.listAllExecutionsHandleResponse(resp) }, }) } -// listAllStatusesCreateRequest creates the ListAllStatuses request. -func (client *ExperimentsClient) listAllStatusesCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientListAllStatusesOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/statuses" +// listAllExecutionsCreateRequest creates the ListAllExecutions request. +func (client *ExperimentsClient) listAllExecutionsCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientListAllExecutionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -600,118 +638,66 @@ func (client *ExperimentsClient) listAllStatusesCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-15-preview") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// listAllStatusesHandleResponse handles the ListAllStatuses response. -func (client *ExperimentsClient) listAllStatusesHandleResponse(resp *http.Response) (ExperimentsClientListAllStatusesResponse, error) { - result := ExperimentsClientListAllStatusesResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ExperimentStatusListResult); err != nil { - return ExperimentsClientListAllStatusesResponse{}, err +// listAllExecutionsHandleResponse handles the ListAllExecutions response. +func (client *ExperimentsClient) listAllExecutionsHandleResponse(resp *http.Response) (ExperimentsClientListAllExecutionsResponse, error) { + result := ExperimentsClientListAllExecutionsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExperimentExecutionListResult); err != nil { + return ExperimentsClientListAllExecutionsResponse{}, err } return result, nil } -// NewListExecutionDetailsPager - Get a list of execution details of a Experiment resource. +// BeginStart - Start a Experiment resource. +// If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-15-preview +// Generated from API version 2023-11-01 // - resourceGroupName - String that represents an Azure resource group. // - experimentName - String that represents a Experiment resource name. -// - options - ExperimentsClientListExecutionDetailsOptions contains the optional parameters for the ExperimentsClient.NewListExecutionDetailsPager -// method. -func (client *ExperimentsClient) NewListExecutionDetailsPager(resourceGroupName string, experimentName string, options *ExperimentsClientListExecutionDetailsOptions) *runtime.Pager[ExperimentsClientListExecutionDetailsResponse] { - return runtime.NewPager(runtime.PagingHandler[ExperimentsClientListExecutionDetailsResponse]{ - More: func(page ExperimentsClientListExecutionDetailsResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ExperimentsClientListExecutionDetailsResponse) (ExperimentsClientListExecutionDetailsResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listExecutionDetailsCreateRequest(ctx, resourceGroupName, experimentName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ExperimentsClientListExecutionDetailsResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ExperimentsClientListExecutionDetailsResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ExperimentsClientListExecutionDetailsResponse{}, runtime.NewResponseError(resp) - } - return client.listExecutionDetailsHandleResponse(resp) - }, - }) -} - -// listExecutionDetailsCreateRequest creates the ListExecutionDetails request. -func (client *ExperimentsClient) listExecutionDetailsCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientListExecutionDetailsOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executionDetails" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") +// - options - ExperimentsClientBeginStartOptions contains the optional parameters for the ExperimentsClient.BeginStart method. +func (client *ExperimentsClient) BeginStart(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientBeginStartOptions) (*runtime.Poller[ExperimentsClientStartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.start(ctx, resourceGroupName, experimentName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExperimentsClientStartResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExperimentsClientStartResponse](options.ResumeToken, client.internal.Pipeline(), nil) } - 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 experimentName == "" { - return nil, errors.New("parameter experimentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{experimentName}", url.PathEscape(experimentName)) - 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-04-15-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listExecutionDetailsHandleResponse handles the ListExecutionDetails response. -func (client *ExperimentsClient) listExecutionDetailsHandleResponse(resp *http.Response) (ExperimentsClientListExecutionDetailsResponse, error) { - result := ExperimentsClientListExecutionDetailsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ExperimentExecutionDetailsListResult); err != nil { - return ExperimentsClientListExecutionDetailsResponse{}, err - } - return result, nil } // Start - Start a Experiment resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-15-preview -// - resourceGroupName - String that represents an Azure resource group. -// - experimentName - String that represents a Experiment resource name. -// - options - ExperimentsClientStartOptions contains the optional parameters for the ExperimentsClient.Start method. -func (client *ExperimentsClient) Start(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientStartOptions) (ExperimentsClientStartResponse, error) { +// Generated from API version 2023-11-01 +func (client *ExperimentsClient) start(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientBeginStartOptions) (*http.Response, error) { var err error req, err := client.startCreateRequest(ctx, resourceGroupName, experimentName, options) if err != nil { - return ExperimentsClientStartResponse{}, err + return nil, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return ExperimentsClientStartResponse{}, err + return nil, err } if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { err = runtime.NewResponseError(httpResp) - return ExperimentsClientStartResponse{}, err + return nil, err } - resp, err := client.startHandleResponse(httpResp) - return resp, err + return httpResp, nil } // startCreateRequest creates the Start request. -func (client *ExperimentsClient) startCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientStartOptions) (*policy.Request, error) { +func (client *ExperimentsClient) startCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientBeginStartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/start" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -730,49 +716,58 @@ func (client *ExperimentsClient) startCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-15-preview") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// startHandleResponse handles the Start response. -func (client *ExperimentsClient) startHandleResponse(resp *http.Response) (ExperimentsClientStartResponse, error) { - result := ExperimentsClientStartResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ExperimentStartOperationResult); err != nil { - return ExperimentsClientStartResponse{}, err +// BeginUpdate - The operation to update an experiment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - String that represents an Azure resource group. +// - experimentName - String that represents a Experiment resource name. +// - experiment - Parameters supplied to the Update experiment operation. +// - options - ExperimentsClientBeginUpdateOptions contains the optional parameters for the ExperimentsClient.BeginUpdate method. +func (client *ExperimentsClient) BeginUpdate(ctx context.Context, resourceGroupName string, experimentName string, experiment ExperimentUpdate, options *ExperimentsClientBeginUpdateOptions) (*runtime.Poller[ExperimentsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, experimentName, experiment, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExperimentsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken[ExperimentsClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) } - return result, nil } // Update - The operation to update an experiment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-15-preview -// - resourceGroupName - String that represents an Azure resource group. -// - experimentName - String that represents a Experiment resource name. -// - experiment - Parameters supplied to the Update experiment operation. -// - options - ExperimentsClientUpdateOptions contains the optional parameters for the ExperimentsClient.Update method. -func (client *ExperimentsClient) Update(ctx context.Context, resourceGroupName string, experimentName string, experiment ExperimentUpdate, options *ExperimentsClientUpdateOptions) (ExperimentsClientUpdateResponse, error) { +// Generated from API version 2023-11-01 +func (client *ExperimentsClient) update(ctx context.Context, resourceGroupName string, experimentName string, experiment ExperimentUpdate, options *ExperimentsClientBeginUpdateOptions) (*http.Response, error) { var err error req, err := client.updateCreateRequest(ctx, resourceGroupName, experimentName, experiment, options) if err != nil { - return ExperimentsClientUpdateResponse{}, err + return nil, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return ExperimentsClientUpdateResponse{}, err + return nil, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { err = runtime.NewResponseError(httpResp) - return ExperimentsClientUpdateResponse{}, err + return nil, err } - resp, err := client.updateHandleResponse(httpResp) - return resp, err + return httpResp, nil } // updateCreateRequest creates the Update request. -func (client *ExperimentsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, experiment ExperimentUpdate, options *ExperimentsClientUpdateOptions) (*policy.Request, error) { +func (client *ExperimentsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, experiment ExperimentUpdate, options *ExperimentsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -791,7 +786,7 @@ func (client *ExperimentsClient) updateCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-15-preview") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, experiment); err != nil { @@ -799,12 +794,3 @@ func (client *ExperimentsClient) updateCreateRequest(ctx context.Context, resour } return req, nil } - -// updateHandleResponse handles the Update response. -func (client *ExperimentsClient) updateHandleResponse(resp *http.Response) (ExperimentsClientUpdateResponse, error) { - result := ExperimentsClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Experiment); err != nil { - return ExperimentsClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/chaos/armchaos/experiments_client_example_test.go b/sdk/resourcemanager/chaos/armchaos/experiments_client_example_test.go deleted file mode 100644 index ae8caf7e74fe..000000000000 --- a/sdk/resourcemanager/chaos/armchaos/experiments_client_example_test.go +++ /dev/null @@ -1,744 +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 armchaos_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/chaos/armchaos" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListExperimentsInASubscription.json -func ExampleExperimentsClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExperimentsClient().NewListAllPager(&armchaos.ExperimentsClientListAllOptions{Running: nil, - ContinuationToken: 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.ExperimentListResult = armchaos.ExperimentListResult{ - // Value: []*armchaos.Experiment{ - // { - // Name: to.Ptr("exampleExperiment"), - // Type: to.Ptr("Microsoft.Chaos/experiments"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment"), - // Location: to.Ptr("centraluseuap"), - // Identity: &armchaos.ResourceIdentity{ - // Type: to.Ptr(armchaos.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("d04ab567-2c07-43ef-a7f4-4527626b7f56"), - // TenantID: to.Ptr("8c3e2fb2-fe7a-4bf1-b779-d73990782fe6"), - // }, - // Properties: &armchaos.ExperimentProperties{ - // Selectors: []armchaos.SelectorClassification{ - // &armchaos.ListSelector{ - // Type: to.Ptr(armchaos.SelectorTypeList), - // ID: to.Ptr("selector1"), - // Targets: []*armchaos.TargetReference{ - // { - // Type: to.Ptr(armchaos.TargetReferenceTypeChaosTarget), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"), - // }}, - // }}, - // Steps: []*armchaos.Step{ - // { - // Name: to.Ptr("step1"), - // Branches: []*armchaos.Branch{ - // { - // Name: to.Ptr("branch1"), - // Actions: []armchaos.ActionClassification{ - // &armchaos.ContinuousAction{ - // Name: to.Ptr("urn:csci:provider:providername:Shutdown/1.0"), - // Type: to.Ptr("continuous"), - // Duration: to.Ptr("PT10M"), - // Parameters: []*armchaos.KeyValuePair{ - // { - // Key: to.Ptr("abruptShutdown"), - // Value: to.Ptr("false"), - // }}, - // SelectorID: to.Ptr("selector1"), - // }}, - // }}, - // }}, - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), - // CreatedBy: to.Ptr("User"), - // CreatedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), - // LastModifiedBy: to.Ptr("User"), - // LastModifiedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListExperimentsInAResourceGroup.json -func ExampleExperimentsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExperimentsClient().NewListPager("exampleRG", &armchaos.ExperimentsClientListOptions{Running: nil, - ContinuationToken: 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.ExperimentListResult = armchaos.ExperimentListResult{ - // Value: []*armchaos.Experiment{ - // { - // Name: to.Ptr("exampleExperiment"), - // Type: to.Ptr("Microsoft.Chaos/experiments"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment"), - // Location: to.Ptr("centraluseuap"), - // Identity: &armchaos.ResourceIdentity{ - // Type: to.Ptr(armchaos.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("d04ab567-2c07-43ef-a7f4-4527626b7f56"), - // TenantID: to.Ptr("8c3e2fb2-fe7a-4bf1-b779-d73990782fe6"), - // }, - // Properties: &armchaos.ExperimentProperties{ - // Selectors: []armchaos.SelectorClassification{ - // &armchaos.ListSelector{ - // Type: to.Ptr(armchaos.SelectorTypeList), - // ID: to.Ptr("selector1"), - // Targets: []*armchaos.TargetReference{ - // { - // Type: to.Ptr(armchaos.TargetReferenceTypeChaosTarget), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"), - // }}, - // }}, - // Steps: []*armchaos.Step{ - // { - // Name: to.Ptr("step1"), - // Branches: []*armchaos.Branch{ - // { - // Name: to.Ptr("branch1"), - // Actions: []armchaos.ActionClassification{ - // &armchaos.ContinuousAction{ - // Name: to.Ptr("urn:csci:provider:providername:Shutdown/1.0"), - // Type: to.Ptr("continuous"), - // Duration: to.Ptr("PT10M"), - // Parameters: []*armchaos.KeyValuePair{ - // { - // Key: to.Ptr("abruptShutdown"), - // Value: to.Ptr("false"), - // }}, - // SelectorID: to.Ptr("selector1"), - // }}, - // }}, - // }}, - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), - // CreatedBy: to.Ptr("User"), - // CreatedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), - // LastModifiedBy: to.Ptr("User"), - // LastModifiedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/DeleteAExperiment.json -func ExampleExperimentsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewExperimentsClient().Delete(ctx, "exampleRG", "exampleExperiment", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetAExperiment.json -func ExampleExperimentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExperimentsClient().Get(ctx, "exampleRG", "exampleExperiment", 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.Experiment = armchaos.Experiment{ - // Name: to.Ptr("exampleExperiment"), - // Type: to.Ptr("Microsoft.Chaos/experiments"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment"), - // Location: to.Ptr("centraluseuap"), - // Identity: &armchaos.ResourceIdentity{ - // Type: to.Ptr(armchaos.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("d04ab567-2c07-43ef-a7f4-4527626b7f56"), - // TenantID: to.Ptr("8c3e2fb2-fe7a-4bf1-b779-d73990782fe6"), - // }, - // Properties: &armchaos.ExperimentProperties{ - // Selectors: []armchaos.SelectorClassification{ - // &armchaos.ListSelector{ - // Type: to.Ptr(armchaos.SelectorTypeList), - // ID: to.Ptr("selector1"), - // Targets: []*armchaos.TargetReference{ - // { - // Type: to.Ptr(armchaos.TargetReferenceTypeChaosTarget), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"), - // }}, - // }}, - // Steps: []*armchaos.Step{ - // { - // Name: to.Ptr("step1"), - // Branches: []*armchaos.Branch{ - // { - // Name: to.Ptr("branch1"), - // Actions: []armchaos.ActionClassification{ - // &armchaos.ContinuousAction{ - // Name: to.Ptr("urn:csci:provider:providername:Shutdown/1.0"), - // Type: to.Ptr("continuous"), - // Duration: to.Ptr("PT10M"), - // Parameters: []*armchaos.KeyValuePair{ - // { - // Key: to.Ptr("abruptShutdown"), - // Value: to.Ptr("false"), - // }}, - // SelectorID: to.Ptr("selector1"), - // }}, - // }}, - // }}, - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), - // CreatedBy: to.Ptr("User"), - // CreatedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), - // LastModifiedBy: to.Ptr("User"), - // LastModifiedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/CreateOrUpdateAExperiment.json -func ExampleExperimentsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExperimentsClient().CreateOrUpdate(ctx, "exampleRG", "exampleExperiment", armchaos.Experiment{ - Location: to.Ptr("eastus2euap"), - Identity: &armchaos.ResourceIdentity{ - Type: to.Ptr(armchaos.ResourceIdentityTypeSystemAssigned), - }, - Properties: &armchaos.ExperimentProperties{ - Selectors: []armchaos.SelectorClassification{ - &armchaos.ListSelector{ - Type: to.Ptr(armchaos.SelectorTypeList), - ID: to.Ptr("selector1"), - Targets: []*armchaos.TargetReference{ - { - Type: to.Ptr(armchaos.TargetReferenceTypeChaosTarget), - ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"), - }}, - }}, - Steps: []*armchaos.Step{ - { - Name: to.Ptr("step1"), - Branches: []*armchaos.Branch{ - { - Name: to.Ptr("branch1"), - Actions: []armchaos.ActionClassification{ - &armchaos.ContinuousAction{ - Name: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"), - Type: to.Ptr("continuous"), - Duration: to.Ptr("PT10M"), - Parameters: []*armchaos.KeyValuePair{ - { - Key: to.Ptr("abruptShutdown"), - Value: to.Ptr("false"), - }}, - SelectorID: to.Ptr("selector1"), - }}, - }}, - }}, - }, - }, 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.Experiment = armchaos.Experiment{ - // Name: to.Ptr("exampleExperiment"), - // Type: to.Ptr("Microsoft.Chaos/experiments"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment"), - // Location: to.Ptr("eastus2euap"), - // Identity: &armchaos.ResourceIdentity{ - // Type: to.Ptr(armchaos.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("d04ab567-2c07-43ef-a7f4-4527626b7f56"), - // TenantID: to.Ptr("8c3e2fb2-fe7a-4bf1-b779-d73990782fe6"), - // }, - // Properties: &armchaos.ExperimentProperties{ - // Selectors: []armchaos.SelectorClassification{ - // &armchaos.ListSelector{ - // Type: to.Ptr(armchaos.SelectorTypeList), - // ID: to.Ptr("selector1"), - // Targets: []*armchaos.TargetReference{ - // { - // Type: to.Ptr(armchaos.TargetReferenceTypeChaosTarget), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"), - // }}, - // }}, - // Steps: []*armchaos.Step{ - // { - // Name: to.Ptr("step1"), - // Branches: []*armchaos.Branch{ - // { - // Name: to.Ptr("branch1"), - // Actions: []armchaos.ActionClassification{ - // &armchaos.ContinuousAction{ - // Name: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"), - // Type: to.Ptr("continuous"), - // Duration: to.Ptr("PT10M"), - // Parameters: []*armchaos.KeyValuePair{ - // { - // Key: to.Ptr("abruptShutdown"), - // Value: to.Ptr("false"), - // }}, - // SelectorID: to.Ptr("selector1"), - // }}, - // }}, - // }}, - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), - // CreatedBy: to.Ptr("User"), - // CreatedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), - // LastModifiedBy: to.Ptr("User"), - // LastModifiedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/PatchExperiment.json -func ExampleExperimentsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExperimentsClient().Update(ctx, "exampleRG", "exampleExperiment", armchaos.ExperimentUpdate{ - Identity: &armchaos.ResourceIdentity{ - Type: to.Ptr(armchaos.ResourceIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armchaos.UserAssignedIdentity{ - "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.ManagedIdentity/userAssignedIdentity/exampleUMI": {}, - }, - }, - }, 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.Experiment = armchaos.Experiment{ - // Name: to.Ptr("exampleExperiment"), - // Type: to.Ptr("Microsoft.Chaos/experiments"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment"), - // Location: to.Ptr("centraluseuap"), - // Identity: &armchaos.ResourceIdentity{ - // Type: to.Ptr(armchaos.ResourceIdentityTypeUserAssigned), - // PrincipalID: to.Ptr("d04ab567-2c07-43ef-a7f4-4527626b7f56"), - // TenantID: to.Ptr("8c3e2fb2-fe7a-4bf1-b779-d73990782fe6"), - // UserAssignedIdentities: map[string]*armchaos.UserAssignedIdentity{ - // "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.ManagedIdentity/userAssignedIdentity/exampleUMI": &armchaos.UserAssignedIdentity{ - // }, - // }, - // }, - // Properties: &armchaos.ExperimentProperties{ - // Selectors: []armchaos.SelectorClassification{ - // &armchaos.ListSelector{ - // Type: to.Ptr(armchaos.SelectorTypeList), - // ID: to.Ptr("selector1"), - // Targets: []*armchaos.TargetReference{ - // { - // Type: to.Ptr(armchaos.TargetReferenceTypeChaosTarget), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"), - // }}, - // }}, - // Steps: []*armchaos.Step{ - // { - // Name: to.Ptr("step1"), - // Branches: []*armchaos.Branch{ - // { - // Name: to.Ptr("branch1"), - // Actions: []armchaos.ActionClassification{ - // &armchaos.ContinuousAction{ - // Name: to.Ptr("urn:csci:provider:providername:Shutdown/1.0"), - // Type: to.Ptr("continuous"), - // Duration: to.Ptr("PT10M"), - // Parameters: []*armchaos.KeyValuePair{ - // { - // Key: to.Ptr("abruptShutdown"), - // Value: to.Ptr("false"), - // }}, - // SelectorID: to.Ptr("selector1"), - // }}, - // }}, - // }}, - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), - // CreatedBy: to.Ptr("User"), - // CreatedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), - // LastModifiedBy: to.Ptr("User"), - // LastModifiedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/CancelAExperiment.json -func ExampleExperimentsClient_Cancel() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewExperimentsClient().Cancel(ctx, "exampleRG", "exampleExperiment", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/StartAExperiment.json -func ExampleExperimentsClient_Start() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewExperimentsClient().Start(ctx, "exampleRG", "exampleExperiment", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListExperimentStatuses.json -func ExampleExperimentsClient_NewListAllStatusesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExperimentsClient().NewListAllStatusesPager("exampleRG", "exampleExperiment", 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.ExperimentStatusListResult = armchaos.ExperimentStatusListResult{ - // Value: []*armchaos.ExperimentStatus{ - // { - // Name: to.Ptr("50734542-2e64-4e08-814c-cc0e7475f7e4"), - // Type: to.Ptr("Microsoft.Chaos/experiments/statuses"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment/statuses/50734542-2e64-4e08-814c-cc0e7475f7e4"), - // Properties: &armchaos.ExperimentStatusProperties{ - // CreatedDateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), - // EndDateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T01:00:00.0Z"); return t}()), - // Status: to.Ptr("Successful"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetAExperimentStatus.json -func ExampleExperimentsClient_GetStatus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExperimentsClient().GetStatus(ctx, "exampleRG", "exampleExperiment", "50734542-2e64-4e08-814c-cc0e7475f7e4", 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.ExperimentStatus = armchaos.ExperimentStatus{ - // Name: to.Ptr("50734542-2e64-4e08-814c-cc0e7475f7e4"), - // Type: to.Ptr("Microsoft.Chaos/experiments/statuses"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment/statuses/50734542-2e64-4e08-814c-cc0e7475f7e4"), - // Properties: &armchaos.ExperimentStatusProperties{ - // CreatedDateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), - // EndDateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T01:00:00.0Z"); return t}()), - // Status: to.Ptr("Successful"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListExperimentExecutionsDetails.json -func ExampleExperimentsClient_NewListExecutionDetailsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExperimentsClient().NewListExecutionDetailsPager("exampleRG", "exampleExperiment", 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.ExperimentExecutionDetailsListResult = armchaos.ExperimentExecutionDetailsListResult{ - // Value: []*armchaos.ExperimentExecutionDetails{ - // { - // Name: to.Ptr("f24500ad-744e-4a26-864b-b76199eac333"), - // Type: to.Ptr("Microsoft.Chaos/experiments/executionDetails"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment/executionDetails/f24500ad-744e-4a26-864b-b76199eac333"), - // Properties: &armchaos.ExperimentExecutionDetailsProperties{ - // CreatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:42.917983Z"); return t}()), - // ExperimentID: to.Ptr("f24500ad-744e-4a26-864b-b76199eac333"), - // FailureReason: to.Ptr("Dependency failure"), - // LastActionDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:52.2552574Z"); return t}()), - // RunInformation: &armchaos.ExperimentExecutionDetailsPropertiesRunInformation{ - // Steps: []*armchaos.StepStatus{ - // { - // Branches: []*armchaos.BranchStatus{ - // { - // Actions: []*armchaos.ActionStatus{ - // { - // ActionID: to.Ptr("59499d33-6751-4b6e-a1f6-58f4d56a040a"), - // ActionName: to.Ptr("urn:provider:agent-v2:Microsoft.Azure.Chaos.Fault.CPUPressureAllProcessors"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T13:56:13.6270153-08:00"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T13:56:13.6270153-08:00"); return t}()), - // Status: to.Ptr("failed"), - // Targets: []*armchaos.ExperimentExecutionActionTargetDetailsProperties{ - // { - // Status: to.Ptr("succeeded"), - // Target: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/VM1"), - // TargetCompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T17:30:55+00:00"); return t}()), - // TargetFailedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T16:30:55+00:00"); return t}()), - // }}, - // }}, - // BranchID: to.Ptr("FirstBranch"), - // BranchName: to.Ptr("FirstBranch"), - // Status: to.Ptr("failed"), - // }}, - // Status: to.Ptr("failed"), - // StepID: to.Ptr("FirstStep"), - // StepName: to.Ptr("FirstStep"), - // }}, - // }, - // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:52.2552574Z"); return t}()), - // Status: to.Ptr("failed"), - // StopDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:56:18.9281956Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("14d98367-52ef-4596-be4f-53fc81bbfc33"), - // Type: to.Ptr("Microsoft.Chaos/experiments/executionDetails"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment/executionDetails/14d98367-52ef-4596-be4f-53fc81bbfc33"), - // Properties: &armchaos.ExperimentExecutionDetailsProperties{ - // CreatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:42.917983Z"); return t}()), - // ExperimentID: to.Ptr("14d98367-52ef-4596-be4f-53fc81bbfc33"), - // FailureReason: to.Ptr(""), - // LastActionDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:52.2552574Z"); return t}()), - // RunInformation: &armchaos.ExperimentExecutionDetailsPropertiesRunInformation{ - // Steps: []*armchaos.StepStatus{ - // { - // Branches: []*armchaos.BranchStatus{ - // { - // Actions: []*armchaos.ActionStatus{ - // { - // ActionID: to.Ptr("59499d33-6751-4b6e-a1f6-58f4d56a040a"), - // ActionName: to.Ptr("urn:provider:agent-v2:Microsoft.Azure.Chaos.Fault.CPUPressureAllProcessors"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T13:56:13.6270153-08:00"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T13:56:13.6270153-08:00"); return t}()), - // Status: to.Ptr("success"), - // Targets: []*armchaos.ExperimentExecutionActionTargetDetailsProperties{ - // { - // Status: to.Ptr("succeeded"), - // Target: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/VM1"), - // TargetCompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T17:30:55+00:00"); return t}()), - // TargetFailedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T16:30:55+00:00"); return t}()), - // }}, - // }}, - // BranchID: to.Ptr("FirstBranch"), - // BranchName: to.Ptr("FirstBranch"), - // Status: to.Ptr("success"), - // }}, - // Status: to.Ptr("success"), - // StepID: to.Ptr("FirstStep"), - // StepName: to.Ptr("FirstStep"), - // }}, - // }, - // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:52.2552574Z"); return t}()), - // Status: to.Ptr("success"), - // StopDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:56:18.9281956Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetAExperimentExecutionDetails.json -func ExampleExperimentsClient_GetExecutionDetails() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExperimentsClient().GetExecutionDetails(ctx, "exampleRG", "exampleExperiment", "f24500ad-744e-4a26-864b-b76199eac333", 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.ExperimentExecutionDetails = armchaos.ExperimentExecutionDetails{ - // Name: to.Ptr("f24500ad-744e-4a26-864b-b76199eac333"), - // Type: to.Ptr("Microsoft.Chaos/experiments/executionDetails"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment/executionDetails/f24500ad-744e-4a26-864b-b76199eac333"), - // Properties: &armchaos.ExperimentExecutionDetailsProperties{ - // CreatedDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:42.917983Z"); return t}()), - // ExperimentID: to.Ptr("f24500ad-744e-4a26-864b-b76199eac333"), - // FailureReason: to.Ptr("Dependency failure"), - // LastActionDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:52.2552574Z"); return t}()), - // RunInformation: &armchaos.ExperimentExecutionDetailsPropertiesRunInformation{ - // Steps: []*armchaos.StepStatus{ - // { - // Branches: []*armchaos.BranchStatus{ - // { - // Actions: []*armchaos.ActionStatus{ - // { - // ActionID: to.Ptr("59499d33-6751-4b6e-a1f6-58f4d56a040a"), - // ActionName: to.Ptr("urn:provider:agent-v2:Microsoft.Azure.Chaos.Fault.CPUPressureAllProcessors"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T13:56:13.6270153-08:00"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T13:56:13.6270153-08:00"); return t}()), - // Status: to.Ptr("failed"), - // Targets: []*armchaos.ExperimentExecutionActionTargetDetailsProperties{ - // { - // Status: to.Ptr("succeeded"), - // Target: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/VM1"), - // TargetCompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T17:30:55+00:00"); return t}()), - // TargetFailedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T16:30:55+00:00"); return t}()), - // }, - // { - // Status: to.Ptr("failed"), - // Target: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/VM1"), - // TargetCompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T17:30:55+00:00"); return t}()), - // TargetFailedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T16:30:55+00:00"); return t}()), - // }}, - // }}, - // BranchID: to.Ptr("FirstBranch"), - // BranchName: to.Ptr("FirstBranch"), - // Status: to.Ptr("failed"), - // }}, - // Status: to.Ptr("failed"), - // StepID: to.Ptr("FirstStep"), - // StepName: to.Ptr("FirstStep"), - // }}, - // }, - // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:52.2552574Z"); return t}()), - // Status: to.Ptr("failed"), - // StopDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:56:18.9281956Z"); return t}()), - // }, - // } -} diff --git a/sdk/resourcemanager/chaos/armchaos/go.mod b/sdk/resourcemanager/chaos/armchaos/go.mod index 5e21ad6ccab7..f63b41f0bb42 100644 --- a/sdk/resourcemanager/chaos/armchaos/go.mod +++ b/sdk/resourcemanager/chaos/armchaos/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.6.1 - 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/chaos/armchaos/go.sum b/sdk/resourcemanager/chaos/armchaos/go.sum index ee2bc4389c66..727ce838bdc8 100644 --- a/sdk/resourcemanager/chaos/armchaos/go.sum +++ b/sdk/resourcemanager/chaos/armchaos/go.sum @@ -1,31 +1,15 @@ 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/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/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/chaos/armchaos/interfaces.go b/sdk/resourcemanager/chaos/armchaos/interfaces.go index 3982aec7bee5..e75b88834683 100644 --- a/sdk/resourcemanager/chaos/armchaos/interfaces.go +++ b/sdk/resourcemanager/chaos/armchaos/interfaces.go @@ -8,29 +8,29 @@ package armchaos -// ActionClassification provides polymorphic access to related types. -// Call the interface's GetAction() method to access the common type. +// ExperimentActionClassification provides polymorphic access to related types. +// Call the interface's GetExperimentAction() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: -// - *Action, *ContinuousAction, *DelayAction, *DiscreteAction -type ActionClassification interface { - // GetAction returns the Action content of the underlying type. - GetAction() *Action +// - *ContinuousAction, *DelayAction, *DiscreteAction, *ExperimentAction +type ExperimentActionClassification interface { + // GetExperimentAction returns the ExperimentAction content of the underlying type. + GetExperimentAction() *ExperimentAction } -// FilterClassification provides polymorphic access to related types. -// Call the interface's GetFilter() method to access the common type. +// TargetFilterClassification provides polymorphic access to related types. +// Call the interface's GetTargetFilter() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: -// - *Filter, *SimpleFilter -type FilterClassification interface { - // GetFilter returns the Filter content of the underlying type. - GetFilter() *Filter +// - *TargetFilter, *TargetSimpleFilter +type TargetFilterClassification interface { + // GetTargetFilter returns the TargetFilter content of the underlying type. + GetTargetFilter() *TargetFilter } -// SelectorClassification provides polymorphic access to related types. -// Call the interface's GetSelector() method to access the common type. +// TargetSelectorClassification provides polymorphic access to related types. +// Call the interface's GetTargetSelector() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: -// - *ListSelector, *QuerySelector, *Selector -type SelectorClassification interface { - // GetSelector returns the Selector content of the underlying type. - GetSelector() *Selector +// - *TargetListSelector, *TargetQuerySelector, *TargetSelector +type TargetSelectorClassification interface { + // GetTargetSelector returns the TargetSelector content of the underlying type. + GetTargetSelector() *TargetSelector } diff --git a/sdk/resourcemanager/chaos/armchaos/models.go b/sdk/resourcemanager/chaos/armchaos/models.go index 7f8af65892b6..ecbc017ae3c3 100644 --- a/sdk/resourcemanager/chaos/armchaos/models.go +++ b/sdk/resourcemanager/chaos/armchaos/models.go @@ -10,18 +10,6 @@ package armchaos import "time" -// Action - Model that represents the base action model. -type Action struct { - // REQUIRED; String that represents a Capability URN. - Name *string - - // REQUIRED; Enum that discriminates between action models. - Type *string -} - -// GetAction implements the ActionClassification interface for type Action. -func (a *Action) GetAction() *Action { return a } - // ActionStatus - Model that represents the an action and its status. type ActionStatus struct { // READ-ONLY; The id of the action status. @@ -43,15 +31,6 @@ type ActionStatus struct { Targets []*ExperimentExecutionActionTargetDetailsProperties } -// Branch - Model that represents a branch in the step. -type Branch struct { - // REQUIRED; List of actions. - Actions []ActionClassification - - // REQUIRED; String of the branch name. - Name *string -} - // BranchStatus - Model that represents the a list of actions and action statuses. type BranchStatus struct { // READ-ONLY; The array of actions. @@ -199,9 +178,9 @@ type ContinuousAction struct { Type *string } -// GetAction implements the ActionClassification interface for type ContinuousAction. -func (c *ContinuousAction) GetAction() *Action { - return &Action{ +// GetExperimentAction implements the ExperimentActionClassification interface for type ContinuousAction. +func (c *ContinuousAction) GetExperimentAction() *ExperimentAction { + return &ExperimentAction{ Name: c.Name, Type: c.Type, } @@ -219,9 +198,9 @@ type DelayAction struct { Type *string } -// GetAction implements the ActionClassification interface for type DelayAction. -func (d *DelayAction) GetAction() *Action { - return &Action{ +// GetExperimentAction implements the ExperimentActionClassification interface for type DelayAction. +func (d *DelayAction) GetExperimentAction() *ExperimentAction { + return &ExperimentAction{ Name: d.Name, Type: d.Type, } @@ -242,9 +221,9 @@ type DiscreteAction struct { Type *string } -// GetAction implements the ActionClassification interface for type DiscreteAction. -func (d *DiscreteAction) GetAction() *Action { - return &Action{ +// GetExperimentAction implements the ExperimentActionClassification interface for type DiscreteAction. +func (d *DiscreteAction) GetExperimentAction() *ExperimentAction { + return &ExperimentAction{ Name: d.Name, Type: d.Type, } @@ -311,13 +290,40 @@ type Experiment struct { Type *string } -// ExperimentCancelOperationResult - Model that represents the result of a cancel Experiment operation. -type ExperimentCancelOperationResult struct { - // READ-ONLY; String of the Experiment name. +// ExperimentAction - Model that represents the base action model. 9 total per experiment. +type ExperimentAction struct { + // REQUIRED; String that represents a Capability URN. + Name *string + + // REQUIRED; Enum that discriminates between action models. + Type *string +} + +// GetExperimentAction implements the ExperimentActionClassification interface for type ExperimentAction. +func (e *ExperimentAction) GetExperimentAction() *ExperimentAction { return e } + +// ExperimentBranch - Model that represents a branch in the step. 9 total per experiment. +type ExperimentBranch struct { + // REQUIRED; List of actions. + Actions []ExperimentActionClassification + + // REQUIRED; String of the branch name. + Name *string +} + +// ExperimentExecution - Model that represents the execution of a Experiment. +type ExperimentExecution struct { + // The properties of experiment execution status. + Properties *ExperimentExecutionProperties + + // READ-ONLY; String of the fully qualified resource ID. + ID *string + + // READ-ONLY; String of the resource name. Name *string - // READ-ONLY; URL to retrieve the Experiment status. - StatusURL *string + // READ-ONLY; String of the resource type. + Type *string } // ExperimentExecutionActionTargetDetailsError - Model that represents the Experiment action target details error model. @@ -348,7 +354,7 @@ type ExperimentExecutionActionTargetDetailsProperties struct { TargetFailedTime *time.Time } -// ExperimentExecutionDetails - Model that represents the execution details of a Experiment. +// ExperimentExecutionDetails - Model that represents the execution details of an Experiment. type ExperimentExecutionDetails struct { // READ-ONLY; String of the fully qualified resource ID. ID *string @@ -363,40 +369,25 @@ type ExperimentExecutionDetails struct { Type *string } -// ExperimentExecutionDetailsListResult - Model that represents a list of Experiment execution details and a link for pagination. -type ExperimentExecutionDetailsListResult struct { - // READ-ONLY; URL to retrieve the next page of Experiment execution details. - NextLink *string - - // READ-ONLY; List of Experiment execution details. - Value []*ExperimentExecutionDetails -} - -// ExperimentExecutionDetailsProperties - Model that represents the Experiment execution details properties model. +// ExperimentExecutionDetailsProperties - Model that represents the extended properties of an experiment execution. type ExperimentExecutionDetailsProperties struct { - // READ-ONLY; String that represents the created date time. - CreatedDateTime *time.Time - - // READ-ONLY; The id of the experiment. - ExperimentID *string - // READ-ONLY; The reason why the execution failed. FailureReason *string // READ-ONLY; String that represents the last action date time. - LastActionDateTime *time.Time + LastActionAt *time.Time // READ-ONLY; The information of the experiment run. RunInformation *ExperimentExecutionDetailsPropertiesRunInformation // READ-ONLY; String that represents the start date time. - StartDateTime *time.Time + StartedAt *time.Time - // READ-ONLY; The value of the status of the experiment execution. + // READ-ONLY; The status of the execution. Status *string // READ-ONLY; String that represents the stop date time. - StopDateTime *time.Time + StoppedAt *time.Time } // ExperimentExecutionDetailsPropertiesRunInformation - The information of the experiment run. @@ -405,6 +396,27 @@ type ExperimentExecutionDetailsPropertiesRunInformation struct { Steps []*StepStatus } +// ExperimentExecutionListResult - Model that represents a list of Experiment executions and a link for pagination. +type ExperimentExecutionListResult struct { + // READ-ONLY; URL to retrieve the next page of Experiment executions. + NextLink *string + + // READ-ONLY; List of Experiment executions. + Value []*ExperimentExecution +} + +// ExperimentExecutionProperties - Model that represents the execution properties of an Experiment. +type ExperimentExecutionProperties struct { + // READ-ONLY; String that represents the start date time. + StartedAt *time.Time + + // READ-ONLY; The status of the execution. + Status *string + + // READ-ONLY; String that represents the stop date time. + StoppedAt *time.Time +} + // ExperimentListResult - Model that represents a list of Experiment resources and a link for pagination. type ExperimentListResult struct { // READ-ONLY; URL to retrieve the next page of Experiment resources. @@ -417,58 +429,22 @@ type ExperimentListResult struct { // ExperimentProperties - Model that represents the Experiment properties model. type ExperimentProperties struct { // REQUIRED; List of selectors. - Selectors []SelectorClassification + Selectors []TargetSelectorClassification // REQUIRED; List of steps. - Steps []*Step + Steps []*ExperimentStep - // A boolean value that indicates if experiment should be started on creation or not. - StartOnCreation *bool + // READ-ONLY; Most recent provisioning state for the given experiment resource. + ProvisioningState *ProvisioningState } -// ExperimentStartOperationResult - Model that represents the result of a start Experiment operation. -type ExperimentStartOperationResult struct { - // READ-ONLY; String of the Experiment name. - Name *string - - // READ-ONLY; URL to retrieve the Experiment status. - StatusURL *string -} - -// ExperimentStatus - Model that represents the status of a Experiment. -type ExperimentStatus struct { - // The properties of experiment execution status. - Properties *ExperimentStatusProperties - - // READ-ONLY; String of the fully qualified resource ID. - ID *string +// ExperimentStep - Model that represents a step in the Experiment resource. +type ExperimentStep struct { + // REQUIRED; List of branches. + Branches []*ExperimentBranch - // READ-ONLY; String of the resource name. + // REQUIRED; String of the step name. Name *string - - // READ-ONLY; String of the resource type. - Type *string -} - -// ExperimentStatusListResult - Model that represents a list of Experiment statuses and a link for pagination. -type ExperimentStatusListResult struct { - // READ-ONLY; URL to retrieve the next page of Experiment statuses. - NextLink *string - - // READ-ONLY; List of Experiment statuses. - Value []*ExperimentStatus -} - -// ExperimentStatusProperties - Model that represents the Experiment status properties model. -type ExperimentStatusProperties struct { - // READ-ONLY; String that represents the created date time of a Experiment. - CreatedDateUTC *time.Time - - // READ-ONLY; String that represents the end date time of a Experiment. - EndDateUTC *time.Time - - // READ-ONLY; String that represents the status of a Experiment. - Status *string } // ExperimentUpdate - Describes an experiment update. @@ -477,15 +453,6 @@ type ExperimentUpdate struct { Identity *ResourceIdentity } -// Filter - Model that represents available filter types that can be applied to a targets list. -type Filter struct { - // REQUIRED; Enum that discriminates between filter types. Currently only Simple type is supported. - Type *FilterType -} - -// GetFilter implements the FilterClassification interface for type Filter. -func (f *Filter) GetFilter() *Filter { return f } - // KeyValuePair - A map to describe the settings of an action. type KeyValuePair struct { // REQUIRED; The name of the setting for the action. @@ -495,34 +462,6 @@ type KeyValuePair struct { Value *string } -// ListSelector - Model that represents a list selector. -type ListSelector struct { - // REQUIRED; String of the selector ID. - ID *string - - // REQUIRED; List of Target references. - Targets []*TargetReference - - // REQUIRED; Enum of the selector type. - Type *SelectorType - - // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]any - - // Model that represents available filter types that can be applied to a targets list. - Filter FilterClassification -} - -// GetSelector implements the SelectorClassification interface for type ListSelector. -func (l *ListSelector) GetSelector() *Selector { - return &Selector{ - AdditionalProperties: l.AdditionalProperties, - Filter: l.Filter, - ID: l.ID, - Type: l.Type, - } -} - // Operation - Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { // Localized display information for this particular operation. @@ -572,35 +511,25 @@ type OperationListResult struct { Value []*Operation } -// QuerySelector - Model that represents a query selector. -type QuerySelector struct { - // REQUIRED; String of the selector ID. - ID *string +// OperationStatus - The status of operation. +type OperationStatus struct { + // The end time of the operation. + EndTime *string - // REQUIRED; Azure Resource Graph (ARG) Query Language query for target resources. - QueryString *string - - // REQUIRED; Subscription id list to scope resource query. - SubscriptionIDs []*string + // The error object. + Error *ErrorDetail - // REQUIRED; Enum of the selector type. - Type *SelectorType + // The operation Id. + ID *string - // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]any + // The operation name. + Name *string - // Model that represents available filter types that can be applied to a targets list. - Filter FilterClassification -} + // The start time of the operation. + StartTime *string -// GetSelector implements the SelectorClassification interface for type QuerySelector. -func (q *QuerySelector) GetSelector() *Selector { - return &Selector{ - AdditionalProperties: q.AdditionalProperties, - Filter: q.Filter, - ID: q.ID, - Type: q.Type, - } + // The status of the operation. + Status *string } // Resource - Common fields that are returned in the response for all Azure Resource Manager resources @@ -632,55 +561,6 @@ type ResourceIdentity struct { TenantID *string } -// Selector - Model that represents a selector in the Experiment resource. -type Selector struct { - // REQUIRED; String of the selector ID. - ID *string - - // REQUIRED; Enum of the selector type. - Type *SelectorType - - // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]any - - // Model that represents available filter types that can be applied to a targets list. - Filter FilterClassification -} - -// GetSelector implements the SelectorClassification interface for type Selector. -func (s *Selector) GetSelector() *Selector { return s } - -// SimpleFilter - Model that represents a simple target filter. -type SimpleFilter struct { - // REQUIRED; Enum that discriminates between filter types. Currently only Simple type is supported. - Type *FilterType - - // Model that represents the Simple filter parameters. - Parameters *SimpleFilterParameters -} - -// GetFilter implements the FilterClassification interface for type SimpleFilter. -func (s *SimpleFilter) GetFilter() *Filter { - return &Filter{ - Type: s.Type, - } -} - -// SimpleFilterParameters - Model that represents the Simple filter parameters. -type SimpleFilterParameters struct { - // List of Azure availability zones to filter targets by. - Zones []*string -} - -// Step - Model that represents a step in the Experiment resource. -type Step struct { - // REQUIRED; List of branches. - Branches []*Branch - - // REQUIRED; String of the step name. - Name *string -} - // StepStatus - Model that represents the a list of branches and branch statuses. type StepStatus struct { // READ-ONLY; The array of branches. @@ -738,6 +618,15 @@ type Target struct { Type *string } +// TargetFilter - Model that represents available filter types that can be applied to a targets list. +type TargetFilter struct { + // REQUIRED; Enum that discriminates between filter types. Currently only Simple type is supported. + Type *FilterType +} + +// GetTargetFilter implements the TargetFilterClassification interface for type TargetFilter. +func (t *TargetFilter) GetTargetFilter() *TargetFilter { return t } + // TargetListResult - Model that represents a list of Target resources and a link for pagination. type TargetListResult struct { // READ-ONLY; URL to retrieve the next page of Target resources. @@ -747,6 +636,65 @@ type TargetListResult struct { Value []*Target } +// TargetListSelector - Model that represents a list selector. +type TargetListSelector struct { + // REQUIRED; String of the selector ID. + ID *string + + // REQUIRED; List of Target references. + Targets []*TargetReference + + // REQUIRED; Enum of the selector type. + Type *SelectorType + + // OPTIONAL; Contains additional key/value pairs not defined in the schema. + AdditionalProperties map[string]any + + // Model that represents available filter types that can be applied to a targets list. + Filter TargetFilterClassification +} + +// GetTargetSelector implements the TargetSelectorClassification interface for type TargetListSelector. +func (t *TargetListSelector) GetTargetSelector() *TargetSelector { + return &TargetSelector{ + AdditionalProperties: t.AdditionalProperties, + Filter: t.Filter, + ID: t.ID, + Type: t.Type, + } +} + +// TargetQuerySelector - Model that represents a query selector. +type TargetQuerySelector struct { + // REQUIRED; String of the selector ID. + ID *string + + // REQUIRED; Azure Resource Graph (ARG) Query Language query for target resources. + QueryString *string + + // REQUIRED; Subscription id list to scope resource query. + SubscriptionIDs []*string + + // REQUIRED; Enum of the selector type. + Type *SelectorType + + // OPTIONAL; Contains additional key/value pairs not defined in the schema. + AdditionalProperties map[string]any + + // Model that represents available filter types that can be applied to a targets list. + Filter TargetFilterClassification +} + +// GetTargetSelector implements the TargetSelectorClassification interface for type TargetQuerySelector. +func (t *TargetQuerySelector) GetTargetSelector() *TargetSelector { + return &TargetSelector{ + AdditionalProperties: t.AdditionalProperties, + Filter: t.Filter, + ID: t.ID, + Type: t.Type, + } +} + // TargetReference - Model that represents a reference to a Target in the selector. type TargetReference struct { // REQUIRED; String of the resource ID of a Target resource. @@ -756,6 +704,46 @@ type TargetReference struct { Type *TargetReferenceType } +// TargetSelector - Model that represents a selector in the Experiment resource. +type TargetSelector struct { + // REQUIRED; String of the selector ID. + ID *string + + // REQUIRED; Enum of the selector type. + Type *SelectorType + + // OPTIONAL; Contains additional key/value pairs not defined in the schema. + AdditionalProperties map[string]any + + // Model that represents available filter types that can be applied to a targets list. + Filter TargetFilterClassification +} + +// GetTargetSelector implements the TargetSelectorClassification interface for type TargetSelector. +func (t *TargetSelector) GetTargetSelector() *TargetSelector { return t } + +// TargetSimpleFilter - Model that represents a simple target filter. +type TargetSimpleFilter struct { + // REQUIRED; Enum that discriminates between filter types. Currently only Simple type is supported. + Type *FilterType + + // Model that represents the Simple filter parameters. + Parameters *TargetSimpleFilterParameters +} + +// GetTargetFilter implements the TargetFilterClassification interface for type TargetSimpleFilter. +func (t *TargetSimpleFilter) GetTargetFilter() *TargetFilter { + return &TargetFilter{ + Type: t.Type, + } +} + +// TargetSimpleFilterParameters - Model that represents the Simple filter parameters. +type TargetSimpleFilterParameters struct { + // List of Azure availability zones to filter targets by. + Zones []*string +} + // TargetType - Model that represents a Target Type resource. type TargetType struct { // REQUIRED; The properties of the target type resource. diff --git a/sdk/resourcemanager/chaos/armchaos/models_serde.go b/sdk/resourcemanager/chaos/armchaos/models_serde.go index 310a5d64d557..f17b189850a2 100644 --- a/sdk/resourcemanager/chaos/armchaos/models_serde.go +++ b/sdk/resourcemanager/chaos/armchaos/models_serde.go @@ -15,37 +15,6 @@ import ( "reflect" ) -// MarshalJSON implements the json.Marshaller interface for type Action. -func (a Action) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", a.Name) - objectMap["type"] = a.Type - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Action. -func (a *Action) 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 "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - 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 ActionStatus. func (a ActionStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -93,37 +62,6 @@ func (a *ActionStatus) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Branch. -func (b Branch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actions", b.Actions) - populate(objectMap, "name", b.Name) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Branch. -func (b *Branch) 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", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actions": - b.Actions, err = unmarshalActionClassificationArray(val) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &b.Name) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type BranchStatus. func (b BranchStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -721,16 +659,80 @@ func (e *Experiment) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ExperimentCancelOperationResult. -func (e ExperimentCancelOperationResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExperimentAction. +func (e ExperimentAction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", e.Name) + objectMap["type"] = e.Type + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentAction. +func (e *ExperimentAction) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExperimentBranch. +func (e ExperimentBranch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actions", e.Actions) + populate(objectMap, "name", e.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentBranch. +func (e *ExperimentBranch) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actions": + e.Actions, err = unmarshalExperimentActionClassificationArray(val) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExperimentExecution. +func (e ExperimentExecution) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "id", e.ID) populate(objectMap, "name", e.Name) - populate(objectMap, "statusUrl", e.StatusURL) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentCancelOperationResult. -func (e *ExperimentCancelOperationResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentExecution. +func (e *ExperimentExecution) 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", e, err) @@ -738,11 +740,17 @@ func (e *ExperimentCancelOperationResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &e.Name) delete(rawMsg, key) - case "statusUrl": - err = unpopulate(val, "StatusURL", &e.StatusURL) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { @@ -865,48 +873,15 @@ func (e *ExperimentExecutionDetails) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ExperimentExecutionDetailsListResult. -func (e ExperimentExecutionDetailsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", e.NextLink) - populate(objectMap, "value", e.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentExecutionDetailsListResult. -func (e *ExperimentExecutionDetailsListResult) 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", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &e.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &e.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type ExperimentExecutionDetailsProperties. func (e ExperimentExecutionDetailsProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "createdDateTime", e.CreatedDateTime) - populate(objectMap, "experimentId", e.ExperimentID) populate(objectMap, "failureReason", e.FailureReason) - populateTimeRFC3339(objectMap, "lastActionDateTime", e.LastActionDateTime) + populateTimeRFC3339(objectMap, "lastActionAt", e.LastActionAt) populate(objectMap, "runInformation", e.RunInformation) - populateTimeRFC3339(objectMap, "startDateTime", e.StartDateTime) + populateTimeRFC3339(objectMap, "startedAt", e.StartedAt) populate(objectMap, "status", e.Status) - populateTimeRFC3339(objectMap, "stopDateTime", e.StopDateTime) + populateTimeRFC3339(objectMap, "stoppedAt", e.StoppedAt) return json.Marshal(objectMap) } @@ -919,29 +894,23 @@ func (e *ExperimentExecutionDetailsProperties) UnmarshalJSON(data []byte) error for key, val := range rawMsg { var err error switch key { - case "createdDateTime": - err = unpopulateTimeRFC3339(val, "CreatedDateTime", &e.CreatedDateTime) - delete(rawMsg, key) - case "experimentId": - err = unpopulate(val, "ExperimentID", &e.ExperimentID) - delete(rawMsg, key) case "failureReason": err = unpopulate(val, "FailureReason", &e.FailureReason) delete(rawMsg, key) - case "lastActionDateTime": - err = unpopulateTimeRFC3339(val, "LastActionDateTime", &e.LastActionDateTime) + case "lastActionAt": + err = unpopulateTimeRFC3339(val, "LastActionAt", &e.LastActionAt) delete(rawMsg, key) case "runInformation": err = unpopulate(val, "RunInformation", &e.RunInformation) delete(rawMsg, key) - case "startDateTime": - err = unpopulateTimeRFC3339(val, "StartDateTime", &e.StartDateTime) + case "startedAt": + err = unpopulateTimeRFC3339(val, "StartedAt", &e.StartedAt) delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &e.Status) delete(rawMsg, key) - case "stopDateTime": - err = unpopulateTimeRFC3339(val, "StopDateTime", &e.StopDateTime) + case "stoppedAt": + err = unpopulateTimeRFC3339(val, "StoppedAt", &e.StoppedAt) delete(rawMsg, key) } if err != nil { @@ -978,16 +947,16 @@ func (e *ExperimentExecutionDetailsPropertiesRunInformation) UnmarshalJSON(data return nil } -// MarshalJSON implements the json.Marshaller interface for type ExperimentListResult. -func (e ExperimentListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExperimentExecutionListResult. +func (e ExperimentExecutionListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", e.NextLink) populate(objectMap, "value", e.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentListResult. -func (e *ExperimentListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentExecutionListResult. +func (e *ExperimentExecutionListResult) 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", e, err) @@ -1009,17 +978,17 @@ func (e *ExperimentListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ExperimentProperties. -func (e ExperimentProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExperimentExecutionProperties. +func (e ExperimentExecutionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "selectors", e.Selectors) - populate(objectMap, "startOnCreation", e.StartOnCreation) - populate(objectMap, "steps", e.Steps) + populateTimeRFC3339(objectMap, "startedAt", e.StartedAt) + populate(objectMap, "status", e.Status) + populateTimeRFC3339(objectMap, "stoppedAt", e.StoppedAt) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentProperties. -func (e *ExperimentProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentExecutionProperties. +func (e *ExperimentExecutionProperties) 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", e, err) @@ -1027,14 +996,14 @@ func (e *ExperimentProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "selectors": - e.Selectors, err = unmarshalSelectorClassificationArray(val) + case "startedAt": + err = unpopulateTimeRFC3339(val, "StartedAt", &e.StartedAt) delete(rawMsg, key) - case "startOnCreation": - err = unpopulate(val, "StartOnCreation", &e.StartOnCreation) + case "status": + err = unpopulate(val, "Status", &e.Status) delete(rawMsg, key) - case "steps": - err = unpopulate(val, "Steps", &e.Steps) + case "stoppedAt": + err = unpopulateTimeRFC3339(val, "StoppedAt", &e.StoppedAt) delete(rawMsg, key) } if err != nil { @@ -1044,16 +1013,16 @@ func (e *ExperimentProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ExperimentStartOperationResult. -func (e ExperimentStartOperationResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExperimentListResult. +func (e ExperimentListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", e.Name) - populate(objectMap, "statusUrl", e.StatusURL) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentStartOperationResult. -func (e *ExperimentStartOperationResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentListResult. +func (e *ExperimentListResult) 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", e, err) @@ -1061,11 +1030,11 @@ func (e *ExperimentStartOperationResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &e.Name) + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) delete(rawMsg, key) - case "statusUrl": - err = unpopulate(val, "StatusURL", &e.StatusURL) + case "value": + err = unpopulate(val, "Value", &e.Value) delete(rawMsg, key) } if err != nil { @@ -1075,18 +1044,17 @@ func (e *ExperimentStartOperationResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ExperimentStatus. -func (e ExperimentStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExperimentProperties. +func (e ExperimentProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", e.ID) - populate(objectMap, "name", e.Name) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "type", e.Type) + populate(objectMap, "provisioningState", e.ProvisioningState) + populate(objectMap, "selectors", e.Selectors) + populate(objectMap, "steps", e.Steps) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentStatus. -func (e *ExperimentStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentProperties. +func (e *ExperimentProperties) 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", e, err) @@ -1094,48 +1062,14 @@ func (e *ExperimentStatus) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &e.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &e.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ExperimentStatusListResult. -func (e ExperimentStatusListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", e.NextLink) - populate(objectMap, "value", e.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentStatusListResult. -func (e *ExperimentStatusListResult) 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", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &e.NextLink) + case "selectors": + e.Selectors, err = unmarshalTargetSelectorClassificationArray(val) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &e.Value) + case "steps": + err = unpopulate(val, "Steps", &e.Steps) delete(rawMsg, key) } if err != nil { @@ -1145,17 +1079,16 @@ func (e *ExperimentStatusListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ExperimentStatusProperties. -func (e ExperimentStatusProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExperimentStep. +func (e ExperimentStep) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "createdDateUtc", e.CreatedDateUTC) - populateTimeRFC3339(objectMap, "endDateUtc", e.EndDateUTC) - populate(objectMap, "status", e.Status) + populate(objectMap, "branches", e.Branches) + populate(objectMap, "name", e.Name) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentStatusProperties. -func (e *ExperimentStatusProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentStep. +func (e *ExperimentStep) 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", e, err) @@ -1163,14 +1096,11 @@ func (e *ExperimentStatusProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "createdDateUtc": - err = unpopulateTimeRFC3339(val, "CreatedDateUTC", &e.CreatedDateUTC) - delete(rawMsg, key) - case "endDateUtc": - err = unpopulateTimeRFC3339(val, "EndDateUTC", &e.EndDateUTC) + case "branches": + err = unpopulate(val, "Branches", &e.Branches) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &e.Status) + case "name": + err = unpopulate(val, "Name", &e.Name) delete(rawMsg, key) } if err != nil { @@ -1207,33 +1137,6 @@ func (e *ExperimentUpdate) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Filter. -func (f Filter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["type"] = f.Type - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Filter. -func (f *Filter) 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 "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 KeyValuePair. func (k KeyValuePair) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1265,73 +1168,19 @@ func (k *KeyValuePair) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ListSelector. -func (l ListSelector) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "filter", l.Filter) - populate(objectMap, "id", l.ID) - populate(objectMap, "targets", l.Targets) - objectMap["type"] = SelectorTypeList - if l.AdditionalProperties != nil { - for key, val := range l.AdditionalProperties { - objectMap[key] = val - } - } + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ListSelector. -func (l *ListSelector) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "filter": - l.Filter, err = unmarshalFilterClassification(val) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &l.ID) - delete(rawMsg, key) - case "targets": - err = unpopulate(val, "Targets", &l.Targets) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &l.Type) - delete(rawMsg, key) - default: - if l.AdditionalProperties == nil { - l.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - l.AdditionalProperties[key] = aux - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Operation. -func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actionType", o.ActionType) - populate(objectMap, "display", o.Display) - populate(objectMap, "isDataAction", o.IsDataAction) - populate(objectMap, "name", o.Name) - populate(objectMap, "origin", o.Origin) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. -func (o *Operation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) 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", o, err) @@ -1432,59 +1281,48 @@ func (o *OperationListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type QuerySelector. -func (q QuerySelector) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationStatus. +func (o OperationStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "filter", q.Filter) - populate(objectMap, "id", q.ID) - populate(objectMap, "queryString", q.QueryString) - populate(objectMap, "subscriptionIds", q.SubscriptionIDs) - objectMap["type"] = SelectorTypeQuery - if q.AdditionalProperties != nil { - for key, val := range q.AdditionalProperties { - objectMap[key] = val - } - } + populate(objectMap, "endTime", o.EndTime) + populate(objectMap, "error", o.Error) + populate(objectMap, "id", o.ID) + populate(objectMap, "name", o.Name) + populate(objectMap, "startTime", o.StartTime) + populate(objectMap, "status", o.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type QuerySelector. -func (q *QuerySelector) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatus. +func (o *OperationStatus) 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", q, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } for key, val := range rawMsg { var err error switch key { - case "filter": - q.Filter, err = unmarshalFilterClassification(val) + case "endTime": + err = unpopulate(val, "EndTime", &o.EndTime) delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &q.ID) + case "error": + err = unpopulate(val, "Error", &o.Error) delete(rawMsg, key) - case "queryString": - err = unpopulate(val, "QueryString", &q.QueryString) + case "id": + err = unpopulate(val, "ID", &o.ID) delete(rawMsg, key) - case "subscriptionIds": - err = unpopulate(val, "SubscriptionIDs", &q.SubscriptionIDs) + case "name": + err = unpopulate(val, "Name", &o.Name) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &q.Type) + case "startTime": + err = unpopulate(val, "StartTime", &o.StartTime) delete(rawMsg, key) - default: - if q.AdditionalProperties == nil { - q.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - q.AdditionalProperties[key] = aux - } + case "status": + err = unpopulate(val, "Status", &o.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) + return fmt.Errorf("unmarshalling type %T: %v", o, err) } } return nil @@ -1564,22 +1402,59 @@ func (r *ResourceIdentity) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Selector. -func (s Selector) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StepStatus. +func (s StepStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "filter", s.Filter) - populate(objectMap, "id", s.ID) - objectMap["type"] = s.Type - if s.AdditionalProperties != nil { - for key, val := range s.AdditionalProperties { - objectMap[key] = val + populate(objectMap, "branches", s.Branches) + populate(objectMap, "status", s.Status) + populate(objectMap, "stepId", s.StepID) + populate(objectMap, "stepName", s.StepName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StepStatus. +func (s *StepStatus) 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", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "branches": + err = unpopulate(val, "Branches", &s.Branches) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + case "stepId": + err = unpopulate(val, "StepID", &s.StepID) + delete(rawMsg, key) + case "stepName": + err = unpopulate(val, "StepName", &s.StepName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Selector. -func (s *Selector) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) 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", s, err) @@ -1587,24 +1462,23 @@ func (s *Selector) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "filter": - s.Filter, err = unmarshalFilterClassification(val) + case "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &s.ID) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) delete(rawMsg, key) - default: - if s.AdditionalProperties == nil { - s.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - s.AdditionalProperties[key] = aux - } + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) delete(rawMsg, key) } if err != nil { @@ -1614,195 +1488,233 @@ func (s *Selector) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SimpleFilter. -func (s SimpleFilter) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Target. +func (t Target) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "parameters", s.Parameters) - objectMap["type"] = FilterTypeSimple + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "type", t.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SimpleFilter. -func (s *SimpleFilter) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Target. +func (t *Target) 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", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "parameters": - err = unpopulate(val, "Parameters", &s.Parameters) + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &t.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &s.Type) + err = unpopulate(val, "Type", &t.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SimpleFilterParameters. -func (s SimpleFilterParameters) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TargetFilter. +func (t TargetFilter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "zones", s.Zones) + objectMap["type"] = t.Type return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SimpleFilterParameters. -func (s *SimpleFilterParameters) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TargetFilter. +func (t *TargetFilter) 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", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "zones": - err = unpopulate(val, "Zones", &s.Zones) + case "type": + err = unpopulate(val, "Type", &t.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Step. -func (s Step) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TargetListResult. +func (t TargetListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "branches", s.Branches) - populate(objectMap, "name", s.Name) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Step. -func (s *Step) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TargetListResult. +func (t *TargetListResult) 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", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "branches": - err = unpopulate(val, "Branches", &s.Branches) + case "nextLink": + err = unpopulate(val, "NextLink", &t.NextLink) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) + case "value": + err = unpopulate(val, "Value", &t.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StepStatus. -func (s StepStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TargetListSelector. +func (t TargetListSelector) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "branches", s.Branches) - populate(objectMap, "status", s.Status) - populate(objectMap, "stepId", s.StepID) - populate(objectMap, "stepName", s.StepName) + populate(objectMap, "filter", t.Filter) + populate(objectMap, "id", t.ID) + populate(objectMap, "targets", t.Targets) + objectMap["type"] = SelectorTypeList + if t.AdditionalProperties != nil { + for key, val := range t.AdditionalProperties { + objectMap[key] = val + } + } return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StepStatus. -func (s *StepStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TargetListSelector. +func (t *TargetListSelector) 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", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "branches": - err = unpopulate(val, "Branches", &s.Branches) + case "filter": + t.Filter, err = unmarshalTargetFilterClassification(val) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &s.Status) + case "id": + err = unpopulate(val, "ID", &t.ID) delete(rawMsg, key) - case "stepId": - err = unpopulate(val, "StepID", &s.StepID) + case "targets": + err = unpopulate(val, "Targets", &t.Targets) delete(rawMsg, key) - case "stepName": - err = unpopulate(val, "StepName", &s.StepName) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + default: + if t.AdditionalProperties == nil { + t.AdditionalProperties = map[string]any{} + } + if val != nil { + var aux any + err = json.Unmarshal(val, &aux) + t.AdditionalProperties[key] = aux + } delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TargetQuerySelector. +func (t TargetQuerySelector) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + populate(objectMap, "filter", t.Filter) + populate(objectMap, "id", t.ID) + populate(objectMap, "queryString", t.QueryString) + populate(objectMap, "subscriptionIds", t.SubscriptionIDs) + objectMap["type"] = SelectorTypeQuery + if t.AdditionalProperties != nil { + for key, val := range t.AdditionalProperties { + objectMap[key] = val + } + } return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TargetQuerySelector. +func (t *TargetQuerySelector) 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", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + case "filter": + t.Filter, err = unmarshalTargetFilterClassification(val) delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) + case "id": + err = unpopulate(val, "ID", &t.ID) delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) + case "queryString": + err = unpopulate(val, "QueryString", &t.QueryString) delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + case "subscriptionIds": + err = unpopulate(val, "SubscriptionIDs", &t.SubscriptionIDs) delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + case "type": + err = unpopulate(val, "Type", &t.Type) delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + default: + if t.AdditionalProperties == nil { + t.AdditionalProperties = map[string]any{} + } + if val != nil { + var aux any + err = json.Unmarshal(val, &aux) + t.AdditionalProperties[key] = aux + } delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Target. -func (t Target) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TargetReference. +func (t TargetReference) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "properties", t.Properties) - populate(objectMap, "systemData", t.SystemData) populate(objectMap, "type", t.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Target. -func (t *Target) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TargetReference. +func (t *TargetReference) 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", t, err) @@ -1813,18 +1725,6 @@ func (t *Target) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &t.ID) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &t.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &t.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &t.SystemData) - delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &t.Type) delete(rawMsg, key) @@ -1836,16 +1736,22 @@ func (t *Target) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TargetListResult. -func (t TargetListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TargetSelector. +func (t TargetSelector) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", t.NextLink) - populate(objectMap, "value", t.Value) + populate(objectMap, "filter", t.Filter) + populate(objectMap, "id", t.ID) + objectMap["type"] = t.Type + if t.AdditionalProperties != nil { + for key, val := range t.AdditionalProperties { + objectMap[key] = val + } + } return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TargetListResult. -func (t *TargetListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TargetSelector. +func (t *TargetSelector) 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", t, err) @@ -1853,11 +1759,24 @@ func (t *TargetListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &t.NextLink) + case "filter": + t.Filter, err = unmarshalTargetFilterClassification(val) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &t.Value) + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + default: + if t.AdditionalProperties == nil { + t.AdditionalProperties = map[string]any{} + } + if val != nil { + var aux any + err = json.Unmarshal(val, &aux) + t.AdditionalProperties[key] = aux + } delete(rawMsg, key) } if err != nil { @@ -1867,16 +1786,16 @@ func (t *TargetListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TargetReference. -func (t TargetReference) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TargetSimpleFilter. +func (t TargetSimpleFilter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", t.ID) - populate(objectMap, "type", t.Type) + populate(objectMap, "parameters", t.Parameters) + objectMap["type"] = FilterTypeSimple return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TargetReference. -func (t *TargetReference) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TargetSimpleFilter. +func (t *TargetSimpleFilter) 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", t, err) @@ -1884,8 +1803,8 @@ func (t *TargetReference) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &t.ID) + case "parameters": + err = unpopulate(val, "Parameters", &t.Parameters) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &t.Type) @@ -1898,6 +1817,33 @@ func (t *TargetReference) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type TargetSimpleFilterParameters. +func (t TargetSimpleFilterParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "zones", t.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TargetSimpleFilterParameters. +func (t *TargetSimpleFilterParameters) 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", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "zones": + err = unpopulate(val, "Zones", &t.Zones) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type TargetType. func (t TargetType) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) diff --git a/sdk/resourcemanager/chaos/armchaos/operations_client.go b/sdk/resourcemanager/chaos/armchaos/operations_client.go index d5db5e3c8107..30411a5e4ad3 100644 --- a/sdk/resourcemanager/chaos/armchaos/operations_client.go +++ b/sdk/resourcemanager/chaos/armchaos/operations_client.go @@ -39,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListAllPager - Get a list all available Operations. // -// Generated from API version 2023-04-15-preview +// Generated from API version 2023-11-01 // - options - OperationsClientListAllOptions contains the optional parameters for the OperationsClient.NewListAllPager method. func (client *OperationsClient) NewListAllPager(options *OperationsClientListAllOptions) *runtime.Pager[OperationsClientListAllResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListAllResponse]{ @@ -77,7 +77,7 @@ func (client *OperationsClient) listAllCreateRequest(ctx context.Context, option return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-15-preview") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/chaos/armchaos/operationstatuses_client.go b/sdk/resourcemanager/chaos/armchaos/operationstatuses_client.go new file mode 100644 index 000000000000..e58ef9259787 --- /dev/null +++ b/sdk/resourcemanager/chaos/armchaos/operationstatuses_client.go @@ -0,0 +1,104 @@ +//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 armchaos + +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" +) + +// OperationStatusesClient contains the methods for the OperationStatuses group. +// Don't use this type directly, use NewOperationStatusesClient() instead. +type OperationStatusesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewOperationStatusesClient creates a new instance of OperationStatusesClient with the specified values. +// - subscriptionID - GUID that represents an Azure subscription ID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOperationStatusesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationStatusesClient, error) { + cl, err := arm.NewClient(moduleName+".OperationStatusesClient", moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationStatusesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get the status of a long running azure asynchronous operation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - location - The region name of operation. +// - asyncOperationID - The operation Id. +// - options - OperationStatusesClientGetOptions contains the optional parameters for the OperationStatusesClient.Get method. +func (client *OperationStatusesClient) Get(ctx context.Context, location string, asyncOperationID string, options *OperationStatusesClientGetOptions) (OperationStatusesClientGetResponse, error) { + var err error + req, err := client.getCreateRequest(ctx, location, asyncOperationID, options) + if err != nil { + return OperationStatusesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return OperationStatusesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return OperationStatusesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *OperationStatusesClient) getCreateRequest(ctx context.Context, location string, asyncOperationID string, options *OperationStatusesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{location}/operationsStatuses/{asyncOperationId}" + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if asyncOperationID == "" { + return nil, errors.New("parameter asyncOperationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{asyncOperationId}", url.PathEscape(asyncOperationID)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *OperationStatusesClient) getHandleResponse(resp *http.Response) (OperationStatusesClientGetResponse, error) { + result := OperationStatusesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { + return OperationStatusesClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/chaos/armchaos/options.go b/sdk/resourcemanager/chaos/armchaos/options.go index 6867b9ccb1af..088c8b736b47 100644 --- a/sdk/resourcemanager/chaos/armchaos/options.go +++ b/sdk/resourcemanager/chaos/armchaos/options.go @@ -40,24 +40,44 @@ type CapabilityTypesClientListOptions struct { ContinuationToken *string } -// ExperimentsClientCancelOptions contains the optional parameters for the ExperimentsClient.Cancel method. -type ExperimentsClientCancelOptions struct { - // placeholder for future optional parameters +// ExperimentsClientBeginCancelOptions contains the optional parameters for the ExperimentsClient.BeginCancel method. +type ExperimentsClientBeginCancelOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string } -// ExperimentsClientCreateOrUpdateOptions contains the optional parameters for the ExperimentsClient.CreateOrUpdate method. -type ExperimentsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters +// ExperimentsClientBeginCreateOrUpdateOptions contains the optional parameters for the ExperimentsClient.BeginCreateOrUpdate +// method. +type ExperimentsClientBeginCreateOrUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string } -// ExperimentsClientDeleteOptions contains the optional parameters for the ExperimentsClient.Delete method. -type ExperimentsClientDeleteOptions struct { +// ExperimentsClientBeginDeleteOptions contains the optional parameters for the ExperimentsClient.BeginDelete method. +type ExperimentsClientBeginDeleteOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExperimentsClientBeginStartOptions contains the optional parameters for the ExperimentsClient.BeginStart method. +type ExperimentsClientBeginStartOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExperimentsClientBeginUpdateOptions contains the optional parameters for the ExperimentsClient.BeginUpdate method. +type ExperimentsClientBeginUpdateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + +// ExperimentsClientExecutionDetailsOptions contains the optional parameters for the ExperimentsClient.ExecutionDetails method. +type ExperimentsClientExecutionDetailsOptions struct { // placeholder for future optional parameters } -// ExperimentsClientGetExecutionDetailsOptions contains the optional parameters for the ExperimentsClient.GetExecutionDetails -// method. -type ExperimentsClientGetExecutionDetailsOptions struct { +// ExperimentsClientGetExecutionOptions contains the optional parameters for the ExperimentsClient.GetExecution method. +type ExperimentsClientGetExecutionOptions struct { // placeholder for future optional parameters } @@ -66,8 +86,9 @@ type ExperimentsClientGetOptions struct { // placeholder for future optional parameters } -// ExperimentsClientGetStatusOptions contains the optional parameters for the ExperimentsClient.GetStatus method. -type ExperimentsClientGetStatusOptions struct { +// ExperimentsClientListAllExecutionsOptions contains the optional parameters for the ExperimentsClient.NewListAllExecutionsPager +// method. +type ExperimentsClientListAllExecutionsOptions struct { // placeholder for future optional parameters } @@ -81,18 +102,6 @@ type ExperimentsClientListAllOptions struct { Running *bool } -// ExperimentsClientListAllStatusesOptions contains the optional parameters for the ExperimentsClient.NewListAllStatusesPager -// method. -type ExperimentsClientListAllStatusesOptions struct { - // placeholder for future optional parameters -} - -// ExperimentsClientListExecutionDetailsOptions contains the optional parameters for the ExperimentsClient.NewListExecutionDetailsPager -// method. -type ExperimentsClientListExecutionDetailsOptions struct { - // placeholder for future optional parameters -} - // ExperimentsClientListOptions contains the optional parameters for the ExperimentsClient.NewListPager method. type ExperimentsClientListOptions struct { // String that sets the continuation token. @@ -103,13 +112,8 @@ type ExperimentsClientListOptions struct { Running *bool } -// ExperimentsClientStartOptions contains the optional parameters for the ExperimentsClient.Start method. -type ExperimentsClientStartOptions struct { - // placeholder for future optional parameters -} - -// ExperimentsClientUpdateOptions contains the optional parameters for the ExperimentsClient.Update method. -type ExperimentsClientUpdateOptions struct { +// OperationStatusesClientGetOptions contains the optional parameters for the OperationStatusesClient.Get method. +type OperationStatusesClientGetOptions struct { // placeholder for future optional parameters } diff --git a/sdk/resourcemanager/chaos/armchaos/polymorphic_helpers.go b/sdk/resourcemanager/chaos/armchaos/polymorphic_helpers.go index 1cf222251112..f356cf5d9da1 100644 --- a/sdk/resourcemanager/chaos/armchaos/polymorphic_helpers.go +++ b/sdk/resourcemanager/chaos/armchaos/polymorphic_helpers.go @@ -10,7 +10,7 @@ package armchaos import "encoding/json" -func unmarshalActionClassification(rawMsg json.RawMessage) (ActionClassification, error) { +func unmarshalExperimentActionClassification(rawMsg json.RawMessage) (ExperimentActionClassification, error) { if rawMsg == nil { return nil, nil } @@ -18,7 +18,7 @@ func unmarshalActionClassification(rawMsg json.RawMessage) (ActionClassification if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } - var b ActionClassification + var b ExperimentActionClassification switch m["type"] { case "continuous": b = &ContinuousAction{} @@ -27,7 +27,7 @@ func unmarshalActionClassification(rawMsg json.RawMessage) (ActionClassification case "discrete": b = &DiscreteAction{} default: - b = &Action{} + b = &ExperimentAction{} } if err := json.Unmarshal(rawMsg, b); err != nil { return nil, err @@ -35,7 +35,7 @@ func unmarshalActionClassification(rawMsg json.RawMessage) (ActionClassification return b, nil } -func unmarshalActionClassificationArray(rawMsg json.RawMessage) ([]ActionClassification, error) { +func unmarshalExperimentActionClassificationArray(rawMsg json.RawMessage) ([]ExperimentActionClassification, error) { if rawMsg == nil { return nil, nil } @@ -43,9 +43,9 @@ func unmarshalActionClassificationArray(rawMsg json.RawMessage) ([]ActionClassif if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { return nil, err } - fArray := make([]ActionClassification, len(rawMessages)) + fArray := make([]ExperimentActionClassification, len(rawMessages)) for index, rawMessage := range rawMessages { - f, err := unmarshalActionClassification(rawMessage) + f, err := unmarshalExperimentActionClassification(rawMessage) if err != nil { return nil, err } @@ -54,7 +54,7 @@ func unmarshalActionClassificationArray(rawMsg json.RawMessage) ([]ActionClassif return fArray, nil } -func unmarshalFilterClassification(rawMsg json.RawMessage) (FilterClassification, error) { +func unmarshalTargetFilterClassification(rawMsg json.RawMessage) (TargetFilterClassification, error) { if rawMsg == nil { return nil, nil } @@ -62,12 +62,12 @@ func unmarshalFilterClassification(rawMsg json.RawMessage) (FilterClassification if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } - var b FilterClassification + var b TargetFilterClassification switch m["type"] { case string(FilterTypeSimple): - b = &SimpleFilter{} + b = &TargetSimpleFilter{} default: - b = &Filter{} + b = &TargetFilter{} } if err := json.Unmarshal(rawMsg, b); err != nil { return nil, err @@ -75,7 +75,7 @@ func unmarshalFilterClassification(rawMsg json.RawMessage) (FilterClassification return b, nil } -func unmarshalSelectorClassification(rawMsg json.RawMessage) (SelectorClassification, error) { +func unmarshalTargetSelectorClassification(rawMsg json.RawMessage) (TargetSelectorClassification, error) { if rawMsg == nil { return nil, nil } @@ -83,14 +83,14 @@ func unmarshalSelectorClassification(rawMsg json.RawMessage) (SelectorClassifica if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } - var b SelectorClassification + var b TargetSelectorClassification switch m["type"] { case string(SelectorTypeList): - b = &ListSelector{} + b = &TargetListSelector{} case string(SelectorTypeQuery): - b = &QuerySelector{} + b = &TargetQuerySelector{} default: - b = &Selector{} + b = &TargetSelector{} } if err := json.Unmarshal(rawMsg, b); err != nil { return nil, err @@ -98,7 +98,7 @@ func unmarshalSelectorClassification(rawMsg json.RawMessage) (SelectorClassifica return b, nil } -func unmarshalSelectorClassificationArray(rawMsg json.RawMessage) ([]SelectorClassification, error) { +func unmarshalTargetSelectorClassificationArray(rawMsg json.RawMessage) ([]TargetSelectorClassification, error) { if rawMsg == nil { return nil, nil } @@ -106,9 +106,9 @@ func unmarshalSelectorClassificationArray(rawMsg json.RawMessage) ([]SelectorCla if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { return nil, err } - fArray := make([]SelectorClassification, len(rawMessages)) + fArray := make([]TargetSelectorClassification, len(rawMessages)) for index, rawMessage := range rawMessages { - f, err := unmarshalSelectorClassification(rawMessage) + f, err := unmarshalTargetSelectorClassification(rawMessage) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/chaos/armchaos/response_types.go b/sdk/resourcemanager/chaos/armchaos/response_types.go index 909d15f6374f..7f27a717922c 100644 --- a/sdk/resourcemanager/chaos/armchaos/response_types.go +++ b/sdk/resourcemanager/chaos/armchaos/response_types.go @@ -43,39 +43,44 @@ type CapabilityTypesClientListResponse struct { CapabilityTypeListResult } -// ExperimentsClientCancelResponse contains the response from method ExperimentsClient.Cancel. +// ExperimentsClientCancelResponse contains the response from method ExperimentsClient.BeginCancel. type ExperimentsClientCancelResponse struct { - // Model that represents the result of a cancel Experiment operation. - ExperimentCancelOperationResult + // placeholder for future response values } -// ExperimentsClientCreateOrUpdateResponse contains the response from method ExperimentsClient.CreateOrUpdate. +// ExperimentsClientCreateOrUpdateResponse contains the response from method ExperimentsClient.BeginCreateOrUpdate. type ExperimentsClientCreateOrUpdateResponse struct { // Model that represents a Experiment resource. Experiment } -// ExperimentsClientDeleteResponse contains the response from method ExperimentsClient.Delete. +// ExperimentsClientDeleteResponse contains the response from method ExperimentsClient.BeginDelete. type ExperimentsClientDeleteResponse struct { // placeholder for future response values } -// ExperimentsClientGetExecutionDetailsResponse contains the response from method ExperimentsClient.GetExecutionDetails. -type ExperimentsClientGetExecutionDetailsResponse struct { - // Model that represents the execution details of a Experiment. +// ExperimentsClientExecutionDetailsResponse contains the response from method ExperimentsClient.ExecutionDetails. +type ExperimentsClientExecutionDetailsResponse struct { + // Model that represents the execution details of an Experiment. ExperimentExecutionDetails } +// ExperimentsClientGetExecutionResponse contains the response from method ExperimentsClient.GetExecution. +type ExperimentsClientGetExecutionResponse struct { + // Model that represents the execution of a Experiment. + ExperimentExecution +} + // ExperimentsClientGetResponse contains the response from method ExperimentsClient.Get. type ExperimentsClientGetResponse struct { // Model that represents a Experiment resource. Experiment } -// ExperimentsClientGetStatusResponse contains the response from method ExperimentsClient.GetStatus. -type ExperimentsClientGetStatusResponse struct { - // Model that represents the status of a Experiment. - ExperimentStatus +// ExperimentsClientListAllExecutionsResponse contains the response from method ExperimentsClient.NewListAllExecutionsPager. +type ExperimentsClientListAllExecutionsResponse struct { + // Model that represents a list of Experiment executions and a link for pagination. + ExperimentExecutionListResult } // ExperimentsClientListAllResponse contains the response from method ExperimentsClient.NewListAllPager. @@ -84,36 +89,29 @@ type ExperimentsClientListAllResponse struct { ExperimentListResult } -// ExperimentsClientListAllStatusesResponse contains the response from method ExperimentsClient.NewListAllStatusesPager. -type ExperimentsClientListAllStatusesResponse struct { - // Model that represents a list of Experiment statuses and a link for pagination. - ExperimentStatusListResult -} - -// ExperimentsClientListExecutionDetailsResponse contains the response from method ExperimentsClient.NewListExecutionDetailsPager. -type ExperimentsClientListExecutionDetailsResponse struct { - // Model that represents a list of Experiment execution details and a link for pagination. - ExperimentExecutionDetailsListResult -} - // ExperimentsClientListResponse contains the response from method ExperimentsClient.NewListPager. type ExperimentsClientListResponse struct { // Model that represents a list of Experiment resources and a link for pagination. ExperimentListResult } -// ExperimentsClientStartResponse contains the response from method ExperimentsClient.Start. +// ExperimentsClientStartResponse contains the response from method ExperimentsClient.BeginStart. type ExperimentsClientStartResponse struct { - // Model that represents the result of a start Experiment operation. - ExperimentStartOperationResult + // placeholder for future response values } -// ExperimentsClientUpdateResponse contains the response from method ExperimentsClient.Update. +// ExperimentsClientUpdateResponse contains the response from method ExperimentsClient.BeginUpdate. type ExperimentsClientUpdateResponse struct { // Model that represents a Experiment resource. Experiment } +// OperationStatusesClientGetResponse contains the response from method OperationStatusesClient.Get. +type OperationStatusesClientGetResponse struct { + // The status of operation. + OperationStatus +} + // OperationsClientListAllResponse contains the response from method OperationsClient.NewListAllPager. type OperationsClientListAllResponse 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. diff --git a/sdk/resourcemanager/chaos/armchaos/targets_client.go b/sdk/resourcemanager/chaos/armchaos/targets_client.go index d6f30860e580..fd12fd06e262 100644 --- a/sdk/resourcemanager/chaos/armchaos/targets_client.go +++ b/sdk/resourcemanager/chaos/armchaos/targets_client.go @@ -46,7 +46,7 @@ func NewTargetsClient(subscriptionID string, credential azcore.TokenCredential, // CreateOrUpdate - Create or update a Target resource that extends a tracked regional resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-15-preview +// Generated from API version 2023-11-01 // - resourceGroupName - String that represents an Azure resource group. // - parentProviderNamespace - String that represents a resource provider namespace. // - parentResourceType - String that represents a resource type. @@ -104,7 +104,7 @@ func (client *TargetsClient) createOrUpdateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-15-preview") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, target); err != nil { @@ -125,7 +125,7 @@ func (client *TargetsClient) createOrUpdateHandleResponse(resp *http.Response) ( // Delete - Delete a Target resource that extends a tracked regional resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-15-preview +// Generated from API version 2023-11-01 // - resourceGroupName - String that represents an Azure resource group. // - parentProviderNamespace - String that represents a resource provider namespace. // - parentResourceType - String that represents a resource type. @@ -181,7 +181,7 @@ func (client *TargetsClient) deleteCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-15-preview") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -190,7 +190,7 @@ func (client *TargetsClient) deleteCreateRequest(ctx context.Context, resourceGr // Get - Get a Target resource that extends a tracked regional resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-15-preview +// Generated from API version 2023-11-01 // - resourceGroupName - String that represents an Azure resource group. // - parentProviderNamespace - String that represents a resource provider namespace. // - parentResourceType - String that represents a resource type. @@ -247,7 +247,7 @@ func (client *TargetsClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-15-preview") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -264,7 +264,7 @@ func (client *TargetsClient) getHandleResponse(resp *http.Response) (TargetsClie // NewListPager - Get a list of Target resources that extend a tracked regional resource. // -// Generated from API version 2023-04-15-preview +// Generated from API version 2023-11-01 // - resourceGroupName - String that represents an Azure resource group. // - parentProviderNamespace - String that represents a resource provider namespace. // - parentResourceType - String that represents a resource type. @@ -326,7 +326,7 @@ func (client *TargetsClient) listCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-15-preview") + reqQP.Set("api-version", "2023-11-01") if options != nil && options.ContinuationToken != nil { reqQP.Set("continuationToken", *options.ContinuationToken) } diff --git a/sdk/resourcemanager/chaos/armchaos/targets_client_example_test.go b/sdk/resourcemanager/chaos/armchaos/targets_client_example_test.go deleted file mode 100644 index cd135c220823..000000000000 --- a/sdk/resourcemanager/chaos/armchaos/targets_client_example_test.go +++ /dev/null @@ -1,169 +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 armchaos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListTargets.json -func ExampleTargetsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTargetsClient().NewListPager("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", &armchaos.TargetsClientListOptions{ContinuationToken: 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.TargetListResult = armchaos.TargetListResult{ - // Value: []*armchaos.Target{ - // { - // Name: to.Ptr("Microsoft-Agent"), - // Type: to.Ptr("Microsoft.Chaos/targets"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-Agent"), - // Location: to.Ptr("centraluseuap"), - // Properties: map[string]any{ - // "agentProfileId": "ac4e8251-fdc9-4277-8e87-dc57fe5794cf", - // "identities": []any{ - // map[string]any{ - // "type": "CertificateSubjectIssuer", - // "subject": "CN=example.subject", - // }, - // }, - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetATarget.json -func ExampleTargetsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTargetsClient().Get(ctx, "exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-Agent", 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.Target = armchaos.Target{ - // Name: to.Ptr("Microsoft-Agent"), - // Type: to.Ptr("Microsoft.Chaos/targets"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-Agent"), - // Location: to.Ptr("centraluseuap"), - // Properties: map[string]any{ - // "agentProfileId": "ac4e8251-fdc9-4277-8e87-dc57fe5794cf", - // "identities": []any{ - // map[string]any{ - // "type": "CertificateSubjectIssuer", - // "subject": "CN=example.subject", - // }, - // }, - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/DeleteATarget.json -func ExampleTargetsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewTargetsClient().Delete(ctx, "exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-Agent", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/CreateOrUpdateATarget.json -func ExampleTargetsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTargetsClient().CreateOrUpdate(ctx, "exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-Agent", armchaos.Target{ - Properties: map[string]any{ - "identities": []any{ - map[string]any{ - "type": "CertificateSubjectIssuer", - "subject": "CN=example.subject", - }, - }, - }, - }, 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.Target = armchaos.Target{ - // Name: to.Ptr("Microsoft-Agent"), - // Type: to.Ptr("Microsoft.Chaos/targets"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-Agent"), - // Location: to.Ptr("centraluseuap"), - // Properties: map[string]any{ - // "agentProfileId": "ac4e8251-fdc9-4277-8e87-dc57fe5794cf", - // "identities": []any{ - // map[string]any{ - // "type": "CertificateSubjectIssuer", - // "subject": "CN=example.subject", - // }, - // }, - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), - // }, - // } -} diff --git a/sdk/resourcemanager/chaos/armchaos/targettypes_client.go b/sdk/resourcemanager/chaos/armchaos/targettypes_client.go index 2ad9f96c43fd..435c7aed5966 100644 --- a/sdk/resourcemanager/chaos/armchaos/targettypes_client.go +++ b/sdk/resourcemanager/chaos/armchaos/targettypes_client.go @@ -46,7 +46,7 @@ func NewTargetTypesClient(subscriptionID string, credential azcore.TokenCredenti // Get - Get a Target Type resources for given location. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-04-15-preview +// Generated from API version 2023-11-01 // - locationName - String that represents a Location resource name. // - targetTypeName - String that represents a Target Type resource name. // - options - TargetTypesClientGetOptions contains the optional parameters for the TargetTypesClient.Get method. @@ -88,7 +88,7 @@ func (client *TargetTypesClient) getCreateRequest(ctx context.Context, locationN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-15-preview") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -105,7 +105,7 @@ func (client *TargetTypesClient) getHandleResponse(resp *http.Response) (TargetT // NewListPager - Get a list of Target Type resources for given location. // -// Generated from API version 2023-04-15-preview +// Generated from API version 2023-11-01 // - locationName - String that represents a Location resource name. // - options - TargetTypesClientListOptions contains the optional parameters for the TargetTypesClient.NewListPager method. func (client *TargetTypesClient) NewListPager(locationName string, options *TargetTypesClientListOptions) *runtime.Pager[TargetTypesClientListResponse] { @@ -152,7 +152,7 @@ func (client *TargetTypesClient) listCreateRequest(ctx context.Context, location return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-04-15-preview") + reqQP.Set("api-version", "2023-11-01") if options != nil && options.ContinuationToken != nil { reqQP.Set("continuationToken", *options.ContinuationToken) } diff --git a/sdk/resourcemanager/chaos/armchaos/targettypes_client_example_test.go b/sdk/resourcemanager/chaos/armchaos/targettypes_client_example_test.go deleted file mode 100644 index fd9b930bf1fa..000000000000 --- a/sdk/resourcemanager/chaos/armchaos/targettypes_client_example_test.go +++ /dev/null @@ -1,94 +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 armchaos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/ListTargetTypes.json -func ExampleTargetTypesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTargetTypesClient().NewListPager("westus2", &armchaos.TargetTypesClientListOptions{ContinuationToken: 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.TargetTypeListResult = armchaos.TargetTypeListResult{ - // Value: []*armchaos.TargetType{ - // { - // Name: to.Ptr("Microsoft-Agent"), - // Type: to.Ptr("Microsoft.Chaos/locations/targetTypes"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/providers/Microsoft.Chaos/locations/westus2/targetTypes/Microsoft-Agent"), - // Location: to.Ptr("centraluseuap"), - // Properties: &armchaos.TargetTypeProperties{ - // Description: to.Ptr("A target represents Chaos Agent."), - // DisplayName: to.Ptr("Chaos Agent"), - // PropertiesSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine.json"), - // ResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines"), - // to.Ptr("Microsoft.Compute/virtualMachineScaleSets")}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/4cd95123fb961c68740565a1efcaa5e43bd35802/specification/chaos/resource-manager/Microsoft.Chaos/preview/2023-04-15-preview/examples/GetATargetType.json -func ExampleTargetTypesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTargetTypesClient().Get(ctx, "westus2", "Microsoft-Agent", 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.TargetType = armchaos.TargetType{ - // Name: to.Ptr("Microsoft-Agent"), - // Type: to.Ptr("Microsoft.Chaos/locations/targetTypes"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/providers/Microsoft.Chaos/locations/westus2/targetTypes/Microsoft-Agent"), - // Location: to.Ptr("centraluseuap"), - // Properties: &armchaos.TargetTypeProperties{ - // Description: to.Ptr("A target represents Chaos Agent."), - // DisplayName: to.Ptr("Chaos Agent"), - // PropertiesSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine.json"), - // ResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines"), - // to.Ptr("Microsoft.Compute/virtualMachineScaleSets")}, - // }, - // } -}