From ba15e8b93c6a95ee3775fc8ef7d7173522b91ebe Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 13 May 2025 14:56:36 +0000 Subject: [PATCH] CodeGen from PR 34637 in Azure/azure-rest-api-specs Merge 13d4cccd8042cb6668f7f88eb26aba928d417b5e into 903e7ca5b4afaa5828df1fb709aa0f5801966087 --- .../loadtesting/armloadtesting/CHANGELOG.md | 28 ++ .../loadtesting/armloadtesting/README.md | 2 +- .../loadtesting/armloadtesting/autorest.md | 6 +- .../armloadtesting/client_factory.go | 31 +- .../loadtesting/armloadtesting/constants.go | 21 +- .../armloadtesting/fake/internal.go | 8 +- .../armloadtesting/fake/loadtests_server.go | 86 ++-- .../armloadtesting/fake/operations_server.go | 54 ++- .../armloadtesting/fake/quotas_server.go | 64 ++- .../armloadtesting/fake/server_factory.go | 12 +- .../armloadtesting/fake/time_rfc3339.go | 86 ---- .../loadtesting/armloadtesting/go.mod | 4 +- .../armloadtesting/loadtests_client.go | 81 ++-- .../loadtests_client_example_test.go | 459 ------------------ .../loadtestservice_live_test.go | 2 +- .../loadtesting/armloadtesting/models.go | 101 ++-- .../armloadtesting/models_serde.go | 73 ++- .../armloadtesting/operations_client.go | 7 +- .../operations_client_example_test.go | 76 --- .../loadtesting/armloadtesting/options.go | 9 +- .../armloadtesting/quotas_client.go | 33 +- .../quotas_client_example_test.go | 124 ----- .../{response_types.go => responses.go} | 23 +- .../armloadtesting/time_rfc3339.go | 48 +- 24 files changed, 385 insertions(+), 1053 deletions(-) delete mode 100644 sdk/resourcemanager/loadtesting/armloadtesting/fake/time_rfc3339.go delete mode 100644 sdk/resourcemanager/loadtesting/armloadtesting/loadtests_client_example_test.go delete mode 100644 sdk/resourcemanager/loadtesting/armloadtesting/operations_client_example_test.go delete mode 100644 sdk/resourcemanager/loadtesting/armloadtesting/quotas_client_example_test.go rename sdk/resourcemanager/loadtesting/armloadtesting/{response_types.go => responses.go} (87%) diff --git a/sdk/resourcemanager/loadtesting/armloadtesting/CHANGELOG.md b/sdk/resourcemanager/loadtesting/armloadtesting/CHANGELOG.md index 22bec5129b54..ec2f54298463 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/CHANGELOG.md +++ b/sdk/resourcemanager/loadtesting/armloadtesting/CHANGELOG.md @@ -1,5 +1,33 @@ # Release History +## 2.0.0 (2025-05-13) +### Breaking Changes + +- Function `*LoadTestsClient.BeginUpdate` parameter(s) have been changed from `(context.Context, string, string, LoadTestResourcePatchRequestBody, *LoadTestsClientBeginUpdateOptions)` to `(context.Context, string, string, LoadTestResourceUpdate, *LoadTestsClientBeginUpdateOptions)` +- Struct `LoadTestResourcePageList` has been removed +- Struct `LoadTestResourcePatchRequestBody` has been removed +- Struct `LoadTestResourcePatchRequestBodyProperties` has been removed +- Struct `OutboundEnvironmentEndpointCollection` has been removed +- Struct `QuotaResourceList` has been removed +- Field `LoadTestResourcePageList` of struct `LoadTestsClientListByResourceGroupResponse` has been removed +- Field `LoadTestResourcePageList` of struct `LoadTestsClientListBySubscriptionResponse` has been removed +- Field `OutboundEnvironmentEndpointCollection` of struct `LoadTestsClientListOutboundNetworkDependenciesEndpointsResponse` has been removed +- Field `ID`, `Name`, `SystemData`, `Type` of struct `QuotaBucketRequest` has been removed +- Field `QuotaResourceList` of struct `QuotasClientListResponse` has been removed + +### Features Added + +- New struct `LoadTestResourceListResult` +- New struct `LoadTestResourceUpdate` +- New struct `LoadTestResourceUpdateProperties` +- New struct `PagedOutboundEnvironmentEndpoint` +- New struct `QuotaResourceListResult` +- New anonymous field `LoadTestResourceListResult` in struct `LoadTestsClientListByResourceGroupResponse` +- New anonymous field `LoadTestResourceListResult` in struct `LoadTestsClientListBySubscriptionResponse` +- New anonymous field `PagedOutboundEnvironmentEndpoint` in struct `LoadTestsClientListOutboundNetworkDependenciesEndpointsResponse` +- New anonymous field `QuotaResourceListResult` in struct `QuotasClientListResponse` + + ## 1.2.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/loadtesting/armloadtesting/README.md b/sdk/resourcemanager/loadtesting/armloadtesting/README.md index 21f24b798a92..5d71c3af202d 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/README.md +++ b/sdk/resourcemanager/loadtesting/armloadtesting/README.md @@ -18,7 +18,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure Load Testing module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/loadtesting/armloadtesting +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/loadtesting/armloadtesting/v2 ``` ## Authorization diff --git a/sdk/resourcemanager/loadtesting/armloadtesting/autorest.md b/sdk/resourcemanager/loadtesting/armloadtesting/autorest.md index 2fde958ff520..8bb88396d154 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/autorest.md +++ b/sdk/resourcemanager/loadtesting/armloadtesting/autorest.md @@ -5,10 +5,10 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/loadtestservice/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/loadtestservice/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/loadtestservice/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/loadtestservice/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.2.0 +module-version: 2.0.0 # v1.0.0 and v1.0.1 has been retracted because of mistake. When this RP goes GA, it starts at version v1.0.2 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/loadtesting/armloadtesting/client_factory.go b/sdk/resourcemanager/loadtesting/armloadtesting/client_factory.go index e2eb7f96a538..77d06cfe6692 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/client_factory.go +++ b/sdk/resourcemanager/loadtesting/armloadtesting/client_factory.go @@ -1,6 +1,3 @@ -//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. @@ -17,40 +14,44 @@ import ( // Don't use this type directly, use NewClientFactory instead. type ClientFactory struct { subscriptionID string - credential azcore.TokenCredential - options *arm.ClientOptions + internal *arm.Client } // NewClientFactory creates a new instance of ClientFactory with the specified values. // The parameter values will be propagated to any client created from this factory. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { - _, err := arm.NewClient(moduleName, moduleVersion, credential, options) + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } return &ClientFactory{ - subscriptionID: subscriptionID, credential: credential, - options: options.Clone(), + subscriptionID: subscriptionID, + internal: internal, }, nil } // NewLoadTestsClient creates a new instance of LoadTestsClient. func (c *ClientFactory) NewLoadTestsClient() *LoadTestsClient { - subClient, _ := NewLoadTestsClient(c.subscriptionID, c.credential, c.options) - return subClient + return &LoadTestsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewOperationsClient creates a new instance of OperationsClient. func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) - return subClient + return &OperationsClient{ + internal: c.internal, + } } // NewQuotasClient creates a new instance of QuotasClient. func (c *ClientFactory) NewQuotasClient() *QuotasClient { - subClient, _ := NewQuotasClient(c.subscriptionID, c.credential, c.options) - return subClient + return &QuotasClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } diff --git a/sdk/resourcemanager/loadtesting/armloadtesting/constants.go b/sdk/resourcemanager/loadtesting/armloadtesting/constants.go index 5b13e215f4cf..2e6886f68c78 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/constants.go +++ b/sdk/resourcemanager/loadtesting/armloadtesting/constants.go @@ -1,6 +1,3 @@ -//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. @@ -10,7 +7,7 @@ package armloadtesting const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/loadtesting/armloadtesting" - moduleVersion = "v1.2.0" + moduleVersion = "v2.0.0" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -90,9 +87,13 @@ func PossibleOriginValues() []Origin { type ResourceState string const ( - ResourceStateCanceled ResourceState = "Canceled" - ResourceStateDeleted ResourceState = "Deleted" - ResourceStateFailed ResourceState = "Failed" + // ResourceStateCanceled - Resource creation was canceled. + ResourceStateCanceled ResourceState = "Canceled" + // ResourceStateDeleted - Deleted state. + ResourceStateDeleted ResourceState = "Deleted" + // ResourceStateFailed - Resource creation failed. + ResourceStateFailed ResourceState = "Failed" + // ResourceStateSucceeded - Resource has been created. ResourceStateSucceeded ResourceState = "Succeeded" ) @@ -106,12 +107,14 @@ func PossibleResourceStateValues() []ResourceState { } } -// Type - Managed identity type to use for accessing encryption key Url +// Type - Managed identity type to use for accessing encryption key Url. type Type string const ( + // TypeSystemAssigned - System assigned identity. TypeSystemAssigned Type = "SystemAssigned" - TypeUserAssigned Type = "UserAssigned" + // TypeUserAssigned - User assigned identity. + TypeUserAssigned Type = "UserAssigned" ) // PossibleTypeValues returns the possible values for the Type const type. diff --git a/sdk/resourcemanager/loadtesting/armloadtesting/fake/internal.go b/sdk/resourcemanager/loadtesting/armloadtesting/fake/internal.go index 5f75802a569e..4b65adc76adb 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/fake/internal.go +++ b/sdk/resourcemanager/loadtesting/armloadtesting/fake/internal.go @@ -1,6 +1,3 @@ -//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. @@ -14,6 +11,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/loadtesting/armloadtesting/fake/loadtests_server.go b/sdk/resourcemanager/loadtesting/armloadtesting/fake/loadtests_server.go index 262e95a6be41..46d2b68ac429 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/fake/loadtests_server.go +++ b/sdk/resourcemanager/loadtesting/armloadtesting/fake/loadtests_server.go @@ -1,6 +1,3 @@ -//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. @@ -16,7 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/loadtesting/armloadtesting" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/loadtesting/armloadtesting/v2" "net/http" "net/url" "regexp" @@ -26,7 +23,7 @@ import ( type LoadTestsServer struct { // BeginCreateOrUpdate is the fake for method LoadTestsClient.BeginCreateOrUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, loadTestName string, loadTestResource armloadtesting.LoadTestResource, options *armloadtesting.LoadTestsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armloadtesting.LoadTestsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, loadTestName string, resource armloadtesting.LoadTestResource, options *armloadtesting.LoadTestsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armloadtesting.LoadTestsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method LoadTestsClient.BeginDelete // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent @@ -50,7 +47,7 @@ type LoadTestsServer struct { // BeginUpdate is the fake for method LoadTestsClient.BeginUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, loadTestName string, loadTestResourcePatchRequestBody armloadtesting.LoadTestResourcePatchRequestBody, options *armloadtesting.LoadTestsClientBeginUpdateOptions) (resp azfake.PollerResponder[armloadtesting.LoadTestsClientUpdateResponse], errResp azfake.ErrorResponder) + BeginUpdate func(ctx context.Context, resourceGroupName string, loadTestName string, properties armloadtesting.LoadTestResourceUpdate, options *armloadtesting.LoadTestsClientBeginUpdateOptions) (resp azfake.PollerResponder[armloadtesting.LoadTestsClientUpdateResponse], errResp azfake.ErrorResponder) } // NewLoadTestsServerTransport creates a new instance of LoadTestsServerTransport with the provided implementation. @@ -88,33 +85,52 @@ func (l *LoadTestsServerTransport) Do(req *http.Request) (*http.Response, error) return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "LoadTestsClient.BeginCreateOrUpdate": - resp, err = l.dispatchBeginCreateOrUpdate(req) - case "LoadTestsClient.BeginDelete": - resp, err = l.dispatchBeginDelete(req) - case "LoadTestsClient.Get": - resp, err = l.dispatchGet(req) - case "LoadTestsClient.NewListByResourceGroupPager": - resp, err = l.dispatchNewListByResourceGroupPager(req) - case "LoadTestsClient.NewListBySubscriptionPager": - resp, err = l.dispatchNewListBySubscriptionPager(req) - case "LoadTestsClient.NewListOutboundNetworkDependenciesEndpointsPager": - resp, err = l.dispatchNewListOutboundNetworkDependenciesEndpointsPager(req) - case "LoadTestsClient.BeginUpdate": - resp, err = l.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return l.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (l *LoadTestsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - return resp, nil + go func() { + var intercepted bool + var res result + if loadTestsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = loadTestsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "LoadTestsClient.BeginCreateOrUpdate": + res.resp, res.err = l.dispatchBeginCreateOrUpdate(req) + case "LoadTestsClient.BeginDelete": + res.resp, res.err = l.dispatchBeginDelete(req) + case "LoadTestsClient.Get": + res.resp, res.err = l.dispatchGet(req) + case "LoadTestsClient.NewListByResourceGroupPager": + res.resp, res.err = l.dispatchNewListByResourceGroupPager(req) + case "LoadTestsClient.NewListBySubscriptionPager": + res.resp, res.err = l.dispatchNewListBySubscriptionPager(req) + case "LoadTestsClient.NewListOutboundNetworkDependenciesEndpointsPager": + res.resp, res.err = l.dispatchNewListOutboundNetworkDependenciesEndpointsPager(req) + case "LoadTestsClient.BeginUpdate": + res.resp, res.err = l.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (l *LoadTestsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -365,7 +381,7 @@ func (l *LoadTestsServerTransport) dispatchBeginUpdate(req *http.Request) (*http if matches == nil || len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - body, err := server.UnmarshalRequestAsJSON[armloadtesting.LoadTestResourcePatchRequestBody](req) + body, err := server.UnmarshalRequestAsJSON[armloadtesting.LoadTestResourceUpdate](req) if err != nil { return nil, err } @@ -400,3 +416,9 @@ func (l *LoadTestsServerTransport) dispatchBeginUpdate(req *http.Request) (*http return resp, nil } + +// set this to conditionally intercept incoming requests to LoadTestsServerTransport +var loadTestsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/loadtesting/armloadtesting/fake/operations_server.go b/sdk/resourcemanager/loadtesting/armloadtesting/fake/operations_server.go index b697bdd5da9d..f472689a888d 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/fake/operations_server.go +++ b/sdk/resourcemanager/loadtesting/armloadtesting/fake/operations_server.go @@ -1,6 +1,3 @@ -//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. @@ -15,7 +12,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/loadtesting/armloadtesting" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/loadtesting/armloadtesting/v2" "net/http" ) @@ -51,21 +48,40 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return o.dispatchToMethodFake(req, method) +} - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -94,3 +110,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/loadtesting/armloadtesting/fake/quotas_server.go b/sdk/resourcemanager/loadtesting/armloadtesting/fake/quotas_server.go index 660c2aa50377..1c79f49d11b9 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/fake/quotas_server.go +++ b/sdk/resourcemanager/loadtesting/armloadtesting/fake/quotas_server.go @@ -1,6 +1,3 @@ -//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. @@ -16,7 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/loadtesting/armloadtesting" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/loadtesting/armloadtesting/v2" "net/http" "net/url" "regexp" @@ -26,7 +23,7 @@ import ( type QuotasServer struct { // CheckAvailability is the fake for method QuotasClient.CheckAvailability // HTTP status codes to indicate success: http.StatusOK - CheckAvailability func(ctx context.Context, location string, quotaBucketName string, quotaBucketRequest armloadtesting.QuotaBucketRequest, options *armloadtesting.QuotasClientCheckAvailabilityOptions) (resp azfake.Responder[armloadtesting.QuotasClientCheckAvailabilityResponse], errResp azfake.ErrorResponder) + CheckAvailability func(ctx context.Context, location string, quotaBucketName string, body armloadtesting.QuotaBucketRequest, options *armloadtesting.QuotasClientCheckAvailabilityOptions) (resp azfake.Responder[armloadtesting.QuotasClientCheckAvailabilityResponse], errResp azfake.ErrorResponder) // Get is the fake for method QuotasClient.Get // HTTP status codes to indicate success: http.StatusOK @@ -62,25 +59,44 @@ func (q *QuotasServerTransport) Do(req *http.Request) (*http.Response, error) { return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return q.dispatchToMethodFake(req, method) +} - switch method { - case "QuotasClient.CheckAvailability": - resp, err = q.dispatchCheckAvailability(req) - case "QuotasClient.Get": - resp, err = q.dispatchGet(req) - case "QuotasClient.NewListPager": - resp, err = q.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (q *QuotasServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) - if err != nil { - return nil, err - } + go func() { + var intercepted bool + var res result + if quotasServerTransportInterceptor != nil { + res.resp, res.err, intercepted = quotasServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "QuotasClient.CheckAvailability": + res.resp, res.err = q.dispatchCheckAvailability(req) + case "QuotasClient.Get": + res.resp, res.err = q.dispatchGet(req) + case "QuotasClient.NewListPager": + res.resp, res.err = q.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (q *QuotasServerTransport) dispatchCheckAvailability(req *http.Request) (*http.Response, error) { @@ -189,3 +205,9 @@ func (q *QuotasServerTransport) dispatchNewListPager(req *http.Request) (*http.R } return resp, nil } + +// set this to conditionally intercept incoming requests to QuotasServerTransport +var quotasServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/loadtesting/armloadtesting/fake/server_factory.go b/sdk/resourcemanager/loadtesting/armloadtesting/fake/server_factory.go index d66885eec88a..2971ee7f3e67 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/fake/server_factory.go +++ b/sdk/resourcemanager/loadtesting/armloadtesting/fake/server_factory.go @@ -1,6 +1,3 @@ -//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. @@ -19,9 +16,14 @@ import ( // ServerFactory is a fake server for instances of the armloadtesting.ClientFactory type. type ServerFactory struct { - LoadTestsServer LoadTestsServer + // LoadTestsServer contains the fakes for client LoadTestsClient + LoadTestsServer LoadTestsServer + + // OperationsServer contains the fakes for client OperationsClient OperationsServer OperationsServer - QuotasServer QuotasServer + + // QuotasServer contains the fakes for client QuotasClient + QuotasServer QuotasServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. diff --git a/sdk/resourcemanager/loadtesting/armloadtesting/fake/time_rfc3339.go b/sdk/resourcemanager/loadtesting/armloadtesting/fake/time_rfc3339.go deleted file mode 100644 index b0535a7b63e6..000000000000 --- a/sdk/resourcemanager/loadtesting/armloadtesting/fake/time_rfc3339.go +++ /dev/null @@ -1,86 +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. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "regexp" - "strings" - "time" -) - -// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) - -const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` -) - -type dateTimeRFC3339 time.Time - -func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalJSON() -} - -func (t dateTimeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalText() -} - -func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { - layout = dateTimeJSON - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { - layout = time.RFC3339Nano - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = dateTimeRFC3339(p) - return err -} - -func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*dateTimeRFC3339)(t) -} - -func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { - return nil - } - var aux dateTimeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/loadtesting/armloadtesting/go.mod b/sdk/resourcemanager/loadtesting/armloadtesting/go.mod index 22ece1426177..c7cb06cd4ac0 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/go.mod +++ b/sdk/resourcemanager/loadtesting/armloadtesting/go.mod @@ -1,16 +1,16 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/loadtesting/armloadtesting +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/loadtesting/armloadtesting/v2 go 1.23.0 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.1 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0 github.com/stretchr/testify v1.10.0 ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect diff --git a/sdk/resourcemanager/loadtesting/armloadtesting/loadtests_client.go b/sdk/resourcemanager/loadtesting/armloadtesting/loadtests_client.go index bfd2effb6f4e..7195f2a5e0f5 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/loadtests_client.go +++ b/sdk/resourcemanager/loadtesting/armloadtesting/loadtests_client.go @@ -1,6 +1,3 @@ -//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. @@ -28,7 +25,7 @@ type LoadTestsClient struct { } // NewLoadTestsClient creates a new instance of LoadTestsClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewLoadTestsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LoadTestsClient, error) { @@ -43,18 +40,18 @@ func NewLoadTestsClient(subscriptionID string, credential azcore.TokenCredential return client, nil } -// BeginCreateOrUpdate - Create or update LoadTest resource. +// BeginCreateOrUpdate - Create a LoadTestResource // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2022-12-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - loadTestName - Load Test name. -// - loadTestResource - LoadTest resource data +// - loadTestName - Load Test name +// - resource - Resource create parameters. // - options - LoadTestsClientBeginCreateOrUpdateOptions contains the optional parameters for the LoadTestsClient.BeginCreateOrUpdate // method. -func (client *LoadTestsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, loadTestName string, loadTestResource LoadTestResource, options *LoadTestsClientBeginCreateOrUpdateOptions) (*runtime.Poller[LoadTestsClientCreateOrUpdateResponse], error) { +func (client *LoadTestsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, loadTestName string, resource LoadTestResource, options *LoadTestsClientBeginCreateOrUpdateOptions) (*runtime.Poller[LoadTestsClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, loadTestName, loadTestResource, options) + resp, err := client.createOrUpdate(ctx, resourceGroupName, loadTestName, resource, options) if err != nil { return nil, err } @@ -70,17 +67,17 @@ func (client *LoadTestsClient) BeginCreateOrUpdate(ctx context.Context, resource } } -// CreateOrUpdate - Create or update LoadTest resource. +// CreateOrUpdate - Create a LoadTestResource // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2022-12-01 -func (client *LoadTestsClient) createOrUpdate(ctx context.Context, resourceGroupName string, loadTestName string, loadTestResource LoadTestResource, options *LoadTestsClientBeginCreateOrUpdateOptions) (*http.Response, error) { +func (client *LoadTestsClient) createOrUpdate(ctx context.Context, resourceGroupName string, loadTestName string, resource LoadTestResource, options *LoadTestsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "LoadTestsClient.BeginCreateOrUpdate" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, loadTestName, loadTestResource, options) + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, loadTestName, resource, options) if err != nil { return nil, err } @@ -96,7 +93,7 @@ func (client *LoadTestsClient) createOrUpdate(ctx context.Context, resourceGroup } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *LoadTestsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, loadTestName string, loadTestResource LoadTestResource, options *LoadTestsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *LoadTestsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, loadTestName string, resource LoadTestResource, _ *LoadTestsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/loadTests/{loadTestName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -118,18 +115,18 @@ func (client *LoadTestsClient) createOrUpdateCreateRequest(ctx context.Context, reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, loadTestResource); err != nil { + if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } return req, nil } -// BeginDelete - Delete a LoadTest resource. +// BeginDelete - Delete a LoadTestResource // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2022-12-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - loadTestName - Load Test name. +// - loadTestName - Load Test name // - options - LoadTestsClientBeginDeleteOptions contains the optional parameters for the LoadTestsClient.BeginDelete method. func (client *LoadTestsClient) BeginDelete(ctx context.Context, resourceGroupName string, loadTestName string, options *LoadTestsClientBeginDeleteOptions) (*runtime.Poller[LoadTestsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { @@ -149,7 +146,7 @@ func (client *LoadTestsClient) BeginDelete(ctx context.Context, resourceGroupNam } } -// Delete - Delete a LoadTest resource. +// Delete - Delete a LoadTestResource // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2022-12-01 @@ -167,7 +164,7 @@ func (client *LoadTestsClient) deleteOperation(ctx context.Context, resourceGrou if err != nil { return nil, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { err = runtime.NewResponseError(httpResp) return nil, err } @@ -175,7 +172,7 @@ func (client *LoadTestsClient) deleteOperation(ctx context.Context, resourceGrou } // deleteCreateRequest creates the Delete request. -func (client *LoadTestsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, loadTestName string, options *LoadTestsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *LoadTestsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, loadTestName string, _ *LoadTestsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/loadTests/{loadTestName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -200,12 +197,12 @@ func (client *LoadTestsClient) deleteCreateRequest(ctx context.Context, resource return req, nil } -// Get - Get a LoadTest resource. +// Get - Get a LoadTestResource // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2022-12-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - loadTestName - Load Test name. +// - loadTestName - Load Test name // - options - LoadTestsClientGetOptions contains the optional parameters for the LoadTestsClient.Get method. func (client *LoadTestsClient) Get(ctx context.Context, resourceGroupName string, loadTestName string, options *LoadTestsClientGetOptions) (LoadTestsClientGetResponse, error) { var err error @@ -230,7 +227,7 @@ func (client *LoadTestsClient) Get(ctx context.Context, resourceGroupName string } // getCreateRequest creates the Get request. -func (client *LoadTestsClient) getCreateRequest(ctx context.Context, resourceGroupName string, loadTestName string, options *LoadTestsClientGetOptions) (*policy.Request, error) { +func (client *LoadTestsClient) getCreateRequest(ctx context.Context, resourceGroupName string, loadTestName string, _ *LoadTestsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/loadTests/{loadTestName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -264,7 +261,7 @@ func (client *LoadTestsClient) getHandleResponse(resp *http.Response) (LoadTests return result, nil } -// NewListByResourceGroupPager - Lists loadtest resources in a resource group. +// NewListByResourceGroupPager - List LoadTestResource resources by resource group // // Generated from API version 2022-12-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. @@ -294,7 +291,7 @@ func (client *LoadTestsClient) NewListByResourceGroupPager(resourceGroupName str } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *LoadTestsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *LoadTestsClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *LoadTestsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *LoadTestsClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/loadTests" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -318,13 +315,13 @@ func (client *LoadTestsClient) listByResourceGroupCreateRequest(ctx context.Cont // listByResourceGroupHandleResponse handles the ListByResourceGroup response. func (client *LoadTestsClient) listByResourceGroupHandleResponse(resp *http.Response) (LoadTestsClientListByResourceGroupResponse, error) { result := LoadTestsClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.LoadTestResourcePageList); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.LoadTestResourceListResult); err != nil { return LoadTestsClientListByResourceGroupResponse{}, err } return result, nil } -// NewListBySubscriptionPager - Lists loadtests resources in a subscription. +// NewListBySubscriptionPager - List LoadTestResource resources by subscription ID // // Generated from API version 2022-12-01 // - options - LoadTestsClientListBySubscriptionOptions contains the optional parameters for the LoadTestsClient.NewListBySubscriptionPager @@ -353,7 +350,7 @@ func (client *LoadTestsClient) NewListBySubscriptionPager(options *LoadTestsClie } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *LoadTestsClient) listBySubscriptionCreateRequest(ctx context.Context, options *LoadTestsClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *LoadTestsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *LoadTestsClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.LoadTestService/loadTests" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -373,7 +370,7 @@ func (client *LoadTestsClient) listBySubscriptionCreateRequest(ctx context.Conte // listBySubscriptionHandleResponse handles the ListBySubscription response. func (client *LoadTestsClient) listBySubscriptionHandleResponse(resp *http.Response) (LoadTestsClientListBySubscriptionResponse, error) { result := LoadTestsClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.LoadTestResourcePageList); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.LoadTestResourceListResult); err != nil { return LoadTestsClientListBySubscriptionResponse{}, err } return result, nil @@ -383,7 +380,7 @@ func (client *LoadTestsClient) listBySubscriptionHandleResponse(resp *http.Respo // // Generated from API version 2022-12-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - loadTestName - Load Test name. +// - loadTestName - Load Test name // - options - LoadTestsClientListOutboundNetworkDependenciesEndpointsOptions contains the optional parameters for the LoadTestsClient.NewListOutboundNetworkDependenciesEndpointsPager // method. func (client *LoadTestsClient) NewListOutboundNetworkDependenciesEndpointsPager(resourceGroupName string, loadTestName string, options *LoadTestsClientListOutboundNetworkDependenciesEndpointsOptions) *runtime.Pager[LoadTestsClientListOutboundNetworkDependenciesEndpointsResponse] { @@ -410,7 +407,7 @@ func (client *LoadTestsClient) NewListOutboundNetworkDependenciesEndpointsPager( } // listOutboundNetworkDependenciesEndpointsCreateRequest creates the ListOutboundNetworkDependenciesEndpoints request. -func (client *LoadTestsClient) listOutboundNetworkDependenciesEndpointsCreateRequest(ctx context.Context, resourceGroupName string, loadTestName string, options *LoadTestsClientListOutboundNetworkDependenciesEndpointsOptions) (*policy.Request, error) { +func (client *LoadTestsClient) listOutboundNetworkDependenciesEndpointsCreateRequest(ctx context.Context, resourceGroupName string, loadTestName string, _ *LoadTestsClientListOutboundNetworkDependenciesEndpointsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/loadTests/{loadTestName}/outboundNetworkDependenciesEndpoints" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -438,28 +435,28 @@ func (client *LoadTestsClient) listOutboundNetworkDependenciesEndpointsCreateReq // listOutboundNetworkDependenciesEndpointsHandleResponse handles the ListOutboundNetworkDependenciesEndpoints response. func (client *LoadTestsClient) listOutboundNetworkDependenciesEndpointsHandleResponse(resp *http.Response) (LoadTestsClientListOutboundNetworkDependenciesEndpointsResponse, error) { result := LoadTestsClientListOutboundNetworkDependenciesEndpointsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OutboundEnvironmentEndpointCollection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.PagedOutboundEnvironmentEndpoint); err != nil { return LoadTestsClientListOutboundNetworkDependenciesEndpointsResponse{}, err } return result, nil } -// BeginUpdate - Update a loadtest resource. +// BeginUpdate - Update a LoadTestResource // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2022-12-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - loadTestName - Load Test name. -// - loadTestResourcePatchRequestBody - LoadTest resource update data +// - loadTestName - Load Test name +// - properties - The resource properties to be updated. // - options - LoadTestsClientBeginUpdateOptions contains the optional parameters for the LoadTestsClient.BeginUpdate method. -func (client *LoadTestsClient) BeginUpdate(ctx context.Context, resourceGroupName string, loadTestName string, loadTestResourcePatchRequestBody LoadTestResourcePatchRequestBody, options *LoadTestsClientBeginUpdateOptions) (*runtime.Poller[LoadTestsClientUpdateResponse], error) { +func (client *LoadTestsClient) BeginUpdate(ctx context.Context, resourceGroupName string, loadTestName string, properties LoadTestResourceUpdate, options *LoadTestsClientBeginUpdateOptions) (*runtime.Poller[LoadTestsClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, loadTestName, loadTestResourcePatchRequestBody, options) + resp, err := client.update(ctx, resourceGroupName, loadTestName, properties, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LoadTestsClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + FinalStateVia: runtime.FinalStateViaLocation, Tracer: client.internal.Tracer(), }) return poller, err @@ -470,17 +467,17 @@ func (client *LoadTestsClient) BeginUpdate(ctx context.Context, resourceGroupNam } } -// Update - Update a loadtest resource. +// Update - Update a LoadTestResource // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2022-12-01 -func (client *LoadTestsClient) update(ctx context.Context, resourceGroupName string, loadTestName string, loadTestResourcePatchRequestBody LoadTestResourcePatchRequestBody, options *LoadTestsClientBeginUpdateOptions) (*http.Response, error) { +func (client *LoadTestsClient) update(ctx context.Context, resourceGroupName string, loadTestName string, properties LoadTestResourceUpdate, options *LoadTestsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "LoadTestsClient.BeginUpdate" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, loadTestName, loadTestResourcePatchRequestBody, options) + req, err := client.updateCreateRequest(ctx, resourceGroupName, loadTestName, properties, options) if err != nil { return nil, err } @@ -496,7 +493,7 @@ func (client *LoadTestsClient) update(ctx context.Context, resourceGroupName str } // updateCreateRequest creates the Update request. -func (client *LoadTestsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, loadTestName string, loadTestResourcePatchRequestBody LoadTestResourcePatchRequestBody, options *LoadTestsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *LoadTestsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, loadTestName string, properties LoadTestResourceUpdate, _ *LoadTestsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.LoadTestService/loadTests/{loadTestName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -518,7 +515,7 @@ func (client *LoadTestsClient) updateCreateRequest(ctx context.Context, resource reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, loadTestResourcePatchRequestBody); err != nil { + if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } return req, nil diff --git a/sdk/resourcemanager/loadtesting/armloadtesting/loadtests_client_example_test.go b/sdk/resourcemanager/loadtesting/armloadtesting/loadtests_client_example_test.go deleted file mode 100644 index 7f3659ec8275..000000000000 --- a/sdk/resourcemanager/loadtesting/armloadtesting/loadtests_client_example_test.go +++ /dev/null @@ -1,459 +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 armloadtesting_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/loadtesting/armloadtesting" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/loadtestservice/resource-manager/Microsoft.LoadTestService/stable/2022-12-01/examples/LoadTests_ListBySubscription.json -func ExampleLoadTestsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armloadtesting.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLoadTestsClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.LoadTestResourcePageList = armloadtesting.LoadTestResourcePageList{ - // Value: []*armloadtesting.LoadTestResource{ - // { - // Name: to.Ptr("myLoadTest"), - // Type: to.Ptr("Microsoft.LoadTestService/loadTests"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.LoadTestService/loadTests/myLoadTest"), - // SystemData: &armloadtesting.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-28T12:32:33.000Z"); return t}()), - // CreatedBy: to.Ptr("userId1001"), - // CreatedByType: to.Ptr(armloadtesting.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-28T12:32:33.000Z"); return t}()), - // LastModifiedBy: to.Ptr("userId1001"), - // LastModifiedByType: to.Ptr(armloadtesting.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "Team": to.Ptr("Dev Exp"), - // }, - // Properties: &armloadtesting.LoadTestProperties{ - // Description: to.Ptr("This is new load test resource"), - // DataPlaneURI: to.Ptr("https://myLoadTest.00000000-0000-0000-0000-000000000000.cnt-dp.domain.com"), - // ProvisioningState: to.Ptr(armloadtesting.ResourceStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/loadtestservice/resource-manager/Microsoft.LoadTestService/stable/2022-12-01/examples/LoadTests_ListByResourceGroup.json -func ExampleLoadTestsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armloadtesting.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLoadTestsClient().NewListByResourceGroupPager("dummyrg", 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.LoadTestResourcePageList = armloadtesting.LoadTestResourcePageList{ - // Value: []*armloadtesting.LoadTestResource{ - // { - // Name: to.Ptr("myLoadTest"), - // Type: to.Ptr("Microsoft.LoadTestService/loadTests"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.LoadTestService/loadTests/myLoadTest"), - // SystemData: &armloadtesting.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-28T12:32:33.000Z"); return t}()), - // CreatedBy: to.Ptr("userId1001"), - // CreatedByType: to.Ptr(armloadtesting.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-28T12:32:33.000Z"); return t}()), - // LastModifiedBy: to.Ptr("userId1001"), - // LastModifiedByType: to.Ptr(armloadtesting.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "Team": to.Ptr("Dev Exp"), - // }, - // Properties: &armloadtesting.LoadTestProperties{ - // Description: to.Ptr("This is new load test resource"), - // DataPlaneURI: to.Ptr("https://myLoadTest.00000000-0000-0000-0000-000000000000.cnt-dp.domain.com"), - // ProvisioningState: to.Ptr(armloadtesting.ResourceStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/loadtestservice/resource-manager/Microsoft.LoadTestService/stable/2022-12-01/examples/LoadTests_Get.json -func ExampleLoadTestsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armloadtesting.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLoadTestsClient().Get(ctx, "dummyrg", "myLoadTest", 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.LoadTestResource = armloadtesting.LoadTestResource{ - // Name: to.Ptr("myLoadTest"), - // Type: to.Ptr("Microsoft.LoadTestService/loadTests"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.LoadTestService/loadTests/myLoadTest"), - // SystemData: &armloadtesting.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-28T12:32:33.000Z"); return t}()), - // CreatedBy: to.Ptr("userId1001"), - // CreatedByType: to.Ptr(armloadtesting.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-28T12:32:33.000Z"); return t}()), - // LastModifiedBy: to.Ptr("userId1001"), - // LastModifiedByType: to.Ptr(armloadtesting.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "Team": to.Ptr("Dev Exp"), - // }, - // Properties: &armloadtesting.LoadTestProperties{ - // Description: to.Ptr("This is new load test resource"), - // DataPlaneURI: to.Ptr("https://myLoadTest.00000000-0000-0000-0000-000000000000.cnt-dp.domain.com"), - // ProvisioningState: to.Ptr(armloadtesting.ResourceStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/loadtestservice/resource-manager/Microsoft.LoadTestService/stable/2022-12-01/examples/LoadTests_CreateOrUpdate.json -func ExampleLoadTestsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armloadtesting.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLoadTestsClient().BeginCreateOrUpdate(ctx, "dummyrg", "myLoadTest", armloadtesting.LoadTestResource{ - Location: to.Ptr("westus"), - Tags: map[string]*string{ - "Team": to.Ptr("Dev Exp"), - }, - Identity: &armloadtesting.ManagedServiceIdentity{ - Type: to.Ptr(armloadtesting.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - UserAssignedIdentities: map[string]*armloadtesting.UserAssignedIdentity{ - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {}, - }, - }, - Properties: &armloadtesting.LoadTestProperties{ - Description: to.Ptr("This is new load test resource"), - Encryption: &armloadtesting.EncryptionProperties{ - Identity: &armloadtesting.EncryptionPropertiesIdentity{ - Type: to.Ptr(armloadtesting.TypeUserAssigned), - ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1"), - }, - KeyURL: to.Ptr("https://dummy.vault.azure.net/keys/dummykey1"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LoadTestResource = armloadtesting.LoadTestResource{ - // Name: to.Ptr("myLoadTest"), - // Type: to.Ptr("Microsoft.LoadTestService/loadTests"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.LoadTestService/loadTests/myLoadTest"), - // SystemData: &armloadtesting.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-28T12:32:33.000Z"); return t}()), - // CreatedBy: to.Ptr("userId1001"), - // CreatedByType: to.Ptr(armloadtesting.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-28T12:32:33.000Z"); return t}()), - // LastModifiedBy: to.Ptr("userId1001"), - // LastModifiedByType: to.Ptr(armloadtesting.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "Team": to.Ptr("Dev Exp"), - // }, - // Identity: &armloadtesting.ManagedServiceIdentity{ - // Type: to.Ptr(armloadtesting.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("12345678-1234-1234-1234-123456789012"), - // TenantID: to.Ptr("12345678-1234-1234-4321-123456789012"), - // UserAssignedIdentities: map[string]*armloadtesting.UserAssignedIdentity{ - // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": &armloadtesting.UserAssignedIdentity{ - // ClientID: to.Ptr("12345678-4321-1234-1234-123456789012"), - // PrincipalID: to.Ptr("12345678-1234-4321-1234-123456789012"), - // }, - // }, - // }, - // Properties: &armloadtesting.LoadTestProperties{ - // Description: to.Ptr("This is new load test resource"), - // DataPlaneURI: to.Ptr("https://myLoadTest.00000000-0000-0000-0000-000000000000.cnt-dp.domain.com"), - // Encryption: &armloadtesting.EncryptionProperties{ - // Identity: &armloadtesting.EncryptionPropertiesIdentity{ - // Type: to.Ptr(armloadtesting.TypeUserAssigned), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1"), - // }, - // KeyURL: to.Ptr("https://dummy.vault.azure.net/keys/dummykey1"), - // }, - // ProvisioningState: to.Ptr(armloadtesting.ResourceStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/loadtestservice/resource-manager/Microsoft.LoadTestService/stable/2022-12-01/examples/LoadTests_Update.json -func ExampleLoadTestsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armloadtesting.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLoadTestsClient().BeginUpdate(ctx, "dummyrg", "myLoadTest", armloadtesting.LoadTestResourcePatchRequestBody{ - Identity: &armloadtesting.ManagedServiceIdentity{ - Type: to.Ptr(armloadtesting.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - UserAssignedIdentities: map[string]*armloadtesting.UserAssignedIdentity{ - "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": {}, - }, - }, - Properties: &armloadtesting.LoadTestResourcePatchRequestBodyProperties{ - Description: to.Ptr("This is new load test resource"), - Encryption: &armloadtesting.EncryptionProperties{ - Identity: &armloadtesting.EncryptionPropertiesIdentity{ - Type: to.Ptr(armloadtesting.TypeSystemAssigned), - }, - KeyURL: to.Ptr("https://dummy.vault.azure.net/keys/dummykey1"), - }, - }, - Tags: map[string]*string{ - "Division": to.Ptr("LT"), - "Team": to.Ptr("Dev Exp"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.LoadTestResource = armloadtesting.LoadTestResource{ - // Name: to.Ptr("myLoadTest"), - // Type: to.Ptr("Microsoft.LoadTestService/loadTests"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.LoadTestService/loadTests/myLoadTest"), - // SystemData: &armloadtesting.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-28T12:32:33.000Z"); return t}()), - // CreatedBy: to.Ptr("userId1001"), - // CreatedByType: to.Ptr(armloadtesting.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-28T12:32:33.000Z"); return t}()), - // LastModifiedBy: to.Ptr("userId1001"), - // LastModifiedByType: to.Ptr(armloadtesting.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "Division": to.Ptr("LT"), - // "Team": to.Ptr("Dev Exp"), - // }, - // Identity: &armloadtesting.ManagedServiceIdentity{ - // Type: to.Ptr(armloadtesting.ManagedServiceIdentityTypeSystemAssignedUserAssigned), - // PrincipalID: to.Ptr("12345678-1234-1234-1234-123456789012"), - // TenantID: to.Ptr("12345678-1234-1234-4321-123456789012"), - // UserAssignedIdentities: map[string]*armloadtesting.UserAssignedIdentity{ - // "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1": &armloadtesting.UserAssignedIdentity{ - // ClientID: to.Ptr("12345678-4321-1234-1234-123456789012"), - // PrincipalID: to.Ptr("12345678-1234-4321-1234-123456789012"), - // }, - // }, - // }, - // Properties: &armloadtesting.LoadTestProperties{ - // Description: to.Ptr("This is new load test resource"), - // DataPlaneURI: to.Ptr("https://myLoadTest.00000000-0000-0000-0000-000000000000.cnt-dp.domain.com"), - // Encryption: &armloadtesting.EncryptionProperties{ - // Identity: &armloadtesting.EncryptionPropertiesIdentity{ - // Type: to.Ptr(armloadtesting.TypeSystemAssigned), - // }, - // KeyURL: to.Ptr("https://dummy.vault.azure.net/keys/dummykey1"), - // }, - // ProvisioningState: to.Ptr(armloadtesting.ResourceStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/loadtestservice/resource-manager/Microsoft.LoadTestService/stable/2022-12-01/examples/LoadTests_Delete.json -func ExampleLoadTestsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armloadtesting.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewLoadTestsClient().BeginDelete(ctx, "dummyrg", "myLoadTest", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/loadtestservice/resource-manager/Microsoft.LoadTestService/stable/2022-12-01/examples/LoadTests_ListOutboundNetworkDependenciesEndpoints.json -func ExampleLoadTestsClient_NewListOutboundNetworkDependenciesEndpointsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armloadtesting.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLoadTestsClient().NewListOutboundNetworkDependenciesEndpointsPager("default-azureloadtest-japaneast", "sampleloadtest", 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.OutboundEnvironmentEndpointCollection = armloadtesting.OutboundEnvironmentEndpointCollection{ - // Value: []*armloadtesting.OutboundEnvironmentEndpoint{ - // { - // Category: to.Ptr("Azure Batch"), - // Endpoints: []*armloadtesting.EndpointDependency{ - // { - // Description: to.Ptr("Applicable to job manager tasks, tasks that use job scoped authentication, or any task that makes calls to Batch."), - // DomainName: to.Ptr("sampleacct.japaneast.batch.azure.com"), - // EndpointDetails: []*armloadtesting.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // }}, - // }, - // { - // Description: to.Ptr("Applicable to all Azure Batch pools."), - // DomainName: to.Ptr("japaneast.service.batch.azure.com"), - // EndpointDetails: []*armloadtesting.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // }}, - // }}, - // }, - // { - // Category: to.Ptr("Azure Storage"), - // Endpoints: []*armloadtesting.EndpointDependency{ - // { - // Description: to.Ptr("AutoStorage endpoint for this Batch account. Applicable to all Azure Batch pools under this account."), - // DomainName: to.Ptr("autostorageaccountname.blob.core.windows.net"), - // EndpointDetails: []*armloadtesting.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // }}, - // }, - // { - // Description: to.Ptr("Applicable to all Azure Batch pools."), - // DomainName: to.Ptr("*.blob.core.windows.net"), - // EndpointDetails: []*armloadtesting.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // }}, - // }, - // { - // Description: to.Ptr("Applicable to all Azure Batch pools."), - // DomainName: to.Ptr("*.table.core.windows.net"), - // EndpointDetails: []*armloadtesting.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // }}, - // }, - // { - // Description: to.Ptr("Applicable to all Azure Batch pools."), - // DomainName: to.Ptr("*.queue.core.windows.net"), - // EndpointDetails: []*armloadtesting.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // }}, - // }}, - // }, - // { - // Category: to.Ptr("Microsoft Package Repository"), - // Endpoints: []*armloadtesting.EndpointDependency{ - // { - // Description: to.Ptr("Only applicable to pools containing a Mount Configuration. Learn about Mount Configurations in Batch at https://docs.microsoft.com/azure/batch/virtual-file-mount."), - // DomainName: to.Ptr("packages.microsoft.com"), - // EndpointDetails: []*armloadtesting.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // }}, - // }}, - // }, - // { - // Category: to.Ptr("Azure Key Vault"), - // Endpoints: []*armloadtesting.EndpointDependency{ - // { - // Description: to.Ptr("Only applicable to pools containing a Disk Encryption Configuration and whose VM size does not support encryption at host. Learn more about disk encryption in Azure Batch at https://docs.microsoft.com/azure/batch/disk-encryption. Learn more about encryption at host and supported VM sizes at https://docs.microsoft.com/azure/virtual-machines/disks-enable-host-based-encryption-portal."), - // DomainName: to.Ptr("*.vault.azure.net"), - // EndpointDetails: []*armloadtesting.EndpointDetail{ - // { - // Port: to.Ptr[int32](443), - // }}, - // }}, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/loadtesting/armloadtesting/loadtestservice_live_test.go b/sdk/resourcemanager/loadtesting/armloadtesting/loadtestservice_live_test.go index a06633fd4629..bd66d26b2f0f 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/loadtestservice_live_test.go +++ b/sdk/resourcemanager/loadtesting/armloadtesting/loadtestservice_live_test.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3/testutil" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/loadtesting/armloadtesting" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/loadtesting/armloadtesting/v2" "github.com/stretchr/testify/suite" ) diff --git a/sdk/resourcemanager/loadtesting/armloadtesting/models.go b/sdk/resourcemanager/loadtesting/armloadtesting/models.go index 1679c6841e69..c5972c690370 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/models.go +++ b/sdk/resourcemanager/loadtesting/armloadtesting/models.go @@ -1,6 +1,3 @@ -//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. @@ -18,14 +15,14 @@ type CheckQuotaAvailabilityResponse struct { // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string + + // READ-ONLY; The name of the resource. Name *string // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string } // CheckQuotaAvailabilityResponseProperties - Check quota availability response properties. @@ -37,7 +34,7 @@ type CheckQuotaAvailabilityResponseProperties struct { IsAvailable *bool } -// EncryptionProperties - Key and identity details for Customer Managed Key encryption of load test resource +// EncryptionProperties - Key and identity details for Customer Managed Key encryption of load test resource. type EncryptionProperties struct { // All identity configuration for Customer-managed key settings defining which identity should be used to auth to Key Vault. Identity *EncryptionPropertiesIdentity @@ -50,22 +47,22 @@ type EncryptionProperties struct { // EncryptionPropertiesIdentity - All identity configuration for Customer-managed key settings defining which identity should // be used to auth to Key Vault. type EncryptionPropertiesIdentity struct { - // user assigned identity to use for accessing key encryption key Url. Ex: /subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/ - // /providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId + // User assigned identity to use for accessing key encryption key Url. Ex: /subscriptions/a0a0a0a0-bbbb-cccd-dddd-e1e1e1e1e1e1/resourceGroups/ + // /providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. ResourceID *string - // Managed identity type to use for accessing encryption key Url + // Managed identity type to use for accessing encryption key Url. Type *Type } // EndpointDependency - A domain name and connection details used to access a dependency. type EndpointDependency struct { - // READ-ONLY; Human-readable supplemental information about the dependency and when it is applicable. - Description *string - // READ-ONLY; The domain name of the dependency. Domain names may be fully qualified or may contain a * wildcard. DomainName *string + // READ-ONLY; Human-readable supplemental information about the dependency and when it is applicable. + Description *string + // READ-ONLY; The list of connection details for this endpoint. EndpointDetails []*EndpointDetail } @@ -91,21 +88,21 @@ type LoadTestProperties struct { ProvisioningState *ResourceState } -// LoadTestResource - LoadTest details +// LoadTestResource - LoadTest details. type LoadTestResource struct { // REQUIRED; The geo-location where the resource lives Location *string - // The type of identity used for the resource. + // The managed service identities assigned to this resource. Identity *ManagedServiceIdentity - // Load Test resource properties + // The resource-specific properties for this resource. Properties *LoadTestProperties // Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string // READ-ONLY; The name of the resource @@ -118,29 +115,29 @@ type LoadTestResource struct { Type *string } -// LoadTestResourcePageList - List of resources page result. -type LoadTestResourcePageList struct { - // Link to next page of resources. - NextLink *string - - // List of resources in current page. +// LoadTestResourceListResult - The response of a LoadTestResource list operation. +type LoadTestResourceListResult struct { + // REQUIRED; The LoadTestResource items on this page Value []*LoadTestResource + + // The link to the next page of items + NextLink *string } -// LoadTestResourcePatchRequestBody - LoadTest resource patch request body. -type LoadTestResourcePatchRequestBody struct { - // The type of identity used for the resource. +// LoadTestResourceUpdate - The type used for update operations of the LoadTestResource. +type LoadTestResourceUpdate struct { + // The managed service identities assigned to this resource. Identity *ManagedServiceIdentity - // Load Test resource properties - Properties *LoadTestResourcePatchRequestBodyProperties + // The resource-specific properties for this resource. + Properties *LoadTestResourceUpdateProperties // Resource tags. Tags map[string]*string } -// LoadTestResourcePatchRequestBodyProperties - Load Test resource properties -type LoadTestResourcePatchRequestBodyProperties struct { +// LoadTestResourceUpdateProperties - The updatable properties of the LoadTestResource. +type LoadTestResourceUpdateProperties struct { // Description of the resource. Description *string @@ -227,31 +224,19 @@ type OutboundEnvironmentEndpoint struct { Endpoints []*EndpointDependency } -// OutboundEnvironmentEndpointCollection - Values returned by the List operation. -type OutboundEnvironmentEndpointCollection struct { - // The continuation token. - NextLink *string - - // READ-ONLY; The collection of outbound network dependency endpoints returned by the listing operation. +// PagedOutboundEnvironmentEndpoint - Values returned by the List operation. +type PagedOutboundEnvironmentEndpoint struct { + // REQUIRED; The OutboundEnvironmentEndpoint items on this page Value []*OutboundEnvironmentEndpoint + + // The link to the next page of items + NextLink *string } // QuotaBucketRequest - Request object of new quota for a quota bucket. type QuotaBucketRequest struct { - // New quota request request properties. + // Request object of new quota for a quota bucket. Properties *QuotaBucketRequestProperties - - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string - - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string } // QuotaBucketRequestProperties - New quota request request properties. @@ -280,10 +265,10 @@ type QuotaBucketRequestPropertiesDimensions struct { // QuotaResource - Quota bucket details object. type QuotaResource struct { - // Quota bucket resource properties. + // The resource-specific properties for this resource. Properties *QuotaResourceProperties - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string // READ-ONLY; The name of the resource @@ -296,13 +281,13 @@ type QuotaResource struct { Type *string } -// QuotaResourceList - List of quota bucket objects. It contains a URL link to get the next set of results. -type QuotaResourceList struct { - // READ-ONLY; URL to get the next set of quota bucket objects results (if there are any). - NextLink *string - - // READ-ONLY; List of quota bucket objects provided by the loadtestservice. +// QuotaResourceListResult - The response of a QuotaResource list operation. +type QuotaResourceListResult struct { + // REQUIRED; The QuotaResource items on this page Value []*QuotaResource + + // The link to the next page of items + NextLink *string } // QuotaResourceProperties - Quota bucket resource properties. diff --git a/sdk/resourcemanager/loadtesting/armloadtesting/models_serde.go b/sdk/resourcemanager/loadtesting/armloadtesting/models_serde.go index 389f360241ae..17a04bc494c9 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/models_serde.go +++ b/sdk/resourcemanager/loadtesting/armloadtesting/models_serde.go @@ -1,6 +1,3 @@ -//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. @@ -307,16 +304,16 @@ func (l *LoadTestResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type LoadTestResourcePageList. -func (l LoadTestResourcePageList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type LoadTestResourceListResult. +func (l LoadTestResourceListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", l.NextLink) populate(objectMap, "value", l.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LoadTestResourcePageList. -func (l *LoadTestResourcePageList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type LoadTestResourceListResult. +func (l *LoadTestResourceListResult) 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) @@ -338,8 +335,8 @@ func (l *LoadTestResourcePageList) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type LoadTestResourcePatchRequestBody. -func (l LoadTestResourcePatchRequestBody) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type LoadTestResourceUpdate. +func (l LoadTestResourceUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "identity", l.Identity) populate(objectMap, "properties", l.Properties) @@ -347,8 +344,8 @@ func (l LoadTestResourcePatchRequestBody) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LoadTestResourcePatchRequestBody. -func (l *LoadTestResourcePatchRequestBody) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type LoadTestResourceUpdate. +func (l *LoadTestResourceUpdate) 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) @@ -373,16 +370,16 @@ func (l *LoadTestResourcePatchRequestBody) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type LoadTestResourcePatchRequestBodyProperties. -func (l LoadTestResourcePatchRequestBodyProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type LoadTestResourceUpdateProperties. +func (l LoadTestResourceUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "description", l.Description) populate(objectMap, "encryption", l.Encryption) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LoadTestResourcePatchRequestBodyProperties. -func (l *LoadTestResourcePatchRequestBodyProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type LoadTestResourceUpdateProperties. +func (l *LoadTestResourceUpdateProperties) 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) @@ -587,32 +584,32 @@ func (o *OutboundEnvironmentEndpoint) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type OutboundEnvironmentEndpointCollection. -func (o OutboundEnvironmentEndpointCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PagedOutboundEnvironmentEndpoint. +func (p PagedOutboundEnvironmentEndpoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OutboundEnvironmentEndpointCollection. -func (o *OutboundEnvironmentEndpointCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PagedOutboundEnvironmentEndpoint. +func (p *PagedOutboundEnvironmentEndpoint) 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) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": - err = unpopulate(val, "NextLink", &o.NextLink) + err = unpopulate(val, "NextLink", &p.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &o.Value) + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil @@ -621,11 +618,7 @@ func (o *OutboundEnvironmentEndpointCollection) UnmarshalJSON(data []byte) error // MarshalJSON implements the json.Marshaller interface for type QuotaBucketRequest. func (q QuotaBucketRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", q.ID) - populate(objectMap, "name", q.Name) populate(objectMap, "properties", q.Properties) - populate(objectMap, "systemData", q.SystemData) - populate(objectMap, "type", q.Type) return json.Marshal(objectMap) } @@ -638,21 +631,9 @@ func (q *QuotaBucketRequest) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &q.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &q.Name) - delete(rawMsg, key) case "properties": err = unpopulate(val, "Properties", &q.Properties) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &q.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &q.Type) - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", q, err) @@ -774,16 +755,16 @@ func (q *QuotaResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type QuotaResourceList. -func (q QuotaResourceList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type QuotaResourceListResult. +func (q QuotaResourceListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", q.NextLink) populate(objectMap, "value", q.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaResourceList. -func (q *QuotaResourceList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaResourceListResult. +func (q *QuotaResourceListResult) 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) @@ -929,7 +910,7 @@ func populate(m map[string]any, k string, v any) { } func unpopulate(data json.RawMessage, fn string, v any) error { - if data == nil { + if data == nil || string(data) == "null" { return nil } if err := json.Unmarshal(data, v); err != nil { diff --git a/sdk/resourcemanager/loadtesting/armloadtesting/operations_client.go b/sdk/resourcemanager/loadtesting/armloadtesting/operations_client.go index 90221faf5b81..dbaa65828b1a 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/operations_client.go +++ b/sdk/resourcemanager/loadtesting/armloadtesting/operations_client.go @@ -1,6 +1,3 @@ -//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. @@ -37,7 +34,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO return client, nil } -// NewListPager - Lists all the available API operations for Load Test Resource. +// NewListPager - List the operations for the provider // // Generated from API version 2022-12-01 // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. @@ -65,7 +62,7 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption } // listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.LoadTestService/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { diff --git a/sdk/resourcemanager/loadtesting/armloadtesting/operations_client_example_test.go b/sdk/resourcemanager/loadtesting/armloadtesting/operations_client_example_test.go deleted file mode 100644 index b6cd3fdb9fd1..000000000000 --- a/sdk/resourcemanager/loadtesting/armloadtesting/operations_client_example_test.go +++ /dev/null @@ -1,76 +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 armloadtesting_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/loadtesting/armloadtesting" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/loadtestservice/resource-manager/Microsoft.LoadTestService/stable/2022-12-01/examples/Operations_List.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armloadtesting.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armloadtesting.OperationListResult{ - // Value: []*armloadtesting.Operation{ - // { - // Name: to.Ptr("Microsoft.LoadTestService/loadTests/Write"), - // Display: &armloadtesting.OperationDisplay{ - // Description: to.Ptr("Set LoadTests"), - // Operation: to.Ptr("Creates or updates the LoadTests"), - // Provider: to.Ptr("Microsoft.LoadTestService"), - // Resource: to.Ptr("loadTests"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.LoadTestService/loadTests/Delete"), - // Display: &armloadtesting.OperationDisplay{ - // Description: to.Ptr("Delete LoadTests"), - // Operation: to.Ptr("Deletes the LoadTests"), - // Provider: to.Ptr("Microsoft.LoadTestService"), - // Resource: to.Ptr("loadTests"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.LoadTestService/loadTests/Read"), - // Display: &armloadtesting.OperationDisplay{ - // Description: to.Ptr("Read LoadTests"), - // Operation: to.Ptr("Reads the LoadTests"), - // Provider: to.Ptr("Microsoft.LoadTestService"), - // Resource: to.Ptr("loadTests"), - // }, - // IsDataAction: to.Ptr(false), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/loadtesting/armloadtesting/options.go b/sdk/resourcemanager/loadtesting/armloadtesting/options.go index 319a242068ee..3b3fa13f0d5a 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/options.go +++ b/sdk/resourcemanager/loadtesting/armloadtesting/options.go @@ -1,6 +1,3 @@ -//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. @@ -11,19 +8,19 @@ package armloadtesting // LoadTestsClientBeginCreateOrUpdateOptions contains the optional parameters for the LoadTestsClient.BeginCreateOrUpdate // method. type LoadTestsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // LoadTestsClientBeginDeleteOptions contains the optional parameters for the LoadTestsClient.BeginDelete method. type LoadTestsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // LoadTestsClientBeginUpdateOptions contains the optional parameters for the LoadTestsClient.BeginUpdate method. type LoadTestsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } diff --git a/sdk/resourcemanager/loadtesting/armloadtesting/quotas_client.go b/sdk/resourcemanager/loadtesting/armloadtesting/quotas_client.go index 996cc9dd0dbe..e4fe5c162639 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/quotas_client.go +++ b/sdk/resourcemanager/loadtesting/armloadtesting/quotas_client.go @@ -1,6 +1,3 @@ -//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. @@ -28,7 +25,7 @@ type QuotasClient struct { } // NewQuotasClient creates a new instance of QuotasClient with the specified values. -// - subscriptionID - The ID of the target subscription. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewQuotasClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*QuotasClient, error) { @@ -47,18 +44,18 @@ func NewQuotasClient(subscriptionID string, credential azcore.TokenCredential, o // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2022-12-01 -// - location - The name of Azure region. -// - quotaBucketName - Quota Bucket name. -// - quotaBucketRequest - Quota Bucket Request data +// - location - The name of the Azure region. +// - quotaBucketName - The quota name. +// - body - The content of the action request // - options - QuotasClientCheckAvailabilityOptions contains the optional parameters for the QuotasClient.CheckAvailability // method. -func (client *QuotasClient) CheckAvailability(ctx context.Context, location string, quotaBucketName string, quotaBucketRequest QuotaBucketRequest, options *QuotasClientCheckAvailabilityOptions) (QuotasClientCheckAvailabilityResponse, error) { +func (client *QuotasClient) CheckAvailability(ctx context.Context, location string, quotaBucketName string, body QuotaBucketRequest, options *QuotasClientCheckAvailabilityOptions) (QuotasClientCheckAvailabilityResponse, error) { var err error const operationName = "QuotasClient.CheckAvailability" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.checkAvailabilityCreateRequest(ctx, location, quotaBucketName, quotaBucketRequest, options) + req, err := client.checkAvailabilityCreateRequest(ctx, location, quotaBucketName, body, options) if err != nil { return QuotasClientCheckAvailabilityResponse{}, err } @@ -75,7 +72,7 @@ func (client *QuotasClient) CheckAvailability(ctx context.Context, location stri } // checkAvailabilityCreateRequest creates the CheckAvailability request. -func (client *QuotasClient) checkAvailabilityCreateRequest(ctx context.Context, location string, quotaBucketName string, quotaBucketRequest QuotaBucketRequest, options *QuotasClientCheckAvailabilityOptions) (*policy.Request, error) { +func (client *QuotasClient) checkAvailabilityCreateRequest(ctx context.Context, location string, quotaBucketName string, body QuotaBucketRequest, _ *QuotasClientCheckAvailabilityOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.LoadTestService/locations/{location}/quotas/{quotaBucketName}/checkAvailability" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -97,7 +94,7 @@ func (client *QuotasClient) checkAvailabilityCreateRequest(ctx context.Context, reqQP.Set("api-version", "2022-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, quotaBucketRequest); err != nil { + if err := runtime.MarshalAsJSON(req, body); err != nil { return nil, err } return req, nil @@ -116,8 +113,8 @@ func (client *QuotasClient) checkAvailabilityHandleResponse(resp *http.Response) // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2022-12-01 -// - location - The name of Azure region. -// - quotaBucketName - Quota Bucket name. +// - location - The name of the Azure region. +// - quotaBucketName - The quota name. // - options - QuotasClientGetOptions contains the optional parameters for the QuotasClient.Get method. func (client *QuotasClient) Get(ctx context.Context, location string, quotaBucketName string, options *QuotasClientGetOptions) (QuotasClientGetResponse, error) { var err error @@ -142,7 +139,7 @@ func (client *QuotasClient) Get(ctx context.Context, location string, quotaBucke } // getCreateRequest creates the Get request. -func (client *QuotasClient) getCreateRequest(ctx context.Context, location string, quotaBucketName string, options *QuotasClientGetOptions) (*policy.Request, error) { +func (client *QuotasClient) getCreateRequest(ctx context.Context, location string, quotaBucketName string, _ *QuotasClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.LoadTestService/locations/{location}/quotas/{quotaBucketName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -176,10 +173,10 @@ func (client *QuotasClient) getHandleResponse(resp *http.Response) (QuotasClient return result, nil } -// NewListPager - Lists all the available quota per region per subscription. +// NewListPager - List quotas for a given subscription Id. // // Generated from API version 2022-12-01 -// - location - The name of Azure region. +// - location - The name of the Azure region. // - options - QuotasClientListOptions contains the optional parameters for the QuotasClient.NewListPager method. func (client *QuotasClient) NewListPager(location string, options *QuotasClientListOptions) *runtime.Pager[QuotasClientListResponse] { return runtime.NewPager(runtime.PagingHandler[QuotasClientListResponse]{ @@ -205,7 +202,7 @@ func (client *QuotasClient) NewListPager(location string, options *QuotasClientL } // listCreateRequest creates the List request. -func (client *QuotasClient) listCreateRequest(ctx context.Context, location string, options *QuotasClientListOptions) (*policy.Request, error) { +func (client *QuotasClient) listCreateRequest(ctx context.Context, location string, _ *QuotasClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.LoadTestService/locations/{location}/quotas" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -229,7 +226,7 @@ func (client *QuotasClient) listCreateRequest(ctx context.Context, location stri // listHandleResponse handles the List response. func (client *QuotasClient) listHandleResponse(resp *http.Response) (QuotasClientListResponse, error) { result := QuotasClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.QuotaResourceList); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.QuotaResourceListResult); err != nil { return QuotasClientListResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/loadtesting/armloadtesting/quotas_client_example_test.go b/sdk/resourcemanager/loadtesting/armloadtesting/quotas_client_example_test.go deleted file mode 100644 index 5e1d10b1ad95..000000000000 --- a/sdk/resourcemanager/loadtesting/armloadtesting/quotas_client_example_test.go +++ /dev/null @@ -1,124 +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 armloadtesting_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/loadtesting/armloadtesting" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/loadtestservice/resource-manager/Microsoft.LoadTestService/stable/2022-12-01/examples/Quotas_List.json -func ExampleQuotasClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armloadtesting.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewQuotasClient().NewListPager("westus", 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.QuotaResourceList = armloadtesting.QuotaResourceList{ - // Value: []*armloadtesting.QuotaResource{ - // { - // Name: to.Ptr("testQuotaBucket"), - // Type: to.Ptr("Microsoft.LoadTestService/locations/quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/westus/quotas/testQuotaBucket"), - // Properties: &armloadtesting.QuotaResourceProperties{ - // Limit: to.Ptr[int32](50), - // Usage: to.Ptr[int32](20), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/loadtestservice/resource-manager/Microsoft.LoadTestService/stable/2022-12-01/examples/Quotas_Get.json -func ExampleQuotasClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armloadtesting.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQuotasClient().Get(ctx, "westus", "testQuotaBucket", 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.QuotaResource = armloadtesting.QuotaResource{ - // Name: to.Ptr("testQuotaBucket"), - // Type: to.Ptr("Microsoft.LoadTestService/locations/quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/westus/quotas/testQuotaBucket"), - // Properties: &armloadtesting.QuotaResourceProperties{ - // Limit: to.Ptr[int32](50), - // Usage: to.Ptr[int32](20), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/630ec444f8dd7c09b9cdd5fa99951f8a0d1ad41f/specification/loadtestservice/resource-manager/Microsoft.LoadTestService/stable/2022-12-01/examples/Quotas_CheckAvailability.json -func ExampleQuotasClient_CheckAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armloadtesting.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQuotasClient().CheckAvailability(ctx, "westus", "testQuotaBucket", armloadtesting.QuotaBucketRequest{ - Properties: &armloadtesting.QuotaBucketRequestProperties{ - CurrentQuota: to.Ptr[int32](40), - CurrentUsage: to.Ptr[int32](20), - Dimensions: &armloadtesting.QuotaBucketRequestPropertiesDimensions{ - Location: to.Ptr("westus"), - SubscriptionID: to.Ptr("testsubscriptionId"), - }, - NewQuota: to.Ptr[int32](50), - }, - }, 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.CheckQuotaAvailabilityResponse = armloadtesting.CheckQuotaAvailabilityResponse{ - // Name: to.Ptr("testQuotaBucket"), - // Type: to.Ptr("Microsoft.LoadTestService/locations/quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.LoadTestService/locations/westus/quotas/testQuotaBucket"), - // Properties: &armloadtesting.CheckQuotaAvailabilityResponseProperties{ - // AvailabilityStatus: to.Ptr("The requested quota is currently unavailable. Please request for different quota, or upgrade subscription offer type and try again later."), - // IsAvailable: to.Ptr(false), - // }, - // } -} diff --git a/sdk/resourcemanager/loadtesting/armloadtesting/response_types.go b/sdk/resourcemanager/loadtesting/armloadtesting/responses.go similarity index 87% rename from sdk/resourcemanager/loadtesting/armloadtesting/response_types.go rename to sdk/resourcemanager/loadtesting/armloadtesting/responses.go index bac914afaefd..5c08f96b9456 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/response_types.go +++ b/sdk/resourcemanager/loadtesting/armloadtesting/responses.go @@ -1,6 +1,3 @@ -//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. @@ -10,7 +7,7 @@ package armloadtesting // LoadTestsClientCreateOrUpdateResponse contains the response from method LoadTestsClient.BeginCreateOrUpdate. type LoadTestsClientCreateOrUpdateResponse struct { - // LoadTest details + // LoadTest details. LoadTestResource } @@ -21,31 +18,31 @@ type LoadTestsClientDeleteResponse struct { // LoadTestsClientGetResponse contains the response from method LoadTestsClient.Get. type LoadTestsClientGetResponse struct { - // LoadTest details + // LoadTest details. LoadTestResource } // LoadTestsClientListByResourceGroupResponse contains the response from method LoadTestsClient.NewListByResourceGroupPager. type LoadTestsClientListByResourceGroupResponse struct { - // List of resources page result. - LoadTestResourcePageList + // The response of a LoadTestResource list operation. + LoadTestResourceListResult } // LoadTestsClientListBySubscriptionResponse contains the response from method LoadTestsClient.NewListBySubscriptionPager. type LoadTestsClientListBySubscriptionResponse struct { - // List of resources page result. - LoadTestResourcePageList + // The response of a LoadTestResource list operation. + LoadTestResourceListResult } // LoadTestsClientListOutboundNetworkDependenciesEndpointsResponse contains the response from method LoadTestsClient.NewListOutboundNetworkDependenciesEndpointsPager. type LoadTestsClientListOutboundNetworkDependenciesEndpointsResponse struct { // Values returned by the List operation. - OutboundEnvironmentEndpointCollection + PagedOutboundEnvironmentEndpoint } // LoadTestsClientUpdateResponse contains the response from method LoadTestsClient.BeginUpdate. type LoadTestsClientUpdateResponse struct { - // LoadTest details + // LoadTest details. LoadTestResource } @@ -69,6 +66,6 @@ type QuotasClientGetResponse struct { // QuotasClientListResponse contains the response from method QuotasClient.NewListPager. type QuotasClientListResponse struct { - // List of quota bucket objects. It contains a URL link to get the next set of results. - QuotaResourceList + // The response of a QuotaResource list operation. + QuotaResourceListResult } diff --git a/sdk/resourcemanager/loadtesting/armloadtesting/time_rfc3339.go b/sdk/resourcemanager/loadtesting/armloadtesting/time_rfc3339.go index da6dcc2e1872..8e626795d3b3 100644 --- a/sdk/resourcemanager/loadtesting/armloadtesting/time_rfc3339.go +++ b/sdk/resourcemanager/loadtesting/armloadtesting/time_rfc3339.go @@ -1,6 +1,3 @@ -//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. @@ -19,12 +16,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +41,36 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +81,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +98,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339