diff --git a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/CHANGELOG.md b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/CHANGELOG.md index bd0c34b7f51f..b6e560d174fa 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/CHANGELOG.md +++ b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.0.1 (2025-04-27) +### Other Changes + + ## 1.0.0 (2024-06-21) ### Breaking Changes diff --git a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/autorest.md b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/autorest.md index 184d755b1053..413c07da9e6f 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/autorest.md +++ b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/appcomplianceautomation/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/appcomplianceautomation/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 -tag: package-2024-06 +module-version: 1.0.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/client_factory.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/client_factory.go index 0ff4db77815c..3e66fd1e6748 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/client_factory.go +++ b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/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. diff --git a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/constants.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/constants.go index 8669e3642a58..3ec4aed8e994 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/constants.go +++ b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/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 armappcomplianceautomation const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation" - moduleVersion = "v1.0.0" + moduleVersion = "v1.0.1" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/evidence_client.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/evidence_client.go index 071c14064d01..23f1b78072b2 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/evidence_client.go +++ b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/evidence_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. @@ -140,7 +137,7 @@ func (client *EvidenceClient) Delete(ctx context.Context, reportName string, evi } // deleteCreateRequest creates the Delete request. -func (client *EvidenceClient) deleteCreateRequest(ctx context.Context, reportName string, evidenceName string, options *EvidenceClientDeleteOptions) (*policy.Request, error) { +func (client *EvidenceClient) deleteCreateRequest(ctx context.Context, reportName string, evidenceName string, _ *EvidenceClientDeleteOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/evidences/{evidenceName}" if reportName == "" { return nil, errors.New("parameter reportName cannot be empty") @@ -192,7 +189,7 @@ func (client *EvidenceClient) Download(ctx context.Context, reportName string, e } // downloadCreateRequest creates the Download request. -func (client *EvidenceClient) downloadCreateRequest(ctx context.Context, reportName string, evidenceName string, body EvidenceFileDownloadRequest, options *EvidenceClientDownloadOptions) (*policy.Request, error) { +func (client *EvidenceClient) downloadCreateRequest(ctx context.Context, reportName string, evidenceName string, body EvidenceFileDownloadRequest, _ *EvidenceClientDownloadOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/evidences/{evidenceName}/download" if reportName == "" { return nil, errors.New("parameter reportName cannot be empty") @@ -255,7 +252,7 @@ func (client *EvidenceClient) Get(ctx context.Context, reportName string, eviden } // getCreateRequest creates the Get request. -func (client *EvidenceClient) getCreateRequest(ctx context.Context, reportName string, evidenceName string, options *EvidenceClientGetOptions) (*policy.Request, error) { +func (client *EvidenceClient) getCreateRequest(ctx context.Context, reportName string, evidenceName string, _ *EvidenceClientGetOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/evidences/{evidenceName}" if reportName == "" { return nil, errors.New("parameter reportName cannot be empty") diff --git a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/evidence_client_example_test.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/evidence_client_example_test.go deleted file mode 100644 index 253b2cf2fe1e..000000000000 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/evidence_client_example_test.go +++ /dev/null @@ -1,200 +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 armappcomplianceautomation_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Evidence_ListByReport.json -func ExampleEvidenceClient_NewListByReportPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewEvidenceClient().NewListByReportPager("reportName", &armappcomplianceautomation.EvidenceClientListByReportOptions{SkipToken: nil, - Top: nil, - Select: nil, - Filter: nil, - Orderby: nil, - OfferGUID: nil, - ReportCreatorTenantID: 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.EvidenceResourceListResult = armappcomplianceautomation.EvidenceResourceListResult{ - // Value: []*armappcomplianceautomation.EvidenceResource{ - // { - // Name: to.Ptr("evidence1"), - // Type: to.Ptr("Microsfot.AppComplianceAutomation/reports/evidences"), - // ID: to.Ptr("/provider/Microsfot.AppComplianceAutomation/reports/testReportName/evidences/evidence1"), - // SystemData: &armappcomplianceautomation.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // CreatedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // CreatedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // LastModifiedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // LastModifiedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // }, - // Properties: &armappcomplianceautomation.EvidenceProperties{ - // ControlID: to.Ptr("Operational_Security_10"), - // EvidenceType: to.Ptr(armappcomplianceautomation.EvidenceTypeFile), - // ExtraData: to.Ptr("sampleData"), - // FilePath: to.Ptr("/acat-container/evidence1.png"), - // ProvisioningState: to.Ptr(armappcomplianceautomation.ProvisioningStateSucceeded), - // ResponsibilityID: to.Ptr("authorized_ip_ranges_should_be_defined_on_kubernetes_services"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Evidence_Get.json -func ExampleEvidenceClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEvidenceClient().Get(ctx, "testReportName", "evidence1", 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.EvidenceResource = armappcomplianceautomation.EvidenceResource{ - // Name: to.Ptr("evidence1"), - // Type: to.Ptr("Microsfot.AppComplianceAutomation/reports/evidences"), - // ID: to.Ptr("/provider/Microsfot.AppComplianceAutomation/reports/testReportName/evidences/evidence1"), - // SystemData: &armappcomplianceautomation.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // CreatedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // CreatedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // LastModifiedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // LastModifiedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // }, - // Properties: &armappcomplianceautomation.EvidenceProperties{ - // ControlID: to.Ptr("Operational_Security_10"), - // EvidenceType: to.Ptr(armappcomplianceautomation.EvidenceTypeFile), - // ExtraData: to.Ptr("sampleData"), - // FilePath: to.Ptr("/acat-container/evidence1.png"), - // ProvisioningState: to.Ptr(armappcomplianceautomation.ProvisioningStateSucceeded), - // ResponsibilityID: to.Ptr("authorized_ip_ranges_should_be_defined_on_kubernetes_services"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Evidence_CreateOrUpdate.json -func ExampleEvidenceClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEvidenceClient().CreateOrUpdate(ctx, "testReportName", "evidence1", armappcomplianceautomation.EvidenceResource{}, &armappcomplianceautomation.EvidenceClientCreateOrUpdateOptions{OfferGUID: nil, - ReportCreatorTenantID: 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.EvidenceResource = armappcomplianceautomation.EvidenceResource{ - // Name: to.Ptr("evidence1"), - // Type: to.Ptr("Microsfot.AppComplianceAutomation/reports/evidences"), - // ID: to.Ptr("/provider/Microsfot.AppComplianceAutomation/reports/testReportName/evidences/evidence1"), - // SystemData: &armappcomplianceautomation.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // CreatedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // CreatedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // LastModifiedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // LastModifiedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // }, - // Properties: &armappcomplianceautomation.EvidenceProperties{ - // ControlID: to.Ptr("Operational_Security_10"), - // EvidenceType: to.Ptr(armappcomplianceautomation.EvidenceTypeFile), - // ExtraData: to.Ptr("sampleData"), - // FilePath: to.Ptr("/acat-container/evidence1.png"), - // ProvisioningState: to.Ptr(armappcomplianceautomation.ProvisioningStateSucceeded), - // ResponsibilityID: to.Ptr("authorized_ip_ranges_should_be_defined_on_kubernetes_services"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Evidence_Delete.json -func ExampleEvidenceClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewEvidenceClient().Delete(ctx, "testReportName", "evidence1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Evidence_Download.json -func ExampleEvidenceClient_Download() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEvidenceClient().Download(ctx, "testReportName", "evidence1", armappcomplianceautomation.EvidenceFileDownloadRequest{}, 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.EvidenceFileDownloadResponse = armappcomplianceautomation.EvidenceFileDownloadResponse{ - // EvidenceFile: &armappcomplianceautomation.EvidenceFileDownloadResponseEvidenceFile{ - // URL: to.Ptr("this is a url"), - // }, - // } -} diff --git a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/fake/evidence_server.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/fake/evidence_server.go index 5b394f0b994a..0fb45213722c 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/fake/evidence_server.go +++ b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/fake/evidence_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. @@ -71,29 +68,48 @@ func (e *EvidenceServerTransport) 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 e.dispatchToMethodFake(req, method) +} - switch method { - case "EvidenceClient.CreateOrUpdate": - resp, err = e.dispatchCreateOrUpdate(req) - case "EvidenceClient.Delete": - resp, err = e.dispatchDelete(req) - case "EvidenceClient.Download": - resp, err = e.dispatchDownload(req) - case "EvidenceClient.Get": - resp, err = e.dispatchGet(req) - case "EvidenceClient.NewListByReportPager": - resp, err = e.dispatchNewListByReportPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (e *EvidenceServerTransport) 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 evidenceServerTransportInterceptor != nil { + res.resp, res.err, intercepted = evidenceServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "EvidenceClient.CreateOrUpdate": + res.resp, res.err = e.dispatchCreateOrUpdate(req) + case "EvidenceClient.Delete": + res.resp, res.err = e.dispatchDelete(req) + case "EvidenceClient.Download": + res.resp, res.err = e.dispatchDownload(req) + case "EvidenceClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "EvidenceClient.NewListByReportPager": + res.resp, res.err = e.dispatchNewListByReportPager(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 (e *EvidenceServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -347,3 +363,9 @@ func (e *EvidenceServerTransport) dispatchNewListByReportPager(req *http.Request } return resp, nil } + +// set this to conditionally intercept incoming requests to EvidenceServerTransport +var evidenceServerTransportInterceptor 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/appcomplianceautomation/armappcomplianceautomation/fake/internal.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/fake/internal.go index 7d2f89ba4bb2..c614f8d5643a 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/fake/internal.go +++ b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/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. @@ -15,6 +12,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/fake/operations_server.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/fake/operations_server.go index 9a306b2a812e..8c48b76c59d7 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/fake/operations_server.go +++ b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/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. @@ -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/appcomplianceautomation/armappcomplianceautomation/fake/provideractions_server.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/fake/provideractions_server.go index 93b2fa1b145e..916048739815 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/fake/provideractions_server.go +++ b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/fake/provideractions_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. @@ -73,31 +70,50 @@ func (p *ProviderActionsServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return p.dispatchToMethodFake(req, method) +} - switch method { - case "ProviderActionsClient.CheckNameAvailability": - resp, err = p.dispatchCheckNameAvailability(req) - case "ProviderActionsClient.GetCollectionCount": - resp, err = p.dispatchGetCollectionCount(req) - case "ProviderActionsClient.GetOverviewStatus": - resp, err = p.dispatchGetOverviewStatus(req) - case "ProviderActionsClient.ListInUseStorageAccounts": - resp, err = p.dispatchListInUseStorageAccounts(req) - case "ProviderActionsClient.BeginOnboard": - resp, err = p.dispatchBeginOnboard(req) - case "ProviderActionsClient.BeginTriggerEvaluation": - resp, err = p.dispatchBeginTriggerEvaluation(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (p *ProviderActionsServerTransport) 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 providerActionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = providerActionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ProviderActionsClient.CheckNameAvailability": + res.resp, res.err = p.dispatchCheckNameAvailability(req) + case "ProviderActionsClient.GetCollectionCount": + res.resp, res.err = p.dispatchGetCollectionCount(req) + case "ProviderActionsClient.GetOverviewStatus": + res.resp, res.err = p.dispatchGetOverviewStatus(req) + case "ProviderActionsClient.ListInUseStorageAccounts": + res.resp, res.err = p.dispatchListInUseStorageAccounts(req) + case "ProviderActionsClient.BeginOnboard": + res.resp, res.err = p.dispatchBeginOnboard(req) + case "ProviderActionsClient.BeginTriggerEvaluation": + res.resp, res.err = p.dispatchBeginTriggerEvaluation(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 (p *ProviderActionsServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { @@ -259,3 +275,9 @@ func (p *ProviderActionsServerTransport) dispatchBeginTriggerEvaluation(req *htt return resp, nil } + +// set this to conditionally intercept incoming requests to ProviderActionsServerTransport +var providerActionsServerTransportInterceptor 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/appcomplianceautomation/armappcomplianceautomation/fake/report_server.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/fake/report_server.go index f627cbb0aa38..ff93589b78d7 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/fake/report_server.go +++ b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/fake/report_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. @@ -30,7 +27,7 @@ type ReportServer struct { BeginCreateOrUpdate func(ctx context.Context, reportName string, properties armappcomplianceautomation.ReportResource, options *armappcomplianceautomation.ReportClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armappcomplianceautomation.ReportClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method ReportClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, reportName string, options *armappcomplianceautomation.ReportClientBeginDeleteOptions) (resp azfake.PollerResponder[armappcomplianceautomation.ReportClientDeleteResponse], errResp azfake.ErrorResponder) // BeginFix is the fake for method ReportClient.BeginFix @@ -103,39 +100,58 @@ func (r *ReportServerTransport) 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 "ReportClient.BeginCreateOrUpdate": - resp, err = r.dispatchBeginCreateOrUpdate(req) - case "ReportClient.BeginDelete": - resp, err = r.dispatchBeginDelete(req) - case "ReportClient.BeginFix": - resp, err = r.dispatchBeginFix(req) - case "ReportClient.Get": - resp, err = r.dispatchGet(req) - case "ReportClient.GetScopingQuestions": - resp, err = r.dispatchGetScopingQuestions(req) - case "ReportClient.NewListPager": - resp, err = r.dispatchNewListPager(req) - case "ReportClient.NestedResourceCheckNameAvailability": - resp, err = r.dispatchNestedResourceCheckNameAvailability(req) - case "ReportClient.BeginSyncCertRecord": - resp, err = r.dispatchBeginSyncCertRecord(req) - case "ReportClient.BeginUpdate": - resp, err = r.dispatchBeginUpdate(req) - case "ReportClient.BeginVerify": - resp, err = r.dispatchBeginVerify(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return r.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (r *ReportServerTransport) 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 reportServerTransportInterceptor != nil { + res.resp, res.err, intercepted = reportServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ReportClient.BeginCreateOrUpdate": + res.resp, res.err = r.dispatchBeginCreateOrUpdate(req) + case "ReportClient.BeginDelete": + res.resp, res.err = r.dispatchBeginDelete(req) + case "ReportClient.BeginFix": + res.resp, res.err = r.dispatchBeginFix(req) + case "ReportClient.Get": + res.resp, res.err = r.dispatchGet(req) + case "ReportClient.GetScopingQuestions": + res.resp, res.err = r.dispatchGetScopingQuestions(req) + case "ReportClient.NewListPager": + res.resp, res.err = r.dispatchNewListPager(req) + case "ReportClient.NestedResourceCheckNameAvailability": + res.resp, res.err = r.dispatchNestedResourceCheckNameAvailability(req) + case "ReportClient.BeginSyncCertRecord": + res.resp, res.err = r.dispatchBeginSyncCertRecord(req) + case "ReportClient.BeginUpdate": + res.resp, res.err = r.dispatchBeginUpdate(req) + case "ReportClient.BeginVerify": + res.resp, res.err = r.dispatchBeginVerify(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 (r *ReportServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -211,9 +227,9 @@ func (r *ReportServerTransport) dispatchBeginDelete(req *http.Request) (*http.Re return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { r.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { r.beginDelete.remove(req) @@ -564,3 +580,9 @@ func (r *ReportServerTransport) dispatchBeginVerify(req *http.Request) (*http.Re return resp, nil } + +// set this to conditionally intercept incoming requests to ReportServerTransport +var reportServerTransportInterceptor 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/appcomplianceautomation/armappcomplianceautomation/fake/scopingconfiguration_server.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/fake/scopingconfiguration_server.go index becf220e9b5f..649da00b56f6 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/fake/scopingconfiguration_server.go +++ b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/fake/scopingconfiguration_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. @@ -66,27 +63,46 @@ func (s *ScopingConfigurationServerTransport) Do(req *http.Request) (*http.Respo return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "ScopingConfigurationClient.CreateOrUpdate": - resp, err = s.dispatchCreateOrUpdate(req) - case "ScopingConfigurationClient.Delete": - resp, err = s.dispatchDelete(req) - case "ScopingConfigurationClient.Get": - resp, err = s.dispatchGet(req) - case "ScopingConfigurationClient.NewListPager": - resp, err = s.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *ScopingConfigurationServerTransport) 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 scopingConfigurationServerTransportInterceptor != nil { + res.resp, res.err, intercepted = scopingConfigurationServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ScopingConfigurationClient.CreateOrUpdate": + res.resp, res.err = s.dispatchCreateOrUpdate(req) + case "ScopingConfigurationClient.Delete": + res.resp, res.err = s.dispatchDelete(req) + case "ScopingConfigurationClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "ScopingConfigurationClient.NewListPager": + res.resp, res.err = s.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 (s *ScopingConfigurationServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -228,3 +244,9 @@ func (s *ScopingConfigurationServerTransport) dispatchNewListPager(req *http.Req } return resp, nil } + +// set this to conditionally intercept incoming requests to ScopingConfigurationServerTransport +var scopingConfigurationServerTransportInterceptor 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/appcomplianceautomation/armappcomplianceautomation/fake/server_factory.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/fake/server_factory.go index 3dbbf57b95b2..7181a923730c 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/fake/server_factory.go +++ b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/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,13 +16,26 @@ import ( // ServerFactory is a fake server for instances of the armappcomplianceautomation.ClientFactory type. type ServerFactory struct { - EvidenceServer EvidenceServer - OperationsServer OperationsServer - ProviderActionsServer ProviderActionsServer - ReportServer ReportServer + // EvidenceServer contains the fakes for client EvidenceClient + EvidenceServer EvidenceServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // ProviderActionsServer contains the fakes for client ProviderActionsClient + ProviderActionsServer ProviderActionsServer + + // ReportServer contains the fakes for client ReportClient + ReportServer ReportServer + + // ScopingConfigurationServer contains the fakes for client ScopingConfigurationClient ScopingConfigurationServer ScopingConfigurationServer - SnapshotServer SnapshotServer - WebhookServer WebhookServer + + // SnapshotServer contains the fakes for client SnapshotClient + SnapshotServer SnapshotServer + + // WebhookServer contains the fakes for client WebhookClient + WebhookServer WebhookServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. diff --git a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/fake/snapshot_server.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/fake/snapshot_server.go index 7fa6cfb2a3dd..8d9caa7cf73d 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/fake/snapshot_server.go +++ b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/fake/snapshot_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. @@ -65,25 +62,44 @@ func (s *SnapshotServerTransport) 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 s.dispatchToMethodFake(req, method) +} - switch method { - case "SnapshotClient.BeginDownload": - resp, err = s.dispatchBeginDownload(req) - case "SnapshotClient.Get": - resp, err = s.dispatchGet(req) - case "SnapshotClient.NewListPager": - resp, err = s.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *SnapshotServerTransport) 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 snapshotServerTransportInterceptor != nil { + res.resp, res.err, intercepted = snapshotServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SnapshotClient.BeginDownload": + res.resp, res.err = s.dispatchBeginDownload(req) + case "SnapshotClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SnapshotClient.NewListPager": + res.resp, res.err = s.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 (s *SnapshotServerTransport) dispatchBeginDownload(req *http.Request) (*http.Response, error) { @@ -260,3 +276,9 @@ func (s *SnapshotServerTransport) dispatchNewListPager(req *http.Request) (*http } return resp, nil } + +// set this to conditionally intercept incoming requests to SnapshotServerTransport +var snapshotServerTransportInterceptor 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/appcomplianceautomation/armappcomplianceautomation/fake/webhook_server.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/fake/webhook_server.go index b6af80746b44..27e22aa70a53 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/fake/webhook_server.go +++ b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/fake/webhook_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. @@ -71,29 +68,48 @@ func (w *WebhookServerTransport) 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 w.dispatchToMethodFake(req, method) +} - switch method { - case "WebhookClient.CreateOrUpdate": - resp, err = w.dispatchCreateOrUpdate(req) - case "WebhookClient.Delete": - resp, err = w.dispatchDelete(req) - case "WebhookClient.Get": - resp, err = w.dispatchGet(req) - case "WebhookClient.NewListPager": - resp, err = w.dispatchNewListPager(req) - case "WebhookClient.Update": - resp, err = w.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (w *WebhookServerTransport) 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 webhookServerTransportInterceptor != nil { + res.resp, res.err, intercepted = webhookServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "WebhookClient.CreateOrUpdate": + res.resp, res.err = w.dispatchCreateOrUpdate(req) + case "WebhookClient.Delete": + res.resp, res.err = w.dispatchDelete(req) + case "WebhookClient.Get": + res.resp, res.err = w.dispatchGet(req) + case "WebhookClient.NewListPager": + res.resp, res.err = w.dispatchNewListPager(req) + case "WebhookClient.Update": + res.resp, res.err = w.dispatchUpdate(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 (w *WebhookServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -329,3 +345,9 @@ func (w *WebhookServerTransport) dispatchUpdate(req *http.Request) (*http.Respon } return resp, nil } + +// set this to conditionally intercept incoming requests to WebhookServerTransport +var webhookServerTransportInterceptor 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/appcomplianceautomation/armappcomplianceautomation/go.mod b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/go.mod index a1161fd11d43..48cfae85a8d8 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/go.mod +++ b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcomplianceautoma 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 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.2 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.36.0 // indirect golang.org/x/net v0.38.0 // indirect - golang.org/x/sys v0.31.0 // indirect golang.org/x/text v0.23.0 // indirect ) diff --git a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/go.sum b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/go.sum index 4bacf756f06c..4de695d9e23a 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/go.sum +++ b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/go.sum @@ -1,44 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 h1:DSDNVxqkoXJiko6x8a90zidoYqnYYa6c1MTzDKzKkTo= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1/go.mod h1:zGqV2R4Cr/k8Uye5w+dgQ06WJtEcbQG/8J7BB6hnCr4= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 h1:F0gBpfdPLGsw+nsgk6aqqkZS1jiixa5WwFe3fk/T3Ys= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2/go.mod h1:SqINnQ9lVVdRlyC8cd1lCI0SdX4n2paeABd2K8ggfnE= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2 h1:yz1bePFlP5Vws5+8ez6T3HWXPmwOK7Yvq8QxDBD3SKY= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2/go.mod h1:Pa9ZNPuoNu/GztvBSKk9J1cDJW6vk/n0zLtV4mgd8N8= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= -github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 h1:oygO0locgZJe7PpYPXT5A29ZkwJaPqcva7BVeemZOZs= -github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= -github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= -github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8= -github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6 h1:IsMZxCuZqKuao2vNdfD82fjjgPLfyHLpR41Z88viRWs= -github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6/go.mod h1:3VeWNIJaW+O5xpRQbPp0Ybqu1vJd/pm7s2F473HRrkw= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E= -github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= -golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= -golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/models.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/models.go index 66362f8de9f1..4b129d9c4a76 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/models.go +++ b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/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. diff --git a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/models_serde.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/models_serde.go index 92dd8c6ba27d..05a4b2d72f95 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/models_serde.go +++ b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/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. diff --git a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/operations_client.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/operations_client.go index 4679cac31243..2bcac2e58098 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/operations_client.go +++ b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/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. @@ -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.AppComplianceAutomation/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { diff --git a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/operations_client_example_test.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/operations_client_example_test.go deleted file mode 100644 index 7b2492f0a03f..000000000000 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/operations_client_example_test.go +++ /dev/null @@ -1,56 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armappcomplianceautomation_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/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 := armappcomplianceautomation.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 = armappcomplianceautomation.OperationListResult{ - // Value: []*armappcomplianceautomation.Operation{ - // { - // Name: to.Ptr("Microsoft.AppComplianceAutomation/reports/write"), - // Display: &armappcomplianceautomation.OperationDisplay{ - // Description: to.Ptr("Create new reports."), - // Operation: to.Ptr("Microsoft.AppComplianceAutomation/reports/write"), - // Provider: to.Ptr("Microsoft AppComplianceAutomation"), - // Resource: to.Ptr("Microsoft.AppComplianceAutomation/reports"), - // }, - // IsDataAction: to.Ptr(false), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/options.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/options.go index 607d9f17961d..da95fcf33cf4 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/options.go +++ b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/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. @@ -63,14 +60,14 @@ type OperationsClientListOptions struct { // ProviderActionsClientBeginOnboardOptions contains the optional parameters for the ProviderActionsClient.BeginOnboard method. type ProviderActionsClientBeginOnboardOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ProviderActionsClientBeginTriggerEvaluationOptions contains the optional parameters for the ProviderActionsClient.BeginTriggerEvaluation // method. type ProviderActionsClientBeginTriggerEvaluationOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -100,37 +97,37 @@ type ProviderActionsClientListInUseStorageAccountsOptions struct { // ReportClientBeginCreateOrUpdateOptions contains the optional parameters for the ReportClient.BeginCreateOrUpdate method. type ReportClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ReportClientBeginDeleteOptions contains the optional parameters for the ReportClient.BeginDelete method. type ReportClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ReportClientBeginFixOptions contains the optional parameters for the ReportClient.BeginFix method. type ReportClientBeginFixOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ReportClientBeginSyncCertRecordOptions contains the optional parameters for the ReportClient.BeginSyncCertRecord method. type ReportClientBeginSyncCertRecordOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ReportClientBeginUpdateOptions contains the optional parameters for the ReportClient.BeginUpdate method. type ReportClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ReportClientBeginVerifyOptions contains the optional parameters for the ReportClient.BeginVerify method. type ReportClientBeginVerifyOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -198,7 +195,7 @@ type ScopingConfigurationClientListOptions struct { // SnapshotClientBeginDownloadOptions contains the optional parameters for the SnapshotClient.BeginDownload method. type SnapshotClientBeginDownloadOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } diff --git a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/provideractions_client.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/provideractions_client.go index ebd97e380b72..09db9d23da69 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/provideractions_client.go +++ b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/provideractions_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. @@ -67,7 +64,7 @@ func (client *ProviderActionsClient) CheckNameAvailability(ctx context.Context, } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. -func (client *ProviderActionsClient) checkNameAvailabilityCreateRequest(ctx context.Context, body CheckNameAvailabilityRequest, options *ProviderActionsClientCheckNameAvailabilityOptions) (*policy.Request, error) { +func (client *ProviderActionsClient) checkNameAvailabilityCreateRequest(ctx context.Context, body CheckNameAvailabilityRequest, _ *ProviderActionsClientCheckNameAvailabilityOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.AppComplianceAutomation/checkNameAvailability" req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { @@ -122,7 +119,7 @@ func (client *ProviderActionsClient) GetCollectionCount(ctx context.Context, bod } // getCollectionCountCreateRequest creates the GetCollectionCount request. -func (client *ProviderActionsClient) getCollectionCountCreateRequest(ctx context.Context, body GetCollectionCountRequest, options *ProviderActionsClientGetCollectionCountOptions) (*policy.Request, error) { +func (client *ProviderActionsClient) getCollectionCountCreateRequest(ctx context.Context, body GetCollectionCountRequest, _ *ProviderActionsClientGetCollectionCountOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.AppComplianceAutomation/getCollectionCount" req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { @@ -177,7 +174,7 @@ func (client *ProviderActionsClient) GetOverviewStatus(ctx context.Context, body } // getOverviewStatusCreateRequest creates the GetOverviewStatus request. -func (client *ProviderActionsClient) getOverviewStatusCreateRequest(ctx context.Context, body GetOverviewStatusRequest, options *ProviderActionsClientGetOverviewStatusOptions) (*policy.Request, error) { +func (client *ProviderActionsClient) getOverviewStatusCreateRequest(ctx context.Context, body GetOverviewStatusRequest, _ *ProviderActionsClientGetOverviewStatusOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.AppComplianceAutomation/getOverviewStatus" req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { @@ -232,7 +229,7 @@ func (client *ProviderActionsClient) ListInUseStorageAccounts(ctx context.Contex } // listInUseStorageAccountsCreateRequest creates the ListInUseStorageAccounts request. -func (client *ProviderActionsClient) listInUseStorageAccountsCreateRequest(ctx context.Context, body ListInUseStorageAccountsRequest, options *ProviderActionsClientListInUseStorageAccountsOptions) (*policy.Request, error) { +func (client *ProviderActionsClient) listInUseStorageAccountsCreateRequest(ctx context.Context, body ListInUseStorageAccountsRequest, _ *ProviderActionsClientListInUseStorageAccountsOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.AppComplianceAutomation/listInUseStorageAccounts" req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { @@ -308,7 +305,7 @@ func (client *ProviderActionsClient) onboard(ctx context.Context, body OnboardRe } // onboardCreateRequest creates the Onboard request. -func (client *ProviderActionsClient) onboardCreateRequest(ctx context.Context, body OnboardRequest, options *ProviderActionsClientBeginOnboardOptions) (*policy.Request, error) { +func (client *ProviderActionsClient) onboardCreateRequest(ctx context.Context, body OnboardRequest, _ *ProviderActionsClientBeginOnboardOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.AppComplianceAutomation/onboard" req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { @@ -375,7 +372,7 @@ func (client *ProviderActionsClient) triggerEvaluation(ctx context.Context, body } // triggerEvaluationCreateRequest creates the TriggerEvaluation request. -func (client *ProviderActionsClient) triggerEvaluationCreateRequest(ctx context.Context, body TriggerEvaluationRequest, options *ProviderActionsClientBeginTriggerEvaluationOptions) (*policy.Request, error) { +func (client *ProviderActionsClient) triggerEvaluationCreateRequest(ctx context.Context, body TriggerEvaluationRequest, _ *ProviderActionsClientBeginTriggerEvaluationOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.AppComplianceAutomation/triggerEvaluation" req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { diff --git a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/provideractions_client_example_test.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/provideractions_client_example_test.go deleted file mode 100644 index a2f22ce4e86d..000000000000 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/provideractions_client_example_test.go +++ /dev/null @@ -1,251 +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 armappcomplianceautomation_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Report_CheckNameAvailability.json -func ExampleProviderActionsClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProviderActionsClient().CheckNameAvailability(ctx, armappcomplianceautomation.CheckNameAvailabilityRequest{}, 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.CheckNameAvailabilityResponse = armappcomplianceautomation.CheckNameAvailabilityResponse{ - // Message: to.Ptr("An report named 'reportABC' is already in use."), - // NameAvailable: to.Ptr(false), - // Reason: to.Ptr(armappcomplianceautomation.CheckNameAvailabilityReasonAlreadyExists), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Report_GetCollectionCount.json -func ExampleProviderActionsClient_GetCollectionCount() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProviderActionsClient().GetCollectionCount(ctx, armappcomplianceautomation.GetCollectionCountRequest{}, 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.GetCollectionCountResponse = armappcomplianceautomation.GetCollectionCountResponse{ - // Count: to.Ptr[int32](100), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Report_GetOverviewStatus.json -func ExampleProviderActionsClient_GetOverviewStatus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProviderActionsClient().GetOverviewStatus(ctx, armappcomplianceautomation.GetOverviewStatusRequest{}, 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.GetOverviewStatusResponse = armappcomplianceautomation.GetOverviewStatusResponse{ - // StatusList: []*armappcomplianceautomation.StatusItem{ - // { - // StatusName: to.Ptr("Active"), - // StatusValue: to.Ptr("100"), - // }, - // { - // StatusName: to.Ptr("Failed"), - // StatusValue: to.Ptr("0"), - // }, - // { - // StatusName: to.Ptr("Disabled"), - // StatusValue: to.Ptr("0"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/ListInUseStorageAccountsWithSubscriptions.json -func ExampleProviderActionsClient_ListInUseStorageAccounts_listInUseStorageAccountsWithSubscriptions() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProviderActionsClient().ListInUseStorageAccounts(ctx, armappcomplianceautomation.ListInUseStorageAccountsRequest{}, 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.ListInUseStorageAccountsResponse = armappcomplianceautomation.ListInUseStorageAccountsResponse{ - // StorageAccountList: []*armappcomplianceautomation.StorageInfo{ - // { - // AccountName: to.Ptr("SA_name1"), - // Location: to.Ptr("WEST US"), - // ResourceGroup: to.Ptr("tetsRG"), - // SubscriptionID: to.Ptr("0000000-0000-0000-0000-000000000001"), - // }, - // { - // AccountName: to.Ptr("SA_name2"), - // Location: to.Ptr("WEST US"), - // ResourceGroup: to.Ptr("tetsRG"), - // SubscriptionID: to.Ptr("0000000-0000-0000-0000-000000000001"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/ListInUseStorageAccountsWithoutSubscriptions.json -func ExampleProviderActionsClient_ListInUseStorageAccounts_listInUseStorageAccountsWithoutSubscriptions() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProviderActionsClient().ListInUseStorageAccounts(ctx, armappcomplianceautomation.ListInUseStorageAccountsRequest{}, 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.ListInUseStorageAccountsResponse = armappcomplianceautomation.ListInUseStorageAccountsResponse{ - // StorageAccountList: []*armappcomplianceautomation.StorageInfo{ - // { - // AccountName: to.Ptr("SA_name1"), - // Location: to.Ptr("WEST US"), - // ResourceGroup: to.Ptr("tetsRG"), - // SubscriptionID: to.Ptr("0000000-0000-0000-0000-000000000001"), - // }, - // { - // AccountName: to.Ptr("SA_name2"), - // Location: to.Ptr("WEST US"), - // ResourceGroup: to.Ptr("tetsRG"), - // SubscriptionID: to.Ptr("0000000-0000-0000-0000-000000000001"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Onboard.json -func ExampleProviderActionsClient_BeginOnboard() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProviderActionsClient().BeginOnboard(ctx, armappcomplianceautomation.OnboardRequest{}, 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.OnboardResponse = armappcomplianceautomation.OnboardResponse{ - // SubscriptionIDs: []*string{ - // to.Ptr("00000000-0000-0000-0000-000000000000"), - // to.Ptr("00000000-0000-0000-0000-000000000001")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/TriggerEvaluation.json -func ExampleProviderActionsClient_BeginTriggerEvaluation() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProviderActionsClient().BeginTriggerEvaluation(ctx, armappcomplianceautomation.TriggerEvaluationRequest{}, 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.TriggerEvaluationResponse = armappcomplianceautomation.TriggerEvaluationResponse{ - // Properties: &armappcomplianceautomation.TriggerEvaluationProperty{ - // EvaluationEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:10:00.000Z"); return t}()), - // QuickAssessments: []*armappcomplianceautomation.QuickAssessment{ - // { - // Description: to.Ptr("Protect your storage accounts from potential threats using virtual network rules as a preferred method instead of IP-based filtering. Disabling IP-based filtering prevents public IPs from accessing your storage accounts."), - // DisplayName: to.Ptr("Storage accounts should restrict network access using virtual network rules"), - // RemediationLink: to.Ptr("Protect your storage accounts from potential threats using virtual network rules as a preferred method instead of IP-based filtering. Disabling IP-based filtering prevents public IPs from accessing your storage accounts."), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/storettas3iw2megtcarm"), - // ResourceStatus: to.Ptr(armappcomplianceautomation.ResourceStatusHealthy), - // ResponsibilityID: to.Ptr("/providers/microsoft.authorization/policydefinitions/2a1a9cdf-e04d-429a-8416-3bfb72a1b26f"), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:00:00.000Z"); return t}()), - // }, - // { - // Description: to.Ptr(""), - // DisplayName: to.Ptr("Secure transfer to storage accounts should be enabled"), - // RemediationLink: to.Ptr(""), - // ResourceID: to.Ptr("/subscriptions/0000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/storettas3iw2megtcarm"), - // ResourceStatus: to.Ptr(armappcomplianceautomation.ResourceStatusUnhealthy), - // ResponsibilityID: to.Ptr("/providers/Microsoft.Authorization/policyDefinitions/404c3081-a854-4457-ae30-26a93ef643f9"), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:00:00.000Z"); return t}()), - // }}, - // ResourceIDs: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.storage/storageaccounts/storettas3iw2megtcarm")}, - // TriggerTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T05:00:00.000Z"); return t}()), - // }, - // } -} diff --git a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/report_client.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/report_client.go index 7c2a58ddb745..58625d76208f 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/report_client.go +++ b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/report_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. @@ -93,7 +90,7 @@ func (client *ReportClient) createOrUpdate(ctx context.Context, reportName strin } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ReportClient) createOrUpdateCreateRequest(ctx context.Context, reportName string, properties ReportResource, options *ReportClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ReportClient) createOrUpdateCreateRequest(ctx context.Context, reportName string, properties ReportResource, _ *ReportClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.AppComplianceAutomation/reports/{reportName}" if reportName == "" { return nil, errors.New("parameter reportName cannot be empty") @@ -163,7 +160,7 @@ func (client *ReportClient) deleteOperation(ctx context.Context, reportName stri } // deleteCreateRequest creates the Delete request. -func (client *ReportClient) deleteCreateRequest(ctx context.Context, reportName string, options *ReportClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ReportClient) deleteCreateRequest(ctx context.Context, reportName string, _ *ReportClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.AppComplianceAutomation/reports/{reportName}" if reportName == "" { return nil, errors.New("parameter reportName cannot be empty") @@ -232,7 +229,7 @@ func (client *ReportClient) fix(ctx context.Context, reportName string, options } // fixCreateRequest creates the Fix request. -func (client *ReportClient) fixCreateRequest(ctx context.Context, reportName string, options *ReportClientBeginFixOptions) (*policy.Request, error) { +func (client *ReportClient) fixCreateRequest(ctx context.Context, reportName string, _ *ReportClientBeginFixOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/fix" if reportName == "" { return nil, errors.New("parameter reportName cannot be empty") @@ -278,7 +275,7 @@ func (client *ReportClient) Get(ctx context.Context, reportName string, options } // getCreateRequest creates the Get request. -func (client *ReportClient) getCreateRequest(ctx context.Context, reportName string, options *ReportClientGetOptions) (*policy.Request, error) { +func (client *ReportClient) getCreateRequest(ctx context.Context, reportName string, _ *ReportClientGetOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.AppComplianceAutomation/reports/{reportName}" if reportName == "" { return nil, errors.New("parameter reportName cannot be empty") @@ -335,7 +332,7 @@ func (client *ReportClient) GetScopingQuestions(ctx context.Context, reportName } // getScopingQuestionsCreateRequest creates the GetScopingQuestions request. -func (client *ReportClient) getScopingQuestionsCreateRequest(ctx context.Context, reportName string, options *ReportClientGetScopingQuestionsOptions) (*policy.Request, error) { +func (client *ReportClient) getScopingQuestionsCreateRequest(ctx context.Context, reportName string, _ *ReportClientGetScopingQuestionsOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/getScopingQuestions" if reportName == "" { return nil, errors.New("parameter reportName cannot be empty") @@ -464,7 +461,7 @@ func (client *ReportClient) NestedResourceCheckNameAvailability(ctx context.Cont } // nestedResourceCheckNameAvailabilityCreateRequest creates the NestedResourceCheckNameAvailability request. -func (client *ReportClient) nestedResourceCheckNameAvailabilityCreateRequest(ctx context.Context, reportName string, body CheckNameAvailabilityRequest, options *ReportClientNestedResourceCheckNameAvailabilityOptions) (*policy.Request, error) { +func (client *ReportClient) nestedResourceCheckNameAvailabilityCreateRequest(ctx context.Context, reportName string, body CheckNameAvailabilityRequest, _ *ReportClientNestedResourceCheckNameAvailabilityOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/checkNameAvailability" if reportName == "" { return nil, errors.New("parameter reportName cannot be empty") @@ -545,7 +542,7 @@ func (client *ReportClient) syncCertRecord(ctx context.Context, reportName strin } // syncCertRecordCreateRequest creates the SyncCertRecord request. -func (client *ReportClient) syncCertRecordCreateRequest(ctx context.Context, reportName string, body SyncCertRecordRequest, options *ReportClientBeginSyncCertRecordOptions) (*policy.Request, error) { +func (client *ReportClient) syncCertRecordCreateRequest(ctx context.Context, reportName string, body SyncCertRecordRequest, _ *ReportClientBeginSyncCertRecordOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/syncCertRecord" if reportName == "" { return nil, errors.New("parameter reportName cannot be empty") @@ -616,7 +613,7 @@ func (client *ReportClient) update(ctx context.Context, reportName string, prope } // updateCreateRequest creates the Update request. -func (client *ReportClient) updateCreateRequest(ctx context.Context, reportName string, properties ReportResourcePatch, options *ReportClientBeginUpdateOptions) (*policy.Request, error) { +func (client *ReportClient) updateCreateRequest(ctx context.Context, reportName string, properties ReportResourcePatch, _ *ReportClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.AppComplianceAutomation/reports/{reportName}" if reportName == "" { return nil, errors.New("parameter reportName cannot be empty") @@ -686,7 +683,7 @@ func (client *ReportClient) verify(ctx context.Context, reportName string, optio } // verifyCreateRequest creates the Verify request. -func (client *ReportClient) verifyCreateRequest(ctx context.Context, reportName string, options *ReportClientBeginVerifyOptions) (*policy.Request, error) { +func (client *ReportClient) verifyCreateRequest(ctx context.Context, reportName string, _ *ReportClientBeginVerifyOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/verify" if reportName == "" { return nil, errors.New("parameter reportName cannot be empty") diff --git a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/report_client_example_test.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/report_client_example_test.go deleted file mode 100644 index 87bec1aea3a6..000000000000 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/report_client_example_test.go +++ /dev/null @@ -1,648 +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 armappcomplianceautomation_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/appcomplianceautomation/armappcomplianceautomation" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Report_List.json -func ExampleReportClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReportClient().NewListPager(&armappcomplianceautomation.ReportClientListOptions{SkipToken: to.Ptr("1"), - Top: to.Ptr[int32](100), - Select: nil, - Filter: nil, - Orderby: nil, - OfferGUID: to.Ptr("00000000-0000-0000-0000-000000000000"), - ReportCreatorTenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - }) - 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.ReportResourceListResult = armappcomplianceautomation.ReportResourceListResult{ - // Value: []*armappcomplianceautomation.ReportResource{ - // { - // Name: to.Ptr("testReportName"), - // Type: to.Ptr("Microsfot.AppComplianceAutomation/reports"), - // ID: to.Ptr("/provider/Microsfot.AppComplianceAutomation/reports/testReportName"), - // SystemData: &armappcomplianceautomation.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // CreatedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // CreatedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // LastModifiedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // LastModifiedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // }, - // Properties: &armappcomplianceautomation.ReportProperties{ - // CertRecords: []*armappcomplianceautomation.CertSyncRecord{ - // { - // CertificationStatus: to.Ptr("CertIngestion"), - // Controls: []*armappcomplianceautomation.ControlSyncRecord{ - // { - // ControlID: to.Ptr("Operational_Security_10"), - // ControlStatus: to.Ptr("Approved"), - // }}, - // IngestionStatus: to.Ptr("EvidenceResubmitted"), - // OfferGUID: to.Ptr("00000000-0000-0000-0000-000000000001"), - // }}, - // ComplianceStatus: &armappcomplianceautomation.ReportComplianceStatus{ - // M365: &armappcomplianceautomation.OverviewStatus{ - // FailedCount: to.Ptr[int32](0), - // ManualCount: to.Ptr[int32](0), - // NotApplicableCount: to.Ptr[int32](0), - // PassedCount: to.Ptr[int32](0), - // PendingCount: to.Ptr[int32](0), - // }, - // }, - // Errors: []*string{ - // }, - // LastTriggerTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-02T05:00:00.000Z"); return t}()), - // NextTriggerTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-02T05:00:00.000Z"); return t}()), - // OfferGUID: to.Ptr("00000000-0000-0000-0000-000000000001,00000000-0000-0000-0000-000000000002"), - // ProvisioningState: to.Ptr(armappcomplianceautomation.ProvisioningStateSucceeded), - // Resources: []*armappcomplianceautomation.ResourceMetadata{ - // { - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService"), - // ResourceOrigin: to.Ptr(armappcomplianceautomation.ResourceOriginAzure), - // ResourceType: to.Ptr("Microsoft.SignalRService/SignalR"), - // }, - // { - // AccountID: to.Ptr("000000000000"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/acat-aws/providers/microsoft.security/securityconnectors/acatawsconnector/securityentitydata/aws-iam-user-testuser"), - // ResourceOrigin: to.Ptr(armappcomplianceautomation.ResourceOriginAWS), - // ResourceType: to.Ptr("iam.user"), - // }}, - // Status: to.Ptr(armappcomplianceautomation.ReportStatusActive), - // StorageInfo: &armappcomplianceautomation.StorageInfo{ - // AccountName: to.Ptr("testStorageAccount"), - // Location: to.Ptr("East US"), - // ResourceGroup: to.Ptr("testResourceGroup"), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // Subscriptions: []*string{ - // to.Ptr("00000000-0000-0000-0000-000000000000")}, - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TimeZone: to.Ptr("GMT Standard Time"), - // TriggerTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-02T05:00:00.000Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Report_Get.json -func ExampleReportClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewReportClient().Get(ctx, "testReport", 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.ReportResource = armappcomplianceautomation.ReportResource{ - // Name: to.Ptr("testReportName"), - // Type: to.Ptr("Microsfot.AppComplianceAutomation/reports"), - // ID: to.Ptr("/provider/Microsfot.AppComplianceAutomation/reports/testReportName"), - // SystemData: &armappcomplianceautomation.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // CreatedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // CreatedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // LastModifiedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // LastModifiedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // }, - // Properties: &armappcomplianceautomation.ReportProperties{ - // CertRecords: []*armappcomplianceautomation.CertSyncRecord{ - // { - // CertificationStatus: to.Ptr("CertIngestion"), - // Controls: []*armappcomplianceautomation.ControlSyncRecord{ - // { - // ControlID: to.Ptr("Operational_Security_10"), - // ControlStatus: to.Ptr("Approved"), - // }}, - // IngestionStatus: to.Ptr("EvidenceResubmitted"), - // OfferGUID: to.Ptr("00000000-0000-0000-0000-000000000001"), - // }}, - // ComplianceStatus: &armappcomplianceautomation.ReportComplianceStatus{ - // M365: &armappcomplianceautomation.OverviewStatus{ - // FailedCount: to.Ptr[int32](0), - // ManualCount: to.Ptr[int32](0), - // PassedCount: to.Ptr[int32](0), - // }, - // }, - // Errors: []*string{ - // to.Ptr("resource-inaccessible")}, - // LastTriggerTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-02T05:00:00.000Z"); return t}()), - // NextTriggerTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-02T05:00:00.000Z"); return t}()), - // OfferGUID: to.Ptr("00000000-0000-0000-0000-000000000001,00000000-0000-0000-0000-000000000002"), - // ProvisioningState: to.Ptr(armappcomplianceautomation.ProvisioningStateSucceeded), - // Resources: []*armappcomplianceautomation.ResourceMetadata{ - // { - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService"), - // ResourceOrigin: to.Ptr(armappcomplianceautomation.ResourceOriginAzure), - // ResourceType: to.Ptr("Microsoft.SignalRService/SignalR"), - // }, - // { - // AccountID: to.Ptr("000000000000"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/acat-aws/providers/microsoft.security/securityconnectors/acatawsconnector/securityentitydata/aws-iam-user-testuser"), - // ResourceOrigin: to.Ptr(armappcomplianceautomation.ResourceOriginAWS), - // ResourceType: to.Ptr("iam.user"), - // }}, - // Status: to.Ptr(armappcomplianceautomation.ReportStatusFailed), - // StorageInfo: &armappcomplianceautomation.StorageInfo{ - // AccountName: to.Ptr("testStorageAccount"), - // Location: to.Ptr("East US"), - // ResourceGroup: to.Ptr("testResourceGroup"), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // Subscriptions: []*string{ - // to.Ptr("00000000-0000-0000-0000-000000000000")}, - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TimeZone: to.Ptr("GMT Standard Time"), - // TriggerTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-02T05:00:00.000Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Report_CreateOrUpdate.json -func ExampleReportClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewReportClient().BeginCreateOrUpdate(ctx, "testReportName", armappcomplianceautomation.ReportResource{}, 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.ReportResource = armappcomplianceautomation.ReportResource{ - // Name: to.Ptr("testReportName"), - // Type: to.Ptr("Microsfot.AppComplianceAutomation/reports"), - // ID: to.Ptr("/provider/Microsfot.AppComplianceAutomation/reports/testReportName"), - // SystemData: &armappcomplianceautomation.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // CreatedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // CreatedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // LastModifiedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // LastModifiedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // }, - // Properties: &armappcomplianceautomation.ReportProperties{ - // CertRecords: []*armappcomplianceautomation.CertSyncRecord{ - // { - // CertificationStatus: to.Ptr("CertIngestion"), - // Controls: []*armappcomplianceautomation.ControlSyncRecord{ - // { - // ControlID: to.Ptr("Operational_Security_10"), - // ControlStatus: to.Ptr("Approved"), - // }}, - // IngestionStatus: to.Ptr("EvidenceResubmitted"), - // OfferGUID: to.Ptr("00000000-0000-0000-0000-000000000001"), - // }}, - // ComplianceStatus: &armappcomplianceautomation.ReportComplianceStatus{ - // M365: &armappcomplianceautomation.OverviewStatus{ - // FailedCount: to.Ptr[int32](0), - // ManualCount: to.Ptr[int32](0), - // PassedCount: to.Ptr[int32](0), - // }, - // }, - // LastTriggerTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-02T05:00:00.000Z"); return t}()), - // NextTriggerTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-02T05:00:00.000Z"); return t}()), - // OfferGUID: to.Ptr("00000000-0000-0000-0000-000000000001,00000000-0000-0000-0000-000000000002"), - // ProvisioningState: to.Ptr(armappcomplianceautomation.ProvisioningStateSucceeded), - // Resources: []*armappcomplianceautomation.ResourceMetadata{ - // { - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService"), - // ResourceOrigin: to.Ptr(armappcomplianceautomation.ResourceOriginAzure), - // ResourceType: to.Ptr("Microsoft.SignalRService/SignalR"), - // }, - // { - // AccountID: to.Ptr("000000000000"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/acat-aws/providers/microsoft.security/securityconnectors/acatawsconnector/securityentitydata/aws-iam-user-testuser"), - // ResourceOrigin: to.Ptr(armappcomplianceautomation.ResourceOriginAWS), - // ResourceType: to.Ptr("iam.user"), - // }}, - // Status: to.Ptr(armappcomplianceautomation.ReportStatusActive), - // StorageInfo: &armappcomplianceautomation.StorageInfo{ - // AccountName: to.Ptr("testStorageAccount"), - // Location: to.Ptr("East US"), - // ResourceGroup: to.Ptr("testResourceGroup"), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // Subscriptions: []*string{ - // to.Ptr("00000000-0000-0000-0000-000000000000")}, - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TimeZone: to.Ptr("GMT Standard Time"), - // TriggerTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-02T05:00:00.000Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Report_Update.json -func ExampleReportClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewReportClient().BeginUpdate(ctx, "testReportName", armappcomplianceautomation.ReportResourcePatch{}, 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.ReportResource = armappcomplianceautomation.ReportResource{ - // Name: to.Ptr("testReportName"), - // Type: to.Ptr("Microsfot.AppComplianceAutomation/reports"), - // ID: to.Ptr("/provider/Microsfot.AppComplianceAutomation/reports/testReportName"), - // SystemData: &armappcomplianceautomation.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // CreatedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // CreatedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // LastModifiedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // LastModifiedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // }, - // Properties: &armappcomplianceautomation.ReportProperties{ - // CertRecords: []*armappcomplianceautomation.CertSyncRecord{ - // { - // CertificationStatus: to.Ptr("CertIngestion"), - // Controls: []*armappcomplianceautomation.ControlSyncRecord{ - // { - // ControlID: to.Ptr("Operational_Security_10"), - // ControlStatus: to.Ptr("Approved"), - // }}, - // IngestionStatus: to.Ptr("EvidenceResubmitted"), - // OfferGUID: to.Ptr("00000000-0000-0000-0000-000000000001"), - // }}, - // ComplianceStatus: &armappcomplianceautomation.ReportComplianceStatus{ - // M365: &armappcomplianceautomation.OverviewStatus{ - // FailedCount: to.Ptr[int32](0), - // ManualCount: to.Ptr[int32](0), - // PassedCount: to.Ptr[int32](0), - // }, - // }, - // LastTriggerTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-02T05:00:00.000Z"); return t}()), - // NextTriggerTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-02T05:00:00.000Z"); return t}()), - // OfferGUID: to.Ptr("00000000-0000-0000-0000-000000000001,00000000-0000-0000-0000-000000000002"), - // ProvisioningState: to.Ptr(armappcomplianceautomation.ProvisioningStateSucceeded), - // Resources: []*armappcomplianceautomation.ResourceMetadata{ - // { - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService"), - // ResourceOrigin: to.Ptr(armappcomplianceautomation.ResourceOriginAzure), - // ResourceType: to.Ptr("Microsoft.SignalRService/SignalR"), - // }, - // { - // AccountID: to.Ptr("000000000000"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/acat-aws/providers/microsoft.security/securityconnectors/acatawsconnector/securityentitydata/aws-iam-user-testuser"), - // ResourceOrigin: to.Ptr(armappcomplianceautomation.ResourceOriginAWS), - // ResourceType: to.Ptr("iam.user"), - // }}, - // Status: to.Ptr(armappcomplianceautomation.ReportStatusActive), - // StorageInfo: &armappcomplianceautomation.StorageInfo{ - // AccountName: to.Ptr("testStorageAccount"), - // Location: to.Ptr("East US"), - // ResourceGroup: to.Ptr("testResourceGroup"), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // Subscriptions: []*string{ - // to.Ptr("00000000-0000-0000-0000-000000000000")}, - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TimeZone: to.Ptr("GMT Standard Time"), - // TriggerTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-02T05:00:00.000Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Report_Delete.json -func ExampleReportClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewReportClient().BeginDelete(ctx, "testReportName", 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/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Report_NestedResourceCheckNameAvailability_Report_Evidence_Check_Name_Availability.json -func ExampleReportClient_NestedResourceCheckNameAvailability_reportEvidenceCheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewReportClient().NestedResourceCheckNameAvailability(ctx, "reportABC", armappcomplianceautomation.CheckNameAvailabilityRequest{}, 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.CheckNameAvailabilityResponse = armappcomplianceautomation.CheckNameAvailabilityResponse{ - // Message: to.Ptr("An evidence named 'evidenceABC' is already in use."), - // NameAvailable: to.Ptr(false), - // Reason: to.Ptr(armappcomplianceautomation.CheckNameAvailabilityReasonAlreadyExists), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Report_NestedResourceCheckNameAvailability_Report_Snapshot_Check_Name_Availability.json -func ExampleReportClient_NestedResourceCheckNameAvailability_reportSnapshotCheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewReportClient().NestedResourceCheckNameAvailability(ctx, "reportABC", armappcomplianceautomation.CheckNameAvailabilityRequest{}, 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.CheckNameAvailabilityResponse = armappcomplianceautomation.CheckNameAvailabilityResponse{ - // Message: to.Ptr("An snapshot named 'snapshotABC' is already in use."), - // NameAvailable: to.Ptr(false), - // Reason: to.Ptr(armappcomplianceautomation.CheckNameAvailabilityReasonAlreadyExists), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Report_NestedResourceCheckNameAvailability_Report_Webhook_Check_Name_Availability.json -func ExampleReportClient_NestedResourceCheckNameAvailability_reportWebhookCheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewReportClient().NestedResourceCheckNameAvailability(ctx, "reportABC", armappcomplianceautomation.CheckNameAvailabilityRequest{}, 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.CheckNameAvailabilityResponse = armappcomplianceautomation.CheckNameAvailabilityResponse{ - // Message: to.Ptr("An webhook named 'webhookABC' is already in use."), - // NameAvailable: to.Ptr(false), - // Reason: to.Ptr(armappcomplianceautomation.CheckNameAvailabilityReasonAlreadyExists), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Report_Fix.json -func ExampleReportClient_BeginFix() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewReportClient().BeginFix(ctx, "testReport", 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.ReportFixResult = armappcomplianceautomation.ReportFixResult{ - // Reason: to.Ptr(""), - // Result: to.Ptr(armappcomplianceautomation.ResultSucceeded), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Report_GetScopingQuestions.json -func ExampleReportClient_GetScopingQuestions() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewReportClient().GetScopingQuestions(ctx, "testReportName", 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.ScopingQuestions = armappcomplianceautomation.ScopingQuestions{ - // Questions: []*armappcomplianceautomation.ScopingQuestion{ - // { - // InputType: to.Ptr(armappcomplianceautomation.InputTypeBoolean), - // OptionIDs: []*string{ - // }, - // QuestionID: to.Ptr("DHP_G07_customerDataProcess"), - // Rules: []*armappcomplianceautomation.Rule{ - // to.Ptr(armappcomplianceautomation.RuleRequired)}, - // ShowSubQuestionsValue: to.Ptr("true"), - // }, - // { - // InputType: to.Ptr(armappcomplianceautomation.InputTypeText), - // OptionIDs: []*string{ - // }, - // QuestionID: to.Ptr("DHP_G04_graphPermissionData"), - // Rules: []*armappcomplianceautomation.Rule{ - // to.Ptr(armappcomplianceautomation.RuleRequired), - // to.Ptr(armappcomplianceautomation.RuleCharLength)}, - // SuperiorQuestionID: to.Ptr("DHP_G07_customerDataProcess"), - // }, - // { - // InputType: to.Ptr(armappcomplianceautomation.InputTypeBoolean), - // OptionIDs: []*string{ - // }, - // QuestionID: to.Ptr("DHP_G06_customerDataStorage"), - // Rules: []*armappcomplianceautomation.Rule{ - // to.Ptr(armappcomplianceautomation.RuleRequired)}, - // ShowSubQuestionsValue: to.Ptr("true"), - // }, - // { - // InputType: to.Ptr(armappcomplianceautomation.InputTypeText), - // OptionIDs: []*string{ - // }, - // QuestionID: to.Ptr("DHP_G05_graphPermissionInfo"), - // Rules: []*armappcomplianceautomation.Rule{ - // to.Ptr(armappcomplianceautomation.RuleRequired), - // to.Ptr(armappcomplianceautomation.RuleCharLength), - // to.Ptr(armappcomplianceautomation.RulePreventNonEnglishChar)}, - // SuperiorQuestionID: to.Ptr("DHP_G06_customerDataStorage"), - // }, - // { - // InputType: to.Ptr(armappcomplianceautomation.InputTypeMultiSelectDropdown), - // OptionIDs: []*string{ - // to.Ptr("Croatia"), - // to.Ptr("Cuba"), - // to.Ptr("Curaçao"), - // to.Ptr("Cyprus"), - // to.Ptr("Czechia"), - // to.Ptr("Côte d'Ivoire"), - // to.Ptr("Denmark"), - // to.Ptr("Djibouti"), - // to.Ptr("Dominica"), - // to.Ptr("Dominican Republic (the)"), - // to.Ptr("Ecuador"), - // to.Ptr("Egypt")}, - // QuestionID: to.Ptr("DHP_G08_storageLocation"), - // Rules: []*armappcomplianceautomation.Rule{ - // to.Ptr(armappcomplianceautomation.RuleRequired)}, - // SuperiorQuestionID: to.Ptr("DHP_G06_customerDataStorage"), - // }, - // { - // InputType: to.Ptr(armappcomplianceautomation.InputType("SingleSelectEnum")), - // OptionIDs: []*string{ - // }, - // QuestionID: to.Ptr("LEG03_complianceDataTermination"), - // Rules: []*armappcomplianceautomation.Rule{ - // to.Ptr(armappcomplianceautomation.RuleRequired)}, - // SuperiorQuestionID: to.Ptr("DHP_G06_customerDataStorage"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Report_SyncCertRecord.json -func ExampleReportClient_BeginSyncCertRecord() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewReportClient().BeginSyncCertRecord(ctx, "testReportName", armappcomplianceautomation.SyncCertRecordRequest{}, 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.SyncCertRecordResponse = armappcomplianceautomation.SyncCertRecordResponse{ - // CertRecord: &armappcomplianceautomation.CertSyncRecord{ - // CertificationStatus: to.Ptr("CertIngestion"), - // Controls: []*armappcomplianceautomation.ControlSyncRecord{ - // }, - // IngestionStatus: to.Ptr("InitialDocumentResubmitted"), - // OfferGUID: to.Ptr("addb13fc-64bf-4005-b693-4c2f094e2187"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Report_Verify.json -func ExampleReportClient_BeginVerify() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewReportClient().BeginVerify(ctx, "testReport", 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.ReportVerificationResult = armappcomplianceautomation.ReportVerificationResult{ - // Reason: to.Ptr(""), - // Result: to.Ptr(armappcomplianceautomation.ResultSucceeded), - // } -} diff --git a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/responses.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/responses.go index 2400d7beb9d3..95a4428d6d19 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/responses.go +++ b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/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. diff --git a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/scopingconfiguration_client.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/scopingconfiguration_client.go index 4d795ce7a504..51eecc91b8a8 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/scopingconfiguration_client.go +++ b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/scopingconfiguration_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. @@ -73,7 +70,7 @@ func (client *ScopingConfigurationClient) CreateOrUpdate(ctx context.Context, re } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ScopingConfigurationClient) createOrUpdateCreateRequest(ctx context.Context, reportName string, scopingConfigurationName string, properties ScopingConfigurationResource, options *ScopingConfigurationClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ScopingConfigurationClient) createOrUpdateCreateRequest(ctx context.Context, reportName string, scopingConfigurationName string, properties ScopingConfigurationResource, _ *ScopingConfigurationClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/scopingConfigurations/{scopingConfigurationName}" if reportName == "" { return nil, errors.New("parameter reportName cannot be empty") @@ -136,7 +133,7 @@ func (client *ScopingConfigurationClient) Delete(ctx context.Context, reportName } // deleteCreateRequest creates the Delete request. -func (client *ScopingConfigurationClient) deleteCreateRequest(ctx context.Context, reportName string, scopingConfigurationName string, options *ScopingConfigurationClientDeleteOptions) (*policy.Request, error) { +func (client *ScopingConfigurationClient) deleteCreateRequest(ctx context.Context, reportName string, scopingConfigurationName string, _ *ScopingConfigurationClientDeleteOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/scopingConfigurations/{scopingConfigurationName}" if reportName == "" { return nil, errors.New("parameter reportName cannot be empty") @@ -188,7 +185,7 @@ func (client *ScopingConfigurationClient) Get(ctx context.Context, reportName st } // getCreateRequest creates the Get request. -func (client *ScopingConfigurationClient) getCreateRequest(ctx context.Context, reportName string, scopingConfigurationName string, options *ScopingConfigurationClientGetOptions) (*policy.Request, error) { +func (client *ScopingConfigurationClient) getCreateRequest(ctx context.Context, reportName string, scopingConfigurationName string, _ *ScopingConfigurationClientGetOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/scopingConfigurations/{scopingConfigurationName}" if reportName == "" { return nil, errors.New("parameter reportName cannot be empty") @@ -248,7 +245,7 @@ func (client *ScopingConfigurationClient) NewListPager(reportName string, option } // listCreateRequest creates the List request. -func (client *ScopingConfigurationClient) listCreateRequest(ctx context.Context, reportName string, options *ScopingConfigurationClientListOptions) (*policy.Request, error) { +func (client *ScopingConfigurationClient) listCreateRequest(ctx context.Context, reportName string, _ *ScopingConfigurationClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/scopingConfigurations" if reportName == "" { return nil, errors.New("parameter reportName cannot be empty") diff --git a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/scopingconfiguration_client_example_test.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/scopingconfiguration_client_example_test.go deleted file mode 100644 index d1776617c95f..000000000000 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/scopingconfiguration_client_example_test.go +++ /dev/null @@ -1,196 +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 armappcomplianceautomation_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/ScopingConfiguration_List.json -func ExampleScopingConfigurationClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewScopingConfigurationClient().NewListPager("testReportName", 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.ScopingConfigurationResourceListResult = armappcomplianceautomation.ScopingConfigurationResourceListResult{ - // Value: []*armappcomplianceautomation.ScopingConfigurationResource{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.AppComplianceAutomation/reports/scopingConfigurations"), - // ID: to.Ptr("/provider/Microsfot.AppComplianceAutomation/reports/testReportName/scopingConfigurations/default"), - // SystemData: &armappcomplianceautomation.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // CreatedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // CreatedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // LastModifiedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // LastModifiedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // }, - // Properties: &armappcomplianceautomation.ScopingConfigurationProperties{ - // Answers: []*armappcomplianceautomation.ScopingAnswer{ - // { - // Answers: []*string{ - // to.Ptr("Azure")}, - // QuestionID: to.Ptr("GEN20_hostingEnvironment"), - // }, - // { - // Answers: []*string{ - // }, - // QuestionID: to.Ptr("DHP_G07_customerDataProcess"), - // }, - // { - // Answers: []*string{ - // }, - // QuestionID: to.Ptr("Tier2InitSub_serviceCommunicate"), - // }}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/ScopingConfiguration_Get.json -func ExampleScopingConfigurationClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScopingConfigurationClient().Get(ctx, "testReportName", "default", 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.ScopingConfigurationResource = armappcomplianceautomation.ScopingConfigurationResource{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.AppComplianceAutomation/reports/scopingConfigurations"), - // ID: to.Ptr("/provider/Microsfot.AppComplianceAutomation/reports/testReportName/scopingConfigurations/default"), - // SystemData: &armappcomplianceautomation.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // CreatedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // CreatedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // LastModifiedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // LastModifiedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // }, - // Properties: &armappcomplianceautomation.ScopingConfigurationProperties{ - // Answers: []*armappcomplianceautomation.ScopingAnswer{ - // { - // Answers: []*string{ - // to.Ptr("Azure")}, - // QuestionID: to.Ptr("GEN20_hostingEnvironment"), - // }, - // { - // Answers: []*string{ - // }, - // QuestionID: to.Ptr("DHP_G07_customerDataProcess"), - // }, - // { - // Answers: []*string{ - // }, - // QuestionID: to.Ptr("Tier2InitSub_serviceCommunicate"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/ScopingConfiguration_CreateOrUpdate.json -func ExampleScopingConfigurationClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScopingConfigurationClient().CreateOrUpdate(ctx, "testReportName", "default", armappcomplianceautomation.ScopingConfigurationResource{}, 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.ScopingConfigurationResource = armappcomplianceautomation.ScopingConfigurationResource{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.AppComplianceAutomation/reports/scopingConfigurations"), - // ID: to.Ptr("/provider/Microsfot.AppComplianceAutomation/reports/testReportName/scopingConfigurations/default"), - // SystemData: &armappcomplianceautomation.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // CreatedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // CreatedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // LastModifiedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // LastModifiedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // }, - // Properties: &armappcomplianceautomation.ScopingConfigurationProperties{ - // Answers: []*armappcomplianceautomation.ScopingAnswer{ - // { - // Answers: []*string{ - // to.Ptr("Azure")}, - // QuestionID: to.Ptr("GEN20_hostingEnvironment"), - // }, - // { - // Answers: []*string{ - // }, - // QuestionID: to.Ptr("DHP_G07_customerDataProcess"), - // }, - // { - // Answers: []*string{ - // }, - // QuestionID: to.Ptr("Tier2InitSub_serviceCommunicate"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/ScopingConfiguration_Delete.json -func ExampleScopingConfigurationClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewScopingConfigurationClient().Delete(ctx, "testReportName", "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/snapshot_client.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/snapshot_client.go index d4bd1a0a8ebd..6a26502b8c29 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/snapshot_client.go +++ b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/snapshot_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. @@ -93,7 +90,7 @@ func (client *SnapshotClient) download(ctx context.Context, reportName string, s } // downloadCreateRequest creates the Download request. -func (client *SnapshotClient) downloadCreateRequest(ctx context.Context, reportName string, snapshotName string, body SnapshotDownloadRequest, options *SnapshotClientBeginDownloadOptions) (*policy.Request, error) { +func (client *SnapshotClient) downloadCreateRequest(ctx context.Context, reportName string, snapshotName string, body SnapshotDownloadRequest, _ *SnapshotClientBeginDownloadOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/snapshots/{snapshotName}/download" if reportName == "" { return nil, errors.New("parameter reportName cannot be empty") @@ -147,7 +144,7 @@ func (client *SnapshotClient) Get(ctx context.Context, reportName string, snapsh } // getCreateRequest creates the Get request. -func (client *SnapshotClient) getCreateRequest(ctx context.Context, reportName string, snapshotName string, options *SnapshotClientGetOptions) (*policy.Request, error) { +func (client *SnapshotClient) getCreateRequest(ctx context.Context, reportName string, snapshotName string, _ *SnapshotClientGetOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/snapshots/{snapshotName}" if reportName == "" { return nil, errors.New("parameter reportName cannot be empty") diff --git a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/snapshot_client_example_test.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/snapshot_client_example_test.go deleted file mode 100644 index 59f00b07c210..000000000000 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/snapshot_client_example_test.go +++ /dev/null @@ -1,520 +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 armappcomplianceautomation_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/appcomplianceautomation/armappcomplianceautomation" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Snapshot_List.json -func ExampleSnapshotClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSnapshotClient().NewListPager("testReportName", &armappcomplianceautomation.SnapshotClientListOptions{SkipToken: to.Ptr("1"), - Top: to.Ptr[int32](100), - Select: nil, - Filter: nil, - Orderby: nil, - OfferGUID: to.Ptr("00000000-0000-0000-0000-000000000001"), - ReportCreatorTenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - }) - 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.SnapshotResourceListResult = armappcomplianceautomation.SnapshotResourceListResult{ - // Value: []*armappcomplianceautomation.SnapshotResource{ - // { - // Name: to.Ptr("testSnapshot"), - // Type: to.Ptr("Microsfot.AppComplianceAutomation/reports/snapshots"), - // ID: to.Ptr("/provider/Microsfot.AppComplianceAutomation/reports/testReportName/snapshots/testSnapshot"), - // SystemData: &armappcomplianceautomation.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // CreatedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // CreatedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // LastModifiedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // LastModifiedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // }, - // Properties: &armappcomplianceautomation.SnapshotProperties{ - // ComplianceResults: []*armappcomplianceautomation.ComplianceResult{ - // { - // Categories: []*armappcomplianceautomation.Category{ - // { - // CategoryName: to.Ptr("Operational Security"), - // CategoryStatus: to.Ptr(armappcomplianceautomation.CategoryStatusPassed), - // ControlFamilies: []*armappcomplianceautomation.ControlFamily{ - // { - // ControlFamilyName: to.Ptr("Incident Response"), - // ControlFamilyStatus: to.Ptr(armappcomplianceautomation.ControlFamilyStatusPassed), - // Controls: []*armappcomplianceautomation.Control{ - // { - // ControlDescription: to.Ptr("Provide demonstrable evidence that all member of the incident response team have completed annual training or a table top exercise"), - // ControlDescriptionHyperLink: to.Ptr("https://aka.ms/acat/m365cert/operational/control73"), - // ControlFullName: to.Ptr("Provide demonstrable evidence that all member of the incident response team have completed annual training or a table top exercise"), - // ControlID: to.Ptr("Operational_Security_75"), - // ControlName: to.Ptr("Provide demonstrable evidence that all member of the incident response team have completed annual training or a table top exercise"), - // ControlStatus: to.Ptr(armappcomplianceautomation.ControlStatusPassed), - // Responsibilities: []*armappcomplianceautomation.Responsibility{ - // { - // EvidenceFiles: []*string{ - // to.Ptr("https://management.azure.com/providers/Microsoft.AppComplianceAutomation/reports/reportABC/fileName?api-version=2024-06-27")}, - // FailedResourceCount: to.Ptr[int32](0), - // Guidance: to.Ptr("Please upload the screen capture file to ACAT service."), - // Justification: to.Ptr("Here is my evidence files"), - // RecommendationList: []*armappcomplianceautomation.Recommendation{ - // { - // RecommendationID: to.Ptr("failed_reason_1"), - // RecommendationShortName: to.Ptr("Invalid TLS Config"), - // RecommendationSolutions: []*armappcomplianceautomation.RecommendationSolution{ - // { - // IsRecommendSolution: to.Ptr(armappcomplianceautomation.IsRecommendSolutionTrue), - // RecommendationSolutionContent: to.Ptr("Setting minimal TLS version to 1.2 improves security by ensuring your SQL Managed Instance can only be accessed from clients using TLS 1.2. Using versions of TLS less than 1.2 is not recommended since they have well documented security vulnerabilities"), - // RecommendationSolutionIndex: to.Ptr("1"), - // }}, - // }, - // { - // RecommendationID: to.Ptr("failed_reason_2"), - // RecommendationShortName: to.Ptr("Invalid AWS TLS Config"), - // RecommendationSolutions: []*armappcomplianceautomation.RecommendationSolution{ - // { - // IsRecommendSolution: to.Ptr(armappcomplianceautomation.IsRecommendSolutionTrue), - // RecommendationSolutionContent: to.Ptr("Open the AWS related service, and set its TLS version to 1.2 or higher version."), - // RecommendationSolutionIndex: to.Ptr("1"), - // }}, - // }}, - // ResourceList: []*armappcomplianceautomation.ResponsibilityResource{ - // { - // RecommendationIDs: []*string{ - // to.Ptr("failed_reason_1")}, - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService"), - // ResourceOrigin: to.Ptr(armappcomplianceautomation.ResourceOriginAzure), - // ResourceStatus: to.Ptr(armappcomplianceautomation.ResourceStatusUnhealthy), - // ResourceStatusChangeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-12T16:17:20.150Z"); return t}()), - // ResourceType: to.Ptr("Microsoft.SignalRService/SignalR"), - // }, - // { - // AccountID: to.Ptr("000000000000"), - // RecommendationIDs: []*string{ - // to.Ptr("failed_reason_2")}, - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/acat-aws/providers/microsoft.security/securityconnectors/acatawsconnector/securityentitydata/aws-iam-user-testuser"), - // ResourceOrigin: to.Ptr(armappcomplianceautomation.ResourceOriginAWS), - // ResourceStatus: to.Ptr(armappcomplianceautomation.ResourceStatusUnhealthy), - // ResourceStatusChangeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-12T16:17:20.150Z"); return t}()), - // ResourceType: to.Ptr("iam.user"), - // }}, - // ResponsibilityDescription: to.Ptr("Restrict access to the Kubernetes Service Management API by granting API access only to IP addresses in specific ranges. It is recommended to limit access to authorized IP ranges to ensure that only applications from allowed networks can access the cluster."), - // ResponsibilityEnvironment: to.Ptr(armappcomplianceautomation.ResponsibilityEnvironmentAzure), - // ResponsibilityID: to.Ptr("authorized_ip_ranges_should_be_defined_on_kubernetes_services"), - // ResponsibilitySeverity: to.Ptr(armappcomplianceautomation.ResponsibilitySeverityHigh), - // ResponsibilityStatus: to.Ptr(armappcomplianceautomation.ResponsibilityStatusPassed), - // ResponsibilityTitle: to.Ptr("Authorized IP ranges should be defined on Kubernetes Services"), - // ResponsibilityType: to.Ptr(armappcomplianceautomation.ResponsibilityTypeAutomated), - // TotalResourceCount: to.Ptr[int32](1), - // }}, - // }}, - // }}, - // }}, - // ComplianceName: to.Ptr("M365"), - // }}, - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T15:33:59.160Z"); return t}()), - // ProvisioningState: to.Ptr(armappcomplianceautomation.ProvisioningStateSucceeded), - // ReportProperties: &armappcomplianceautomation.ReportProperties{ - // CertRecords: []*armappcomplianceautomation.CertSyncRecord{ - // { - // CertificationStatus: to.Ptr("CertIngestion"), - // Controls: []*armappcomplianceautomation.ControlSyncRecord{ - // { - // ControlID: to.Ptr("Operational_Security_10"), - // ControlStatus: to.Ptr("Approved"), - // }}, - // IngestionStatus: to.Ptr("EvidenceResubmitted"), - // OfferGUID: to.Ptr("00000000-0000-0000-0000-000000000001"), - // }}, - // ComplianceStatus: &armappcomplianceautomation.ReportComplianceStatus{ - // M365: &armappcomplianceautomation.OverviewStatus{ - // FailedCount: to.Ptr[int32](0), - // ManualCount: to.Ptr[int32](0), - // NotApplicableCount: to.Ptr[int32](0), - // PassedCount: to.Ptr[int32](0), - // PendingCount: to.Ptr[int32](0), - // }, - // }, - // Errors: []*string{ - // }, - // LastTriggerTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T15:00:00.000Z"); return t}()), - // NextTriggerTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T15:00:00.000Z"); return t}()), - // OfferGUID: to.Ptr("00000000-0000-0000-0000-000000000001,00000000-0000-0000-0000-000000000002"), - // ProvisioningState: to.Ptr(armappcomplianceautomation.ProvisioningStateSucceeded), - // Resources: []*armappcomplianceautomation.ResourceMetadata{ - // { - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService"), - // ResourceOrigin: to.Ptr(armappcomplianceautomation.ResourceOriginAzure), - // ResourceType: to.Ptr("Microsoft.SignalRService/SignalR"), - // }, - // { - // AccountID: to.Ptr("000000000000"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/acat-aws/providers/microsoft.security/securityconnectors/acatawsconnector/securityentitydata/aws-iam-user-testuser"), - // ResourceOrigin: to.Ptr(armappcomplianceautomation.ResourceOriginAWS), - // ResourceType: to.Ptr("iam.user"), - // }}, - // Status: to.Ptr(armappcomplianceautomation.ReportStatusActive), - // StorageInfo: &armappcomplianceautomation.StorageInfo{ - // AccountName: to.Ptr("testStorageAccount"), - // Location: to.Ptr("East US"), - // ResourceGroup: to.Ptr("testResourceGroup"), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // Subscriptions: []*string{ - // to.Ptr("00000000-0000-0000-0000-000000000000")}, - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TimeZone: to.Ptr("GMT Standard Time"), - // TriggerTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T15:00:00.000Z"); return t}()), - // }, - // ReportSystemData: &armappcomplianceautomation.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // CreatedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // CreatedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // LastModifiedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // LastModifiedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // }, - // SnapshotName: to.Ptr("testSnapshot"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Snapshot_Get.json -func ExampleSnapshotClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSnapshotClient().Get(ctx, "testReportName", "testSnapshot", 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.SnapshotResource = armappcomplianceautomation.SnapshotResource{ - // Name: to.Ptr("testSnapshot"), - // Type: to.Ptr("Microsfot.AppComplianceAutomation/reports/snapshots"), - // ID: to.Ptr("/provider/Microsfot.AppComplianceAutomation/reports/testReportName/snapshots/testSnapshot"), - // SystemData: &armappcomplianceautomation.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // CreatedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // CreatedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // LastModifiedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // LastModifiedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // }, - // Properties: &armappcomplianceautomation.SnapshotProperties{ - // ComplianceResults: []*armappcomplianceautomation.ComplianceResult{ - // { - // Categories: []*armappcomplianceautomation.Category{ - // { - // CategoryName: to.Ptr("Operational Security"), - // CategoryStatus: to.Ptr(armappcomplianceautomation.CategoryStatusPassed), - // ControlFamilies: []*armappcomplianceautomation.ControlFamily{ - // { - // ControlFamilyName: to.Ptr("Incident Response"), - // ControlFamilyStatus: to.Ptr(armappcomplianceautomation.ControlFamilyStatusPassed), - // Controls: []*armappcomplianceautomation.Control{ - // { - // ControlDescription: to.Ptr("Provide demonstrable evidence that all member of the incident response team have completed annual training or a table top exercise"), - // ControlDescriptionHyperLink: to.Ptr("https://aka.ms/acat/m365cert/operational/control73"), - // ControlFullName: to.Ptr("Provide demonstrable evidence that all member of the incident response team have completed annual training or a table top exercise"), - // ControlID: to.Ptr("Operational_Security_75"), - // ControlName: to.Ptr("Provide demonstrable evidence that all member of the incident response team have completed annual training or a table top exercise"), - // ControlStatus: to.Ptr(armappcomplianceautomation.ControlStatusPassed), - // Responsibilities: []*armappcomplianceautomation.Responsibility{ - // { - // EvidenceFiles: []*string{ - // to.Ptr("https://management.azure.com/providers/Microsoft.AppComplianceAutomation/reports/reportABC/fileName?api-version=2024-06-27")}, - // FailedResourceCount: to.Ptr[int32](0), - // Guidance: to.Ptr("Please upload the screen capture file to ACAT service."), - // Justification: to.Ptr("Here is my evidence files"), - // RecommendationList: []*armappcomplianceautomation.Recommendation{ - // { - // RecommendationID: to.Ptr("failed_reason_1"), - // RecommendationShortName: to.Ptr("Invalid TLS Config"), - // RecommendationSolutions: []*armappcomplianceautomation.RecommendationSolution{ - // { - // IsRecommendSolution: to.Ptr(armappcomplianceautomation.IsRecommendSolutionTrue), - // RecommendationSolutionContent: to.Ptr("Setting minimal TLS version to 1.2 improves security by ensuring your SQL Managed Instance can only be accessed from clients using TLS 1.2. Using versions of TLS less than 1.2 is not recommended since they have well documented security vulnerabilities"), - // RecommendationSolutionIndex: to.Ptr("1"), - // }}, - // }, - // { - // RecommendationID: to.Ptr("failed_reason_2"), - // RecommendationShortName: to.Ptr("Invalid AWS TLS Config"), - // RecommendationSolutions: []*armappcomplianceautomation.RecommendationSolution{ - // { - // IsRecommendSolution: to.Ptr(armappcomplianceautomation.IsRecommendSolutionTrue), - // RecommendationSolutionContent: to.Ptr("Open the AWS related service, and set its TLS version to 1.2 or higher version."), - // RecommendationSolutionIndex: to.Ptr("1"), - // }}, - // }}, - // ResourceList: []*armappcomplianceautomation.ResponsibilityResource{ - // { - // RecommendationIDs: []*string{ - // to.Ptr("failed_reason_1")}, - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService"), - // ResourceOrigin: to.Ptr(armappcomplianceautomation.ResourceOriginAzure), - // ResourceStatus: to.Ptr(armappcomplianceautomation.ResourceStatusUnhealthy), - // ResourceStatusChangeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-12T16:17:20.150Z"); return t}()), - // ResourceType: to.Ptr("Microsoft.SignalRService/SignalR"), - // }, - // { - // AccountID: to.Ptr("000000000000"), - // RecommendationIDs: []*string{ - // to.Ptr("failed_reason_2")}, - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/acat-aws/providers/microsoft.security/securityconnectors/acatawsconnector/securityentitydata/aws-iam-user-testuser"), - // ResourceOrigin: to.Ptr(armappcomplianceautomation.ResourceOriginAWS), - // ResourceStatus: to.Ptr(armappcomplianceautomation.ResourceStatusUnhealthy), - // ResourceStatusChangeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-12T16:17:20.150Z"); return t}()), - // ResourceType: to.Ptr("iam.user"), - // }}, - // ResponsibilityDescription: to.Ptr("Restrict access to the Kubernetes Service Management API by granting API access only to IP addresses in specific ranges. It is recommended to limit access to authorized IP ranges to ensure that only applications from allowed networks can access the cluster."), - // ResponsibilityEnvironment: to.Ptr(armappcomplianceautomation.ResponsibilityEnvironmentAzure), - // ResponsibilityID: to.Ptr("authorized_ip_ranges_should_be_defined_on_kubernetes_services"), - // ResponsibilitySeverity: to.Ptr(armappcomplianceautomation.ResponsibilitySeverityHigh), - // ResponsibilityStatus: to.Ptr(armappcomplianceautomation.ResponsibilityStatusPassed), - // ResponsibilityTitle: to.Ptr("Authorized IP ranges should be defined on Kubernetes Services"), - // ResponsibilityType: to.Ptr(armappcomplianceautomation.ResponsibilityTypeAutomated), - // TotalResourceCount: to.Ptr[int32](1), - // }}, - // }}, - // }}, - // }}, - // ComplianceName: to.Ptr("M365"), - // }}, - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T15:33:59.160Z"); return t}()), - // ProvisioningState: to.Ptr(armappcomplianceautomation.ProvisioningStateSucceeded), - // ReportProperties: &armappcomplianceautomation.ReportProperties{ - // CertRecords: []*armappcomplianceautomation.CertSyncRecord{ - // { - // CertificationStatus: to.Ptr("CertIngestion"), - // Controls: []*armappcomplianceautomation.ControlSyncRecord{ - // { - // ControlID: to.Ptr("Operational_Security_10"), - // ControlStatus: to.Ptr("Approved"), - // }}, - // IngestionStatus: to.Ptr("EvidenceResubmitted"), - // OfferGUID: to.Ptr("00000000-0000-0000-0000-000000000001"), - // }}, - // ComplianceStatus: &armappcomplianceautomation.ReportComplianceStatus{ - // M365: &armappcomplianceautomation.OverviewStatus{ - // FailedCount: to.Ptr[int32](0), - // ManualCount: to.Ptr[int32](0), - // PassedCount: to.Ptr[int32](0), - // }, - // }, - // Errors: []*string{ - // }, - // LastTriggerTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T15:00:00.000Z"); return t}()), - // NextTriggerTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T15:00:00.000Z"); return t}()), - // OfferGUID: to.Ptr("00000000-0000-0000-0000-000000000001,00000000-0000-0000-0000-000000000002"), - // ProvisioningState: to.Ptr(armappcomplianceautomation.ProvisioningStateSucceeded), - // Resources: []*armappcomplianceautomation.ResourceMetadata{ - // { - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService"), - // ResourceOrigin: to.Ptr(armappcomplianceautomation.ResourceOriginAzure), - // ResourceType: to.Ptr("Microsoft.SignalRService/SignalR"), - // }, - // { - // AccountID: to.Ptr("000000000000"), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/acat-aws/providers/microsoft.security/securityconnectors/acatawsconnector/securityentitydata/aws-iam-user-testuser"), - // ResourceOrigin: to.Ptr(armappcomplianceautomation.ResourceOriginAWS), - // ResourceType: to.Ptr("iam.user"), - // }}, - // Status: to.Ptr(armappcomplianceautomation.ReportStatusActive), - // StorageInfo: &armappcomplianceautomation.StorageInfo{ - // AccountName: to.Ptr("testStorageAccount"), - // Location: to.Ptr("East US"), - // ResourceGroup: to.Ptr("testResourceGroup"), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }, - // Subscriptions: []*string{ - // to.Ptr("00000000-0000-0000-0000-000000000000")}, - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // TimeZone: to.Ptr("GMT Standard Time"), - // TriggerTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-04T15:00:00.000Z"); return t}()), - // }, - // ReportSystemData: &armappcomplianceautomation.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // CreatedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // CreatedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // LastModifiedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // LastModifiedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // }, - // SnapshotName: to.Ptr("testSnapshot"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Snapshot_Download_Snapshot_Download_Compliance_Detailed_Pdf_Report.json -func ExampleSnapshotClient_BeginDownload_snapshotDownloadComplianceDetailedPdfReport() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotClient().BeginDownload(ctx, "testReportName", "testSnapshotName", armappcomplianceautomation.SnapshotDownloadRequest{}, 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.DownloadResponse = armappcomplianceautomation.DownloadResponse{ - // ComplianceDetailedPDFReport: &armappcomplianceautomation.DownloadResponseComplianceDetailedPDFReport{ - // SasURI: to.Ptr("this is a uri"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Snapshot_Download_Snapshot_Download_Compliance_Pdf_Report.json -func ExampleSnapshotClient_BeginDownload_snapshotDownloadCompliancePdfReport() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotClient().BeginDownload(ctx, "testReportName", "testSnapshotName", armappcomplianceautomation.SnapshotDownloadRequest{}, 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.DownloadResponse = armappcomplianceautomation.DownloadResponse{ - // CompliancePDFReport: &armappcomplianceautomation.DownloadResponseCompliancePDFReport{ - // SasURI: to.Ptr("this is uri of report"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Snapshot_Download_Snapshot_Download_Compliance_Report.json -func ExampleSnapshotClient_BeginDownload_snapshotDownloadComplianceReport() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotClient().BeginDownload(ctx, "testReportName", "testSnapshotName", armappcomplianceautomation.SnapshotDownloadRequest{}, 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.DownloadResponse = armappcomplianceautomation.DownloadResponse{ - // ComplianceReport: []*armappcomplianceautomation.ComplianceReportItem{ - // { - // CategoryName: to.Ptr("Data Security & Privacy"), - // ControlFamilyName: to.Ptr("Incident Response"), - // ControlID: to.Ptr("Operational_Security_75"), - // ControlName: to.Ptr("Provide demonstrable evidence that all member of the incident response team have completed annual training or a table top exercise"), - // ControlStatus: to.Ptr(armappcomplianceautomation.ControlStatusPassed), - // ResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/Microsoft.SignalRService/SignalR/mySignalRService"), - // ResourceOrigin: to.Ptr(armappcomplianceautomation.ResourceOriginAzure), - // ResourceStatus: to.Ptr(armappcomplianceautomation.ResourceStatusHealthy), - // ResourceStatusChangeDate: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-01-12T16:17:20.150Z"); return t}()), - // ResourceType: to.Ptr("Microsoft.SignalRService/SignalR"), - // ResponsibilityDescription: to.Ptr("Restrict access to the Kubernetes Service Management API by granting API access only to IP addresses in specific ranges. It is recommended to limit access to authorized IP ranges to ensure that only applications from allowed networks can access the cluster."), - // ResponsibilityTitle: to.Ptr("Authorized IP ranges should be defined on Kubernetes Services"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Snapshot_Download_Snapshot_Download_Resource_List.json -func ExampleSnapshotClient_BeginDownload_snapshotDownloadResourceList() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewSnapshotClient().BeginDownload(ctx, "testReportName", "testSnapshotName", armappcomplianceautomation.SnapshotDownloadRequest{}, 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.DownloadResponse = armappcomplianceautomation.DownloadResponse{ - // ResourceList: []*armappcomplianceautomation.ResourceItem{ - // { - // ResourceGroup: to.Ptr("myResourceGroup"), - // ResourceID: to.Ptr("mySignalRService"), - // ResourceType: to.Ptr("SignalR"), - // SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // }}, - // } -} diff --git a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/time_rfc3339.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/time_rfc3339.go index 78c8149b8e4f..d02a999003ce 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/time_rfc3339.go +++ b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/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. @@ -60,6 +57,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string diff --git a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/webhook_client.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/webhook_client.go index 823d2170677f..f9f966e499cf 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/webhook_client.go +++ b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/webhook_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. @@ -72,7 +69,7 @@ func (client *WebhookClient) CreateOrUpdate(ctx context.Context, reportName stri } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *WebhookClient) createOrUpdateCreateRequest(ctx context.Context, reportName string, webhookName string, properties WebhookResource, options *WebhookClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *WebhookClient) createOrUpdateCreateRequest(ctx context.Context, reportName string, webhookName string, properties WebhookResource, _ *WebhookClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/webhooks/{webhookName}" if reportName == "" { return nil, errors.New("parameter reportName cannot be empty") @@ -134,7 +131,7 @@ func (client *WebhookClient) Delete(ctx context.Context, reportName string, webh } // deleteCreateRequest creates the Delete request. -func (client *WebhookClient) deleteCreateRequest(ctx context.Context, reportName string, webhookName string, options *WebhookClientDeleteOptions) (*policy.Request, error) { +func (client *WebhookClient) deleteCreateRequest(ctx context.Context, reportName string, webhookName string, _ *WebhookClientDeleteOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/webhooks/{webhookName}" if reportName == "" { return nil, errors.New("parameter reportName cannot be empty") @@ -185,7 +182,7 @@ func (client *WebhookClient) Get(ctx context.Context, reportName string, webhook } // getCreateRequest creates the Get request. -func (client *WebhookClient) getCreateRequest(ctx context.Context, reportName string, webhookName string, options *WebhookClientGetOptions) (*policy.Request, error) { +func (client *WebhookClient) getCreateRequest(ctx context.Context, reportName string, webhookName string, _ *WebhookClientGetOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/webhooks/{webhookName}" if reportName == "" { return nil, errors.New("parameter reportName cannot be empty") @@ -322,7 +319,7 @@ func (client *WebhookClient) Update(ctx context.Context, reportName string, webh } // updateCreateRequest creates the Update request. -func (client *WebhookClient) updateCreateRequest(ctx context.Context, reportName string, webhookName string, properties WebhookResourcePatch, options *WebhookClientUpdateOptions) (*policy.Request, error) { +func (client *WebhookClient) updateCreateRequest(ctx context.Context, reportName string, webhookName string, properties WebhookResourcePatch, _ *WebhookClientUpdateOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.AppComplianceAutomation/reports/{reportName}/webhooks/{webhookName}" if reportName == "" { return nil, errors.New("parameter reportName cannot be empty") diff --git a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/webhook_client_example_test.go b/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/webhook_client_example_test.go deleted file mode 100644 index 5583577e6dad..000000000000 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/webhook_client_example_test.go +++ /dev/null @@ -1,239 +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 armappcomplianceautomation_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/appcomplianceautomation/armappcomplianceautomation" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Webhook_List.json -func ExampleWebhookClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWebhookClient().NewListPager("testReportName", &armappcomplianceautomation.WebhookClientListOptions{SkipToken: to.Ptr("1"), - Top: to.Ptr[int32](100), - Select: nil, - Filter: nil, - Orderby: nil, - OfferGUID: nil, - ReportCreatorTenantID: 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.WebhookResourceListResult = armappcomplianceautomation.WebhookResourceListResult{ - // Value: []*armappcomplianceautomation.WebhookResource{ - // { - // Name: to.Ptr("testWebhookName"), - // Type: to.Ptr("Microsfot.AppComplianceAutomation/reports/webhooks"), - // ID: to.Ptr("/provider/Microsfot.AppComplianceAutomation/reports/testReportName/snapshots/testWebhookName"), - // SystemData: &armappcomplianceautomation.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // CreatedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // CreatedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // LastModifiedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // LastModifiedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // }, - // Properties: &armappcomplianceautomation.WebhookProperties{ - // ContentType: to.Ptr(armappcomplianceautomation.ContentTypeApplicationJSON), - // DeliveryStatus: to.Ptr(armappcomplianceautomation.DeliveryStatusSucceeded), - // EnableSSLVerification: to.Ptr(armappcomplianceautomation.EnableSSLVerificationTrue), - // Events: []*armappcomplianceautomation.NotificationEvent{ - // to.Ptr(armappcomplianceautomation.NotificationEventGenerateSnapshotFailed)}, - // PayloadURL: to.Ptr("https://example.com"), - // ProvisioningState: to.Ptr(armappcomplianceautomation.ProvisioningStateSucceeded), - // SendAllEvents: to.Ptr(armappcomplianceautomation.SendAllEventsFalse), - // Status: to.Ptr(armappcomplianceautomation.WebhookStatusEnabled), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // WebhookID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // WebhookKeyEnabled: to.Ptr(armappcomplianceautomation.WebhookKeyEnabledFalse), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Webhook_Get.json -func ExampleWebhookClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWebhookClient().Get(ctx, "testReportName", "testWebhookName", 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.WebhookResource = armappcomplianceautomation.WebhookResource{ - // Name: to.Ptr("testWebhookName"), - // Type: to.Ptr("Microsfot.AppComplianceAutomation/reports/webhooks"), - // ID: to.Ptr("/provider/Microsfot.AppComplianceAutomation/reports/testReportName/webhooks/testWebhookName"), - // SystemData: &armappcomplianceautomation.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // CreatedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // CreatedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // LastModifiedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // LastModifiedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // }, - // Properties: &armappcomplianceautomation.WebhookProperties{ - // ContentType: to.Ptr(armappcomplianceautomation.ContentTypeApplicationJSON), - // DeliveryStatus: to.Ptr(armappcomplianceautomation.DeliveryStatusSucceeded), - // EnableSSLVerification: to.Ptr(armappcomplianceautomation.EnableSSLVerificationTrue), - // Events: []*armappcomplianceautomation.NotificationEvent{ - // to.Ptr(armappcomplianceautomation.NotificationEventGenerateSnapshotFailed)}, - // PayloadURL: to.Ptr("https://example.com"), - // ProvisioningState: to.Ptr(armappcomplianceautomation.ProvisioningStateSucceeded), - // SendAllEvents: to.Ptr(armappcomplianceautomation.SendAllEventsFalse), - // Status: to.Ptr(armappcomplianceautomation.WebhookStatusEnabled), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // WebhookID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // WebhookKeyEnabled: to.Ptr(armappcomplianceautomation.WebhookKeyEnabledTrue), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Webhook_CreateOrUpdate.json -func ExampleWebhookClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWebhookClient().CreateOrUpdate(ctx, "testReportName", "testWebhookName", armappcomplianceautomation.WebhookResource{}, 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.WebhookResource = armappcomplianceautomation.WebhookResource{ - // Name: to.Ptr("testWebhookName"), - // Type: to.Ptr("Microsfot.AppComplianceAutomation/reports/webhooks"), - // ID: to.Ptr("/provider/Microsfot.AppComplianceAutomation/reports/testReportName/webhooks/testWebhookName"), - // SystemData: &armappcomplianceautomation.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // CreatedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // CreatedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // LastModifiedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // LastModifiedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // }, - // Properties: &armappcomplianceautomation.WebhookProperties{ - // ContentType: to.Ptr(armappcomplianceautomation.ContentTypeApplicationJSON), - // DeliveryStatus: to.Ptr(armappcomplianceautomation.DeliveryStatusSucceeded), - // EnableSSLVerification: to.Ptr(armappcomplianceautomation.EnableSSLVerificationTrue), - // Events: []*armappcomplianceautomation.NotificationEvent{ - // to.Ptr(armappcomplianceautomation.NotificationEventGenerateSnapshotFailed)}, - // PayloadURL: to.Ptr("https://example.com"), - // ProvisioningState: to.Ptr(armappcomplianceautomation.ProvisioningStateSucceeded), - // SendAllEvents: to.Ptr(armappcomplianceautomation.SendAllEventsFalse), - // Status: to.Ptr(armappcomplianceautomation.WebhookStatusEnabled), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // WebhookID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // WebhookKeyEnabled: to.Ptr(armappcomplianceautomation.WebhookKeyEnabledTrue), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Webhook_Update.json -func ExampleWebhookClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWebhookClient().Update(ctx, "testReportName", "testWebhookName", armappcomplianceautomation.WebhookResourcePatch{}, 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.WebhookResource = armappcomplianceautomation.WebhookResource{ - // Name: to.Ptr("testWebhookName"), - // Type: to.Ptr("Microsfot.AppComplianceAutomation/reports/webhooks"), - // ID: to.Ptr("/provider/Microsfot.AppComplianceAutomation/reports/testReportName/testWebhookName"), - // SystemData: &armappcomplianceautomation.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // CreatedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // CreatedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-14T22:34:55.449Z"); return t}()), - // LastModifiedBy: to.Ptr("00000000-0000-0000-0000-000000000000"), - // LastModifiedByType: to.Ptr(armappcomplianceautomation.CreatedByTypeUser), - // }, - // Properties: &armappcomplianceautomation.WebhookProperties{ - // ContentType: to.Ptr(armappcomplianceautomation.ContentTypeApplicationJSON), - // DeliveryStatus: to.Ptr(armappcomplianceautomation.DeliveryStatusSucceeded), - // EnableSSLVerification: to.Ptr(armappcomplianceautomation.EnableSSLVerificationTrue), - // Events: []*armappcomplianceautomation.NotificationEvent{ - // to.Ptr(armappcomplianceautomation.NotificationEventGenerateSnapshotFailed)}, - // PayloadURL: to.Ptr("https://example.com"), - // ProvisioningState: to.Ptr(armappcomplianceautomation.ProvisioningStateSucceeded), - // SendAllEvents: to.Ptr(armappcomplianceautomation.SendAllEventsFalse), - // Status: to.Ptr(armappcomplianceautomation.WebhookStatusEnabled), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // WebhookID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // WebhookKeyEnabled: to.Ptr(armappcomplianceautomation.WebhookKeyEnabledTrue), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d88c94b22a8efdd47c0cadfe6d8d489107db2b23/specification/appcomplianceautomation/resource-manager/Microsoft.AppComplianceAutomation/stable/2024-06-27/examples/Webhook_Delete.json -func ExampleWebhookClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armappcomplianceautomation.NewClientFactory(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewWebhookClient().Delete(ctx, "testReportName", "testWebhookName", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/astro/armastro/CHANGELOG.md b/sdk/resourcemanager/astro/armastro/CHANGELOG.md index d9f9a7af8745..a74abdf20343 100644 --- a/sdk/resourcemanager/astro/armastro/CHANGELOG.md +++ b/sdk/resourcemanager/astro/armastro/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 1.0.0 (2025-04-27) +### Features Added + +- New enum type `RenewalMode` with values `RenewalModeAuto`, `RenewalModeManual` +- New struct `LiftrBaseMarketplaceDetailsUpdate` +- New struct `LiftrBaseOfferDetailsUpdate` +- New field `EndDate`, `RenewalMode` in struct `LiftrBaseOfferDetails` +- New field `Marketplace` in struct `OrganizationResourceUpdateProperties` + + ## 0.1.0 (2024-02-23) ### Other Changes diff --git a/sdk/resourcemanager/astro/armastro/autorest.md b/sdk/resourcemanager/astro/armastro/autorest.md index 55c64253bafb..2c928a3ff765 100644 --- a/sdk/resourcemanager/astro/armastro/autorest.md +++ b/sdk/resourcemanager/astro/armastro/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/liftrastronomer/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/liftrastronomer/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/liftrastronomer/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/liftrastronomer/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 -tag: package-2023-08-01 +module-version: 1.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/astro/armastro/client_factory.go b/sdk/resourcemanager/astro/armastro/client_factory.go index 2c22a25578cf..f3b7ce3ae446 100644 --- a/sdk/resourcemanager/astro/armastro/client_factory.go +++ b/sdk/resourcemanager/astro/armastro/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. diff --git a/sdk/resourcemanager/astro/armastro/constants.go b/sdk/resourcemanager/astro/armastro/constants.go index f2c943d2a871..abd0bd1ba173 100644 --- a/sdk/resourcemanager/astro/armastro/constants.go +++ b/sdk/resourcemanager/astro/armastro/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 armastro const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/astro/armastro" - moduleVersion = "v0.1.0" + moduleVersion = "v1.0.0" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -111,6 +108,24 @@ func PossibleOriginValues() []Origin { } } +// RenewalMode - Subscription renewal mode +type RenewalMode string + +const ( + // RenewalModeAuto - Automatic renewal + RenewalModeAuto RenewalMode = "Auto" + // RenewalModeManual - Manual renewal + RenewalModeManual RenewalMode = "Manual" +) + +// PossibleRenewalModeValues returns the possible values for the RenewalMode const type. +func PossibleRenewalModeValues() []RenewalMode { + return []RenewalMode{ + RenewalModeAuto, + RenewalModeManual, + } +} + // ResourceProvisioningState - The provisioning state of a resource type. type ResourceProvisioningState string diff --git a/sdk/resourcemanager/astro/armastro/fake/internal.go b/sdk/resourcemanager/astro/armastro/fake/internal.go index 5f75802a569e..4b65adc76adb 100644 --- a/sdk/resourcemanager/astro/armastro/fake/internal.go +++ b/sdk/resourcemanager/astro/armastro/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/astro/armastro/fake/operations_server.go b/sdk/resourcemanager/astro/armastro/fake/operations_server.go index d12290234484..67cc9591bf61 100644 --- a/sdk/resourcemanager/astro/armastro/fake/operations_server.go +++ b/sdk/resourcemanager/astro/armastro/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. @@ -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/astro/armastro/fake/organizations_server.go b/sdk/resourcemanager/astro/armastro/fake/organizations_server.go index 03044e05e5d6..118b309cf800 100644 --- a/sdk/resourcemanager/astro/armastro/fake/organizations_server.go +++ b/sdk/resourcemanager/astro/armastro/fake/organizations_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. @@ -29,7 +26,7 @@ type OrganizationsServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, organizationName string, resource armastro.OrganizationResource, options *armastro.OrganizationsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armastro.OrganizationsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method OrganizationsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, organizationName string, options *armastro.OrganizationsClientBeginDeleteOptions) (resp azfake.PollerResponder[armastro.OrganizationsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method OrganizationsClient.Get @@ -82,31 +79,50 @@ func (o *OrganizationsServerTransport) Do(req *http.Request) (*http.Response, er 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 "OrganizationsClient.BeginCreateOrUpdate": - resp, err = o.dispatchBeginCreateOrUpdate(req) - case "OrganizationsClient.BeginDelete": - resp, err = o.dispatchBeginDelete(req) - case "OrganizationsClient.Get": - resp, err = o.dispatchGet(req) - case "OrganizationsClient.NewListByResourceGroupPager": - resp, err = o.dispatchNewListByResourceGroupPager(req) - case "OrganizationsClient.NewListBySubscriptionPager": - resp, err = o.dispatchNewListBySubscriptionPager(req) - case "OrganizationsClient.BeginUpdate": - resp, err = o.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (o *OrganizationsServerTransport) 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 organizationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = organizationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OrganizationsClient.BeginCreateOrUpdate": + res.resp, res.err = o.dispatchBeginCreateOrUpdate(req) + case "OrganizationsClient.BeginDelete": + res.resp, res.err = o.dispatchBeginDelete(req) + case "OrganizationsClient.Get": + res.resp, res.err = o.dispatchGet(req) + case "OrganizationsClient.NewListByResourceGroupPager": + res.resp, res.err = o.dispatchNewListByResourceGroupPager(req) + case "OrganizationsClient.NewListBySubscriptionPager": + res.resp, res.err = o.dispatchNewListBySubscriptionPager(req) + case "OrganizationsClient.BeginUpdate": + res.resp, res.err = o.dispatchBeginUpdate(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 *OrganizationsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -190,9 +206,9 @@ func (o *OrganizationsServerTransport) dispatchBeginDelete(req *http.Request) (* return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { o.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { o.beginDelete.remove(req) @@ -351,3 +367,9 @@ func (o *OrganizationsServerTransport) dispatchBeginUpdate(req *http.Request) (* return resp, nil } + +// set this to conditionally intercept incoming requests to OrganizationsServerTransport +var organizationsServerTransportInterceptor 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/astro/armastro/fake/server_factory.go b/sdk/resourcemanager/astro/armastro/fake/server_factory.go index d0e58b889c9a..672b8cc9dcdc 100644 --- a/sdk/resourcemanager/astro/armastro/fake/server_factory.go +++ b/sdk/resourcemanager/astro/armastro/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,7 +16,10 @@ import ( // ServerFactory is a fake server for instances of the armastro.ClientFactory type. type ServerFactory struct { - OperationsServer OperationsServer + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // OrganizationsServer contains the fakes for client OrganizationsClient OrganizationsServer OrganizationsServer } diff --git a/sdk/resourcemanager/astro/armastro/go.mod b/sdk/resourcemanager/astro/armastro/go.mod index ac5508d53312..24b29680f35e 100644 --- a/sdk/resourcemanager/astro/armastro/go.mod +++ b/sdk/resourcemanager/astro/armastro/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/astro/armastro 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 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.2 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.36.0 // indirect golang.org/x/net v0.38.0 // indirect - golang.org/x/sys v0.31.0 // indirect golang.org/x/text v0.23.0 // indirect ) diff --git a/sdk/resourcemanager/astro/armastro/go.sum b/sdk/resourcemanager/astro/armastro/go.sum index 4bacf756f06c..4de695d9e23a 100644 --- a/sdk/resourcemanager/astro/armastro/go.sum +++ b/sdk/resourcemanager/astro/armastro/go.sum @@ -1,44 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 h1:DSDNVxqkoXJiko6x8a90zidoYqnYYa6c1MTzDKzKkTo= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1/go.mod h1:zGqV2R4Cr/k8Uye5w+dgQ06WJtEcbQG/8J7BB6hnCr4= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 h1:F0gBpfdPLGsw+nsgk6aqqkZS1jiixa5WwFe3fk/T3Ys= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2/go.mod h1:SqINnQ9lVVdRlyC8cd1lCI0SdX4n2paeABd2K8ggfnE= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2 h1:yz1bePFlP5Vws5+8ez6T3HWXPmwOK7Yvq8QxDBD3SKY= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2/go.mod h1:Pa9ZNPuoNu/GztvBSKk9J1cDJW6vk/n0zLtV4mgd8N8= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= -github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 h1:oygO0locgZJe7PpYPXT5A29ZkwJaPqcva7BVeemZOZs= -github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= -github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= -github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8= -github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6 h1:IsMZxCuZqKuao2vNdfD82fjjgPLfyHLpR41Z88viRWs= -github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6/go.mod h1:3VeWNIJaW+O5xpRQbPp0Ybqu1vJd/pm7s2F473HRrkw= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E= -github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= -golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= -golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/astro/armastro/models.go b/sdk/resourcemanager/astro/armastro/models.go index 518f9e88cdf2..0ac12e6e7375 100644 --- a/sdk/resourcemanager/astro/armastro/models.go +++ b/sdk/resourcemanager/astro/armastro/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. @@ -66,7 +63,19 @@ type LiftrBaseMarketplaceDetails struct { // REQUIRED; Offer details for the marketplace that is selected by the user OfferDetails *LiftrBaseOfferDetails - // REQUIRED; Azure subscription id for the the marketplace offer is purchased from + // Azure subscription id for the the marketplace offer is purchased from + SubscriptionID *string + + // Marketplace subscription status + SubscriptionStatus *MarketplaceSubscriptionStatus +} + +// LiftrBaseMarketplaceDetailsUpdate - Marketplace details for an organization +type LiftrBaseMarketplaceDetailsUpdate struct { + // Offer details for the marketplace that is selected by the user + OfferDetails *LiftrBaseOfferDetailsUpdate + + // Azure subscription id for the the marketplace offer is purchased from SubscriptionID *string // Marketplace subscription status @@ -87,6 +96,36 @@ type LiftrBaseOfferDetails struct { // Plan Name for the marketplace offer PlanName *string + // Subscription renewal mode + RenewalMode *RenewalMode + + // Plan Display Name for the marketplace offer + TermID *string + + // Plan Display Name for the marketplace offer + TermUnit *string + + // READ-ONLY; Current subscription end date and time + EndDate *time.Time +} + +// LiftrBaseOfferDetailsUpdate - Offer details for the marketplace that is selected by the user +type LiftrBaseOfferDetailsUpdate struct { + // Offer Id for the marketplace offer + OfferID *string + + // Plan Id for the marketplace offer + PlanID *string + + // Plan Name for the marketplace offer + PlanName *string + + // Publisher Id for the marketplace offer + PublisherID *string + + // Subscription renewal mode + RenewalMode *RenewalMode + // Plan Display Name for the marketplace offer TermID *string @@ -258,7 +297,7 @@ type OrganizationResourceUpdate struct { // The managed service identities assigned to this resource. Identity *ManagedServiceIdentity - // The updatable properties of the OrganizationResource. + // The resource-specific properties for this resource. Properties *OrganizationResourceUpdateProperties // Resource tags. @@ -267,6 +306,9 @@ type OrganizationResourceUpdate struct { // OrganizationResourceUpdateProperties - The updatable properties of the OrganizationResource. type OrganizationResourceUpdateProperties struct { + // Marketplace details of the resource. + Marketplace *LiftrBaseMarketplaceDetailsUpdate + // Organization properties PartnerOrganizationProperties *LiftrBaseDataPartnerOrganizationPropertiesUpdate diff --git a/sdk/resourcemanager/astro/armastro/models_serde.go b/sdk/resourcemanager/astro/armastro/models_serde.go index 82bfe9d9b2ee..83be318e4c3d 100644 --- a/sdk/resourcemanager/astro/armastro/models_serde.go +++ b/sdk/resourcemanager/astro/armastro/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. @@ -175,13 +172,50 @@ func (l *LiftrBaseMarketplaceDetails) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type LiftrBaseMarketplaceDetailsUpdate. +func (l LiftrBaseMarketplaceDetailsUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "offerDetails", l.OfferDetails) + populate(objectMap, "subscriptionId", l.SubscriptionID) + populate(objectMap, "subscriptionStatus", l.SubscriptionStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LiftrBaseMarketplaceDetailsUpdate. +func (l *LiftrBaseMarketplaceDetailsUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "offerDetails": + err = unpopulate(val, "OfferDetails", &l.OfferDetails) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &l.SubscriptionID) + delete(rawMsg, key) + case "subscriptionStatus": + err = unpopulate(val, "SubscriptionStatus", &l.SubscriptionStatus) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type LiftrBaseOfferDetails. func (l LiftrBaseOfferDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "endDate", l.EndDate) populate(objectMap, "offerId", l.OfferID) populate(objectMap, "planId", l.PlanID) populate(objectMap, "planName", l.PlanName) populate(objectMap, "publisherId", l.PublisherID) + populate(objectMap, "renewalMode", l.RenewalMode) populate(objectMap, "termId", l.TermID) populate(objectMap, "termUnit", l.TermUnit) return json.Marshal(objectMap) @@ -189,6 +223,60 @@ func (l LiftrBaseOfferDetails) MarshalJSON() ([]byte, error) { // UnmarshalJSON implements the json.Unmarshaller interface for type LiftrBaseOfferDetails. func (l *LiftrBaseOfferDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endDate": + err = unpopulateDateTimeRFC3339(val, "EndDate", &l.EndDate) + delete(rawMsg, key) + case "offerId": + err = unpopulate(val, "OfferID", &l.OfferID) + delete(rawMsg, key) + case "planId": + err = unpopulate(val, "PlanID", &l.PlanID) + delete(rawMsg, key) + case "planName": + err = unpopulate(val, "PlanName", &l.PlanName) + delete(rawMsg, key) + case "publisherId": + err = unpopulate(val, "PublisherID", &l.PublisherID) + delete(rawMsg, key) + case "renewalMode": + err = unpopulate(val, "RenewalMode", &l.RenewalMode) + delete(rawMsg, key) + case "termId": + err = unpopulate(val, "TermID", &l.TermID) + delete(rawMsg, key) + case "termUnit": + err = unpopulate(val, "TermUnit", &l.TermUnit) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LiftrBaseOfferDetailsUpdate. +func (l LiftrBaseOfferDetailsUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "offerId", l.OfferID) + populate(objectMap, "planId", l.PlanID) + populate(objectMap, "planName", l.PlanName) + populate(objectMap, "publisherId", l.PublisherID) + populate(objectMap, "renewalMode", l.RenewalMode) + populate(objectMap, "termId", l.TermID) + populate(objectMap, "termUnit", l.TermUnit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LiftrBaseOfferDetailsUpdate. +func (l *LiftrBaseOfferDetailsUpdate) 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) @@ -208,6 +296,9 @@ func (l *LiftrBaseOfferDetails) UnmarshalJSON(data []byte) error { case "publisherId": err = unpopulate(val, "PublisherID", &l.PublisherID) delete(rawMsg, key) + case "renewalMode": + err = unpopulate(val, "RenewalMode", &l.RenewalMode) + delete(rawMsg, key) case "termId": err = unpopulate(val, "TermID", &l.TermID) delete(rawMsg, key) @@ -627,6 +718,7 @@ func (o *OrganizationResourceUpdate) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OrganizationResourceUpdateProperties. func (o OrganizationResourceUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "marketplace", o.Marketplace) populate(objectMap, "partnerOrganizationProperties", o.PartnerOrganizationProperties) populate(objectMap, "user", o.User) return json.Marshal(objectMap) @@ -641,6 +733,9 @@ func (o *OrganizationResourceUpdateProperties) UnmarshalJSON(data []byte) error for key, val := range rawMsg { var err error switch key { + case "marketplace": + err = unpopulate(val, "Marketplace", &o.Marketplace) + delete(rawMsg, key) case "partnerOrganizationProperties": err = unpopulate(val, "PartnerOrganizationProperties", &o.PartnerOrganizationProperties) delete(rawMsg, key) diff --git a/sdk/resourcemanager/astro/armastro/operations_client.go b/sdk/resourcemanager/astro/armastro/operations_client.go index 35affd6bfcc5..584417d511c5 100644 --- a/sdk/resourcemanager/astro/armastro/operations_client.go +++ b/sdk/resourcemanager/astro/armastro/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. @@ -39,7 +36,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - List the operations for the provider // -// Generated from API version 2023-08-01 +// Generated from API version 2024-08-27 // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -65,14 +62,14 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption } // listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Astronomer.Astro/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2024-08-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/astro/armastro/operations_client_example_test.go b/sdk/resourcemanager/astro/armastro/operations_client_example_test.go deleted file mode 100644 index a3d31f4493af..000000000000 --- a/sdk/resourcemanager/astro/armastro/operations_client_example_test.go +++ /dev/null @@ -1,58 +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 armastro_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/astro/armastro" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/liftrastronomer/resource-manager/Astronomer.Astro/stable/2023-08-01/examples/Operations_List_MaximumSet_Gen.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 := armastro.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 = armastro.OperationListResult{ - // Value: []*armastro.Operation{ - // { - // Name: to.Ptr("zabhglnki"), - // ActionType: to.Ptr(armastro.ActionTypeInternal), - // Display: &armastro.OperationDisplay{ - // Description: to.Ptr("nkucjlsbtriwdgedbxlknbwfz"), - // Operation: to.Ptr("teozafbxkiagahfypii"), - // Provider: to.Ptr("hgepwsvbptqbigephgxoxyll"), - // Resource: to.Ptr("thhzqbtxxi"), - // }, - // IsDataAction: to.Ptr(true), - // Origin: to.Ptr(armastro.OriginUser), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/astro/armastro/options.go b/sdk/resourcemanager/astro/armastro/options.go index 2f9f6d6d16b3..475ace423243 100644 --- a/sdk/resourcemanager/astro/armastro/options.go +++ b/sdk/resourcemanager/astro/armastro/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. @@ -16,19 +13,19 @@ type OperationsClientListOptions struct { // OrganizationsClientBeginCreateOrUpdateOptions contains the optional parameters for the OrganizationsClient.BeginCreateOrUpdate // method. type OrganizationsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // OrganizationsClientBeginDeleteOptions contains the optional parameters for the OrganizationsClient.BeginDelete method. type OrganizationsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // OrganizationsClientBeginUpdateOptions contains the optional parameters for the OrganizationsClient.BeginUpdate method. type OrganizationsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } diff --git a/sdk/resourcemanager/astro/armastro/organizations_client.go b/sdk/resourcemanager/astro/armastro/organizations_client.go index 1577fb06e0c6..a3cc2e9f5628 100644 --- a/sdk/resourcemanager/astro/armastro/organizations_client.go +++ b/sdk/resourcemanager/astro/armastro/organizations_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. @@ -46,7 +43,7 @@ func NewOrganizationsClient(subscriptionID string, credential azcore.TokenCreden // BeginCreateOrUpdate - Create a OrganizationResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2024-08-27 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - organizationName - Name of the Organizations resource // - resource - Resource create parameters. @@ -73,7 +70,7 @@ func (client *OrganizationsClient) BeginCreateOrUpdate(ctx context.Context, reso // CreateOrUpdate - Create a OrganizationResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2024-08-27 func (client *OrganizationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, organizationName string, resource OrganizationResource, options *OrganizationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "OrganizationsClient.BeginCreateOrUpdate" @@ -96,7 +93,7 @@ func (client *OrganizationsClient) createOrUpdate(ctx context.Context, resourceG } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *OrganizationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, resource OrganizationResource, options *OrganizationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *OrganizationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, resource OrganizationResource, _ *OrganizationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Astronomer.Astro/organizations/{organizationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -115,7 +112,7 @@ func (client *OrganizationsClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2024-08-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -127,7 +124,7 @@ func (client *OrganizationsClient) createOrUpdateCreateRequest(ctx context.Conte // BeginDelete - Delete a OrganizationResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2024-08-27 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - organizationName - Name of the Organizations resource // - options - OrganizationsClientBeginDeleteOptions contains the optional parameters for the OrganizationsClient.BeginDelete @@ -153,7 +150,7 @@ func (client *OrganizationsClient) BeginDelete(ctx context.Context, resourceGrou // Delete - Delete a OrganizationResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2024-08-27 func (client *OrganizationsClient) deleteOperation(ctx context.Context, resourceGroupName string, organizationName string, options *OrganizationsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "OrganizationsClient.BeginDelete" @@ -176,7 +173,7 @@ func (client *OrganizationsClient) deleteOperation(ctx context.Context, resource } // deleteCreateRequest creates the Delete request. -func (client *OrganizationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, options *OrganizationsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *OrganizationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, _ *OrganizationsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Astronomer.Astro/organizations/{organizationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -195,7 +192,7 @@ func (client *OrganizationsClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2024-08-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -204,7 +201,7 @@ func (client *OrganizationsClient) deleteCreateRequest(ctx context.Context, reso // Get - Get a OrganizationResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2024-08-27 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - organizationName - Name of the Organizations resource // - options - OrganizationsClientGetOptions contains the optional parameters for the OrganizationsClient.Get method. @@ -231,7 +228,7 @@ func (client *OrganizationsClient) Get(ctx context.Context, resourceGroupName st } // getCreateRequest creates the Get request. -func (client *OrganizationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, options *OrganizationsClientGetOptions) (*policy.Request, error) { +func (client *OrganizationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, _ *OrganizationsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Astronomer.Astro/organizations/{organizationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -250,7 +247,7 @@ func (client *OrganizationsClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2024-08-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -267,7 +264,7 @@ func (client *OrganizationsClient) getHandleResponse(resp *http.Response) (Organ // NewListByResourceGroupPager - List OrganizationResource resources by resource group // -// Generated from API version 2023-08-01 +// Generated from API version 2024-08-27 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - OrganizationsClientListByResourceGroupOptions contains the optional parameters for the OrganizationsClient.NewListByResourceGroupPager // method. @@ -295,7 +292,7 @@ func (client *OrganizationsClient) NewListByResourceGroupPager(resourceGroupName } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *OrganizationsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *OrganizationsClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *OrganizationsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *OrganizationsClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Astronomer.Astro/organizations" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -310,7 +307,7 @@ func (client *OrganizationsClient) listByResourceGroupCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2024-08-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -327,7 +324,7 @@ func (client *OrganizationsClient) listByResourceGroupHandleResponse(resp *http. // NewListBySubscriptionPager - List OrganizationResource resources by subscription ID // -// Generated from API version 2023-08-01 +// Generated from API version 2024-08-27 // - options - OrganizationsClientListBySubscriptionOptions contains the optional parameters for the OrganizationsClient.NewListBySubscriptionPager // method. func (client *OrganizationsClient) NewListBySubscriptionPager(options *OrganizationsClientListBySubscriptionOptions) *runtime.Pager[OrganizationsClientListBySubscriptionResponse] { @@ -354,7 +351,7 @@ func (client *OrganizationsClient) NewListBySubscriptionPager(options *Organizat } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *OrganizationsClient) listBySubscriptionCreateRequest(ctx context.Context, options *OrganizationsClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *OrganizationsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *OrganizationsClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Astronomer.Astro/organizations" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -365,7 +362,7 @@ func (client *OrganizationsClient) listBySubscriptionCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2024-08-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -383,7 +380,7 @@ func (client *OrganizationsClient) listBySubscriptionHandleResponse(resp *http.R // BeginUpdate - Update a OrganizationResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2024-08-27 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - organizationName - Name of the Organizations resource // - properties - The resource properties to be updated. @@ -410,7 +407,7 @@ func (client *OrganizationsClient) BeginUpdate(ctx context.Context, resourceGrou // Update - Update a OrganizationResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-08-01 +// Generated from API version 2024-08-27 func (client *OrganizationsClient) update(ctx context.Context, resourceGroupName string, organizationName string, properties OrganizationResourceUpdate, options *OrganizationsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "OrganizationsClient.BeginUpdate" @@ -433,7 +430,7 @@ func (client *OrganizationsClient) update(ctx context.Context, resourceGroupName } // updateCreateRequest creates the Update request. -func (client *OrganizationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, properties OrganizationResourceUpdate, options *OrganizationsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *OrganizationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, properties OrganizationResourceUpdate, _ *OrganizationsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Astronomer.Astro/organizations/{organizationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -452,7 +449,7 @@ func (client *OrganizationsClient) updateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-08-01") + reqQP.Set("api-version", "2024-08-27") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, properties); err != nil { diff --git a/sdk/resourcemanager/astro/armastro/organizations_client_example_test.go b/sdk/resourcemanager/astro/armastro/organizations_client_example_test.go deleted file mode 100644 index 68713e68d066..000000000000 --- a/sdk/resourcemanager/astro/armastro/organizations_client_example_test.go +++ /dev/null @@ -1,533 +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 armastro_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/astro/armastro" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/liftrastronomer/resource-manager/Astronomer.Astro/stable/2023-08-01/examples/Organizations_ListBySubscription_MaximumSet_Gen.json -func ExampleOrganizationsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armastro.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOrganizationsClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OrganizationResourceListResult = armastro.OrganizationResourceListResult{ - // Value: []*armastro.OrganizationResource{ - // { - // Name: to.Ptr("ycyrfvupthkudm"), - // Type: to.Ptr("ldwwclcpqssjomo"), - // ID: to.Ptr("bhslekyvgkfomahtvjiin"), - // SystemData: &armastro.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-25T11:16:12.868Z"); return t}()), - // CreatedBy: to.Ptr("zw"), - // CreatedByType: to.Ptr(armastro.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-25T11:16:12.868Z"); return t}()), - // LastModifiedBy: to.Ptr("isirkhwcppaqoqzoebybzikzbzkjzf"), - // LastModifiedByType: to.Ptr(armastro.CreatedByTypeUser), - // }, - // Location: to.Ptr("mhqthlsatwvqkl"), - // Tags: map[string]*string{ - // }, - // Identity: &armastro.ManagedServiceIdentity{ - // Type: to.Ptr(armastro.ManagedServiceIdentityTypeNone), - // PrincipalID: to.Ptr("b5684bd7-7958-4c0e-9795-d686c31746d2"), - // TenantID: to.Ptr("b5684bd7-7958-4c0e-9795-d686c31746d2"), - // UserAssignedIdentities: map[string]*armastro.UserAssignedIdentity{ - // }, - // }, - // Properties: &armastro.LiftrBaseDataOrganizationProperties{ - // Marketplace: &armastro.LiftrBaseMarketplaceDetails{ - // OfferDetails: &armastro.LiftrBaseOfferDetails{ - // OfferID: to.Ptr("krzkefmpxztqyusidzgpchfaswuyce"), - // PlanID: to.Ptr("kndxzygsanuiqzwbfbbvoipv"), - // PlanName: to.Ptr("pwqjwlq"), - // PublisherID: to.Ptr("gfsqxygpnerxmvols"), - // TermID: to.Ptr("pwds"), - // TermUnit: to.Ptr("xyygyzcazkuelz"), - // }, - // SubscriptionID: to.Ptr("ntthclydlpqmasr"), - // SubscriptionStatus: to.Ptr(armastro.MarketplaceSubscriptionStatusPendingFulfillmentStart), - // }, - // PartnerOrganizationProperties: &armastro.LiftrBaseDataPartnerOrganizationProperties{ - // OrganizationID: to.Ptr("lskgzdmziusgrsucv"), - // OrganizationName: to.Ptr("3-"), - // SingleSignOnProperties: &armastro.LiftrBaseSingleSignOnProperties{ - // AADDomains: []*string{ - // to.Ptr("kfbleh")}, - // EnterpriseAppID: to.Ptr("mklfypyujwumgwdzae"), - // ProvisioningState: to.Ptr(armastro.ResourceProvisioningStateSucceeded), - // SingleSignOnState: to.Ptr(armastro.SingleSignOnStatesInitial), - // SingleSignOnURL: to.Ptr("ymmtzkyghvinvhgnqlzwrr"), - // }, - // WorkspaceID: to.Ptr("vcrupxwpaba"), - // WorkspaceName: to.Ptr("9.:06"), - // }, - // ProvisioningState: to.Ptr(armastro.ResourceProvisioningStateSucceeded), - // User: &armastro.LiftrBaseUserDetails{ - // EmailAddress: to.Ptr(".K_@e7N-g1.xjqnbPs"), - // FirstName: to.Ptr("nfh"), - // LastName: to.Ptr("lazfbstcccykibvcrxpmglqam"), - // PhoneNumber: to.Ptr("inxkscllh"), - // Upn: to.Ptr("xtutvycpxjrtoftx"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/liftrastronomer/resource-manager/Astronomer.Astro/stable/2023-08-01/examples/Organizations_ListByResourceGroup_MaximumSet_Gen.json -func ExampleOrganizationsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armastro.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOrganizationsClient().NewListByResourceGroupPager("rgastronomer", 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.OrganizationResourceListResult = armastro.OrganizationResourceListResult{ - // Value: []*armastro.OrganizationResource{ - // { - // Name: to.Ptr("ycyrfvupthkudm"), - // Type: to.Ptr("ldwwclcpqssjomo"), - // ID: to.Ptr("bhslekyvgkfomahtvjiin"), - // SystemData: &armastro.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-25T11:16:12.868Z"); return t}()), - // CreatedBy: to.Ptr("zw"), - // CreatedByType: to.Ptr(armastro.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-25T11:16:12.868Z"); return t}()), - // LastModifiedBy: to.Ptr("isirkhwcppaqoqzoebybzikzbzkjzf"), - // LastModifiedByType: to.Ptr(armastro.CreatedByTypeUser), - // }, - // Location: to.Ptr("mhqthlsatwvqkl"), - // Tags: map[string]*string{ - // }, - // Identity: &armastro.ManagedServiceIdentity{ - // Type: to.Ptr(armastro.ManagedServiceIdentityTypeNone), - // PrincipalID: to.Ptr("b5684bd7-7958-4c0e-9795-d686c31746d2"), - // TenantID: to.Ptr("b5684bd7-7958-4c0e-9795-d686c31746d2"), - // UserAssignedIdentities: map[string]*armastro.UserAssignedIdentity{ - // }, - // }, - // Properties: &armastro.LiftrBaseDataOrganizationProperties{ - // Marketplace: &armastro.LiftrBaseMarketplaceDetails{ - // OfferDetails: &armastro.LiftrBaseOfferDetails{ - // OfferID: to.Ptr("krzkefmpxztqyusidzgpchfaswuyce"), - // PlanID: to.Ptr("kndxzygsanuiqzwbfbbvoipv"), - // PlanName: to.Ptr("pwqjwlq"), - // PublisherID: to.Ptr("gfsqxygpnerxmvols"), - // TermID: to.Ptr("pwds"), - // TermUnit: to.Ptr("xyygyzcazkuelz"), - // }, - // SubscriptionID: to.Ptr("ntthclydlpqmasr"), - // SubscriptionStatus: to.Ptr(armastro.MarketplaceSubscriptionStatusPendingFulfillmentStart), - // }, - // PartnerOrganizationProperties: &armastro.LiftrBaseDataPartnerOrganizationProperties{ - // OrganizationID: to.Ptr("lskgzdmziusgrsucv"), - // OrganizationName: to.Ptr("3-"), - // SingleSignOnProperties: &armastro.LiftrBaseSingleSignOnProperties{ - // AADDomains: []*string{ - // to.Ptr("kfbleh")}, - // EnterpriseAppID: to.Ptr("mklfypyujwumgwdzae"), - // ProvisioningState: to.Ptr(armastro.ResourceProvisioningStateSucceeded), - // SingleSignOnState: to.Ptr(armastro.SingleSignOnStatesInitial), - // SingleSignOnURL: to.Ptr("ymmtzkyghvinvhgnqlzwrr"), - // }, - // WorkspaceID: to.Ptr("vcrupxwpaba"), - // WorkspaceName: to.Ptr("9.:06"), - // }, - // ProvisioningState: to.Ptr(armastro.ResourceProvisioningStateSucceeded), - // User: &armastro.LiftrBaseUserDetails{ - // EmailAddress: to.Ptr(".K_@e7N-g1.xjqnbPs"), - // FirstName: to.Ptr("nfh"), - // LastName: to.Ptr("lazfbstcccykibvcrxpmglqam"), - // PhoneNumber: to.Ptr("inxkscllh"), - // Upn: to.Ptr("xtutvycpxjrtoftx"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/liftrastronomer/resource-manager/Astronomer.Astro/stable/2023-08-01/examples/Organizations_Get_MaximumSet_Gen.json -func ExampleOrganizationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armastro.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOrganizationsClient().Get(ctx, "rgastronomer", "S PS", 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.OrganizationResource = armastro.OrganizationResource{ - // Name: to.Ptr("ycyrfvupthkudm"), - // Type: to.Ptr("ldwwclcpqssjomo"), - // ID: to.Ptr("bhslekyvgkfomahtvjiin"), - // SystemData: &armastro.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-25T11:16:12.868Z"); return t}()), - // CreatedBy: to.Ptr("zw"), - // CreatedByType: to.Ptr(armastro.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-25T11:16:12.868Z"); return t}()), - // LastModifiedBy: to.Ptr("isirkhwcppaqoqzoebybzikzbzkjzf"), - // LastModifiedByType: to.Ptr(armastro.CreatedByTypeUser), - // }, - // Location: to.Ptr("mhqthlsatwvqkl"), - // Tags: map[string]*string{ - // }, - // Identity: &armastro.ManagedServiceIdentity{ - // Type: to.Ptr(armastro.ManagedServiceIdentityTypeNone), - // PrincipalID: to.Ptr("b5684bd7-7958-4c0e-9795-d686c31746d2"), - // TenantID: to.Ptr("b5684bd7-7958-4c0e-9795-d686c31746d2"), - // UserAssignedIdentities: map[string]*armastro.UserAssignedIdentity{ - // }, - // }, - // Properties: &armastro.LiftrBaseDataOrganizationProperties{ - // Marketplace: &armastro.LiftrBaseMarketplaceDetails{ - // OfferDetails: &armastro.LiftrBaseOfferDetails{ - // OfferID: to.Ptr("krzkefmpxztqyusidzgpchfaswuyce"), - // PlanID: to.Ptr("kndxzygsanuiqzwbfbbvoipv"), - // PlanName: to.Ptr("pwqjwlq"), - // PublisherID: to.Ptr("gfsqxygpnerxmvols"), - // TermID: to.Ptr("pwds"), - // TermUnit: to.Ptr("xyygyzcazkuelz"), - // }, - // SubscriptionID: to.Ptr("ntthclydlpqmasr"), - // SubscriptionStatus: to.Ptr(armastro.MarketplaceSubscriptionStatusPendingFulfillmentStart), - // }, - // PartnerOrganizationProperties: &armastro.LiftrBaseDataPartnerOrganizationProperties{ - // OrganizationID: to.Ptr("lskgzdmziusgrsucv"), - // OrganizationName: to.Ptr("3-"), - // SingleSignOnProperties: &armastro.LiftrBaseSingleSignOnProperties{ - // AADDomains: []*string{ - // to.Ptr("kfbleh")}, - // EnterpriseAppID: to.Ptr("mklfypyujwumgwdzae"), - // ProvisioningState: to.Ptr(armastro.ResourceProvisioningStateSucceeded), - // SingleSignOnState: to.Ptr(armastro.SingleSignOnStatesInitial), - // SingleSignOnURL: to.Ptr("ymmtzkyghvinvhgnqlzwrr"), - // }, - // WorkspaceID: to.Ptr("vcrupxwpaba"), - // WorkspaceName: to.Ptr("9.:06"), - // }, - // ProvisioningState: to.Ptr(armastro.ResourceProvisioningStateSucceeded), - // User: &armastro.LiftrBaseUserDetails{ - // EmailAddress: to.Ptr(".K_@e7N-g1.xjqnbPs"), - // FirstName: to.Ptr("nfh"), - // LastName: to.Ptr("lazfbstcccykibvcrxpmglqam"), - // PhoneNumber: to.Ptr("inxkscllh"), - // Upn: to.Ptr("xtutvycpxjrtoftx"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/liftrastronomer/resource-manager/Astronomer.Astro/stable/2023-08-01/examples/Organizations_CreateOrUpdate_MaximumSet_Gen.json -func ExampleOrganizationsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armastro.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewOrganizationsClient().BeginCreateOrUpdate(ctx, "rgastronomer", "U.1-:7", armastro.OrganizationResource{ - Location: to.Ptr("mhqthlsatwvqkl"), - Tags: map[string]*string{}, - Identity: &armastro.ManagedServiceIdentity{ - Type: to.Ptr(armastro.ManagedServiceIdentityTypeNone), - UserAssignedIdentities: map[string]*armastro.UserAssignedIdentity{}, - }, - Properties: &armastro.LiftrBaseDataOrganizationProperties{ - Marketplace: &armastro.LiftrBaseMarketplaceDetails{ - OfferDetails: &armastro.LiftrBaseOfferDetails{ - OfferID: to.Ptr("krzkefmpxztqyusidzgpchfaswuyce"), - PlanID: to.Ptr("kndxzygsanuiqzwbfbbvoipv"), - PlanName: to.Ptr("pwqjwlq"), - PublisherID: to.Ptr("gfsqxygpnerxmvols"), - TermID: to.Ptr("pwds"), - TermUnit: to.Ptr("xyygyzcazkuelz"), - }, - SubscriptionID: to.Ptr("ntthclydlpqmasr"), - SubscriptionStatus: to.Ptr(armastro.MarketplaceSubscriptionStatusPendingFulfillmentStart), - }, - PartnerOrganizationProperties: &armastro.LiftrBaseDataPartnerOrganizationProperties{ - OrganizationID: to.Ptr("lskgzdmziusgrsucv"), - OrganizationName: to.Ptr("3-"), - SingleSignOnProperties: &armastro.LiftrBaseSingleSignOnProperties{ - AADDomains: []*string{ - to.Ptr("kfbleh")}, - EnterpriseAppID: to.Ptr("mklfypyujwumgwdzae"), - ProvisioningState: to.Ptr(armastro.ResourceProvisioningStateSucceeded), - SingleSignOnState: to.Ptr(armastro.SingleSignOnStatesInitial), - SingleSignOnURL: to.Ptr("ymmtzkyghvinvhgnqlzwrr"), - }, - WorkspaceID: to.Ptr("vcrupxwpaba"), - WorkspaceName: to.Ptr("9.:06"), - }, - ProvisioningState: to.Ptr(armastro.ResourceProvisioningStateSucceeded), - User: &armastro.LiftrBaseUserDetails{ - EmailAddress: to.Ptr(".K_@e7N-g1.xjqnbPs"), - FirstName: to.Ptr("nfh"), - LastName: to.Ptr("lazfbstcccykibvcrxpmglqam"), - PhoneNumber: to.Ptr("inxkscllh"), - Upn: to.Ptr("xtutvycpxjrtoftx"), - }, - }, - }, 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.OrganizationResource = armastro.OrganizationResource{ - // Name: to.Ptr("ycyrfvupthkudm"), - // Type: to.Ptr("ldwwclcpqssjomo"), - // ID: to.Ptr("bhslekyvgkfomahtvjiin"), - // SystemData: &armastro.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-25T11:16:12.868Z"); return t}()), - // CreatedBy: to.Ptr("zw"), - // CreatedByType: to.Ptr(armastro.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-25T11:16:12.868Z"); return t}()), - // LastModifiedBy: to.Ptr("isirkhwcppaqoqzoebybzikzbzkjzf"), - // LastModifiedByType: to.Ptr(armastro.CreatedByTypeUser), - // }, - // Location: to.Ptr("mhqthlsatwvqkl"), - // Tags: map[string]*string{ - // }, - // Identity: &armastro.ManagedServiceIdentity{ - // Type: to.Ptr(armastro.ManagedServiceIdentityTypeNone), - // PrincipalID: to.Ptr("b5684bd7-7958-4c0e-9795-d686c31746d2"), - // TenantID: to.Ptr("b5684bd7-7958-4c0e-9795-d686c31746d2"), - // UserAssignedIdentities: map[string]*armastro.UserAssignedIdentity{ - // }, - // }, - // Properties: &armastro.LiftrBaseDataOrganizationProperties{ - // Marketplace: &armastro.LiftrBaseMarketplaceDetails{ - // OfferDetails: &armastro.LiftrBaseOfferDetails{ - // OfferID: to.Ptr("krzkefmpxztqyusidzgpchfaswuyce"), - // PlanID: to.Ptr("kndxzygsanuiqzwbfbbvoipv"), - // PlanName: to.Ptr("pwqjwlq"), - // PublisherID: to.Ptr("gfsqxygpnerxmvols"), - // TermID: to.Ptr("pwds"), - // TermUnit: to.Ptr("xyygyzcazkuelz"), - // }, - // SubscriptionID: to.Ptr("ntthclydlpqmasr"), - // SubscriptionStatus: to.Ptr(armastro.MarketplaceSubscriptionStatusPendingFulfillmentStart), - // }, - // PartnerOrganizationProperties: &armastro.LiftrBaseDataPartnerOrganizationProperties{ - // OrganizationID: to.Ptr("lskgzdmziusgrsucv"), - // OrganizationName: to.Ptr("3-"), - // SingleSignOnProperties: &armastro.LiftrBaseSingleSignOnProperties{ - // AADDomains: []*string{ - // to.Ptr("kfbleh")}, - // EnterpriseAppID: to.Ptr("mklfypyujwumgwdzae"), - // ProvisioningState: to.Ptr(armastro.ResourceProvisioningStateSucceeded), - // SingleSignOnState: to.Ptr(armastro.SingleSignOnStatesInitial), - // SingleSignOnURL: to.Ptr("ymmtzkyghvinvhgnqlzwrr"), - // }, - // WorkspaceID: to.Ptr("vcrupxwpaba"), - // WorkspaceName: to.Ptr("9.:06"), - // }, - // ProvisioningState: to.Ptr(armastro.ResourceProvisioningStateSucceeded), - // User: &armastro.LiftrBaseUserDetails{ - // EmailAddress: to.Ptr(".K_@e7N-g1.xjqnbPs"), - // FirstName: to.Ptr("nfh"), - // LastName: to.Ptr("lazfbstcccykibvcrxpmglqam"), - // PhoneNumber: to.Ptr("inxkscllh"), - // Upn: to.Ptr("xtutvycpxjrtoftx"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/liftrastronomer/resource-manager/Astronomer.Astro/stable/2023-08-01/examples/Organizations_Update_MaximumSet_Gen.json -func ExampleOrganizationsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armastro.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewOrganizationsClient().BeginUpdate(ctx, "rgastronomer", "6.", armastro.OrganizationResourceUpdate{ - Identity: &armastro.ManagedServiceIdentity{ - Type: to.Ptr(armastro.ManagedServiceIdentityTypeNone), - UserAssignedIdentities: map[string]*armastro.UserAssignedIdentity{}, - }, - Properties: &armastro.OrganizationResourceUpdateProperties{ - PartnerOrganizationProperties: &armastro.LiftrBaseDataPartnerOrganizationPropertiesUpdate{ - OrganizationID: to.Ptr("lrtmbkvyvvoszhjevohkmyjhfyty"), - OrganizationName: to.Ptr("U2P_"), - SingleSignOnProperties: &armastro.LiftrBaseSingleSignOnProperties{ - AADDomains: []*string{ - to.Ptr("kfbleh")}, - EnterpriseAppID: to.Ptr("mklfypyujwumgwdzae"), - ProvisioningState: to.Ptr(armastro.ResourceProvisioningStateSucceeded), - SingleSignOnState: to.Ptr(armastro.SingleSignOnStatesInitial), - SingleSignOnURL: to.Ptr("ymmtzkyghvinvhgnqlzwrr"), - }, - WorkspaceID: to.Ptr("xsepuskdhejaadusyxq"), - WorkspaceName: to.Ptr("L.-y_--:"), - }, - User: &armastro.LiftrBaseUserDetailsUpdate{ - EmailAddress: to.Ptr(".K_@e7N-g1.xjqnbPs"), - FirstName: to.Ptr("qeuofehzypzljgcuysugefbgxde"), - LastName: to.Ptr("g"), - PhoneNumber: to.Ptr("aqpyxznvqpgkzohevynofrjdfgoo"), - Upn: to.Ptr("uwtprzdfpsqmktx"), - }, - }, - Tags: map[string]*string{ - "key1474": to.Ptr("bqqyipxnbbxryhznyaosmtpo"), - }, - }, 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.OrganizationResource = armastro.OrganizationResource{ - // Name: to.Ptr("ycyrfvupthkudm"), - // Type: to.Ptr("ldwwclcpqssjomo"), - // ID: to.Ptr("bhslekyvgkfomahtvjiin"), - // SystemData: &armastro.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-25T11:16:12.868Z"); return t}()), - // CreatedBy: to.Ptr("zw"), - // CreatedByType: to.Ptr(armastro.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-07-25T11:16:12.868Z"); return t}()), - // LastModifiedBy: to.Ptr("isirkhwcppaqoqzoebybzikzbzkjzf"), - // LastModifiedByType: to.Ptr(armastro.CreatedByTypeUser), - // }, - // Location: to.Ptr("mhqthlsatwvqkl"), - // Tags: map[string]*string{ - // }, - // Identity: &armastro.ManagedServiceIdentity{ - // Type: to.Ptr(armastro.ManagedServiceIdentityTypeNone), - // PrincipalID: to.Ptr("b5684bd7-7958-4c0e-9795-d686c31746d2"), - // TenantID: to.Ptr("b5684bd7-7958-4c0e-9795-d686c31746d2"), - // UserAssignedIdentities: map[string]*armastro.UserAssignedIdentity{ - // }, - // }, - // Properties: &armastro.LiftrBaseDataOrganizationProperties{ - // Marketplace: &armastro.LiftrBaseMarketplaceDetails{ - // OfferDetails: &armastro.LiftrBaseOfferDetails{ - // OfferID: to.Ptr("krzkefmpxztqyusidzgpchfaswuyce"), - // PlanID: to.Ptr("kndxzygsanuiqzwbfbbvoipv"), - // PlanName: to.Ptr("pwqjwlq"), - // PublisherID: to.Ptr("gfsqxygpnerxmvols"), - // TermID: to.Ptr("pwds"), - // TermUnit: to.Ptr("xyygyzcazkuelz"), - // }, - // SubscriptionID: to.Ptr("ntthclydlpqmasr"), - // SubscriptionStatus: to.Ptr(armastro.MarketplaceSubscriptionStatusPendingFulfillmentStart), - // }, - // PartnerOrganizationProperties: &armastro.LiftrBaseDataPartnerOrganizationProperties{ - // OrganizationID: to.Ptr("lrtmbkvyvvoszhjevohkmyjhfyty"), - // OrganizationName: to.Ptr("U2P_"), - // SingleSignOnProperties: &armastro.LiftrBaseSingleSignOnProperties{ - // AADDomains: []*string{ - // to.Ptr("kfbleh")}, - // EnterpriseAppID: to.Ptr("mklfypyujwumgwdzae"), - // ProvisioningState: to.Ptr(armastro.ResourceProvisioningStateSucceeded), - // SingleSignOnState: to.Ptr(armastro.SingleSignOnStatesInitial), - // SingleSignOnURL: to.Ptr("ymmtzkyghvinvhgnqlzwrr"), - // }, - // WorkspaceID: to.Ptr("xsepuskdhejaadusyxq"), - // WorkspaceName: to.Ptr("L.-y_--:"), - // }, - // ProvisioningState: to.Ptr(armastro.ResourceProvisioningStateSucceeded), - // User: &armastro.LiftrBaseUserDetails{ - // EmailAddress: to.Ptr(".K_@e7N-g1.xjqnbPs"), - // FirstName: to.Ptr("qeuofehzypzljgcuysugefbgxde"), - // LastName: to.Ptr("g"), - // PhoneNumber: to.Ptr("aqpyxznvqpgkzohevynofrjdfgoo"), - // Upn: to.Ptr("uwtprzdfpsqmktx"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/d4205894880b989ede35d62d97c8e901ed14fb5a/specification/liftrastronomer/resource-manager/Astronomer.Astro/stable/2023-08-01/examples/Organizations_Delete_MaximumSet_Gen.json -func ExampleOrganizationsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armastro.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewOrganizationsClient().BeginDelete(ctx, "rgastronomer", "q:", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/astro/armastro/responses.go b/sdk/resourcemanager/astro/armastro/responses.go index 2c9adaf784c4..fccb7af8a25d 100644 --- a/sdk/resourcemanager/astro/armastro/responses.go +++ b/sdk/resourcemanager/astro/armastro/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. diff --git a/sdk/resourcemanager/astro/armastro/time_rfc3339.go b/sdk/resourcemanager/astro/armastro/time_rfc3339.go index cff81f68a7c5..5476344d2915 100644 --- a/sdk/resourcemanager/astro/armastro/time_rfc3339.go +++ b/sdk/resourcemanager/astro/armastro/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. @@ -60,6 +57,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string diff --git a/sdk/resourcemanager/avs/armavs/CHANGELOG.md b/sdk/resourcemanager/avs/armavs/CHANGELOG.md index 853efa5224a9..83e4f08d2ed1 100644 --- a/sdk/resourcemanager/avs/armavs/CHANGELOG.md +++ b/sdk/resourcemanager/avs/armavs/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 2.0.1 (2025-04-27) +### Other Changes + + ## 2.0.0 (2024-09-26) ### Breaking Changes diff --git a/sdk/resourcemanager/avs/armavs/addons_client.go b/sdk/resourcemanager/avs/armavs/addons_client.go index 93b9084f7f08..e835d042b9d0 100644 --- a/sdk/resourcemanager/avs/armavs/addons_client.go +++ b/sdk/resourcemanager/avs/armavs/addons_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. @@ -97,7 +94,7 @@ func (client *AddonsClient) createOrUpdate(ctx context.Context, resourceGroupNam } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *AddonsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, addonName string, addon Addon, options *AddonsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *AddonsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, addonName string, addon Addon, _ *AddonsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -181,7 +178,7 @@ func (client *AddonsClient) deleteOperation(ctx context.Context, resourceGroupNa } // deleteCreateRequest creates the Delete request. -func (client *AddonsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, addonName string, options *AddonsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *AddonsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, addonName string, _ *AddonsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -241,7 +238,7 @@ func (client *AddonsClient) Get(ctx context.Context, resourceGroupName string, p } // getCreateRequest creates the Get request. -func (client *AddonsClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, addonName string, options *AddonsClientGetOptions) (*policy.Request, error) { +func (client *AddonsClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, addonName string, _ *AddonsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -309,7 +306,7 @@ func (client *AddonsClient) NewListPager(resourceGroupName string, privateCloudN } // listCreateRequest creates the List request. -func (client *AddonsClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, options *AddonsClientListOptions) (*policy.Request, error) { +func (client *AddonsClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, _ *AddonsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/avs/armavs/addons_client_example_test.go b/sdk/resourcemanager/avs/armavs/addons_client_example_test.go deleted file mode 100644 index 7d59a7a8246d..000000000000 --- a/sdk/resourcemanager/avs/armavs/addons_client_example_test.go +++ /dev/null @@ -1,354 +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 armavs_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/avs/armavs/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Addons_List.json -func ExampleAddonsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAddonsClient().NewListPager("group1", "cloud1", 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.AddonList = armavs.AddonList{ - // Value: []*armavs.Addon{ - // { - // Name: to.Ptr("srm"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/addons"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/addons/srm"), - // Properties: &armavs.AddonSrmProperties{ - // AddonType: to.Ptr(armavs.AddonTypeSRM), - // ProvisioningState: to.Ptr(armavs.AddonProvisioningStateSucceeded), - // LicenseKey: to.Ptr("41915178-A8FF-4A4D-B683-6D735AF5E3F5"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Addons_Get_ArcReg.json -func ExampleAddonsClient_Get_addonsGetArcReg() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAddonsClient().Get(ctx, "group1", "cloud1", "arc", 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.Addon = armavs.Addon{ - // Name: to.Ptr("arc"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/addons"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/addons/arc"), - // Properties: &armavs.AddonArcProperties{ - // AddonType: to.Ptr(armavs.AddonTypeArc), - // ProvisioningState: to.Ptr(armavs.AddonProvisioningStateSucceeded), - // VCenter: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg_test/providers/Microsoft.ConnectedVMwarevSphere/VCenters/test-vcenter"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Addons_Get_HCX.json -func ExampleAddonsClient_Get_addonsGetHcx() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAddonsClient().Get(ctx, "group1", "cloud1", "hcx", 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.Addon = armavs.Addon{ - // Name: to.Ptr("hcx"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/addons"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/addons/hcx"), - // Properties: &armavs.AddonHcxProperties{ - // AddonType: to.Ptr(armavs.AddonTypeHCX), - // ProvisioningState: to.Ptr(armavs.AddonProvisioningStateSucceeded), - // Offer: to.Ptr("VMware MaaS Cloud Provider (Enterprise)"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Addons_Get_SRM.json -func ExampleAddonsClient_Get_addonsGetSrm() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAddonsClient().Get(ctx, "group1", "cloud1", "srm", 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.Addon = armavs.Addon{ - // Name: to.Ptr("srm"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/addons"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/addons/srm"), - // Properties: &armavs.AddonSrmProperties{ - // AddonType: to.Ptr(armavs.AddonTypeSRM), - // ProvisioningState: to.Ptr(armavs.AddonProvisioningStateSucceeded), - // LicenseKey: to.Ptr("41915178-A8FF-4A4D-B683-6D735AF5E3F5"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Addons_Get_VR.json -func ExampleAddonsClient_Get_addonsGetVr() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAddonsClient().Get(ctx, "group1", "cloud1", "vr", 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.Addon = armavs.Addon{ - // Name: to.Ptr("vr"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/addons"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/addons/vr"), - // Properties: &armavs.AddonVrProperties{ - // AddonType: to.Ptr(armavs.AddonTypeVR), - // ProvisioningState: to.Ptr(armavs.AddonProvisioningStateSucceeded), - // VrsCount: to.Ptr[int32](1), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Addons_CreateOrUpdate_ArcReg.json -func ExampleAddonsClient_BeginCreateOrUpdate_addonsCreateOrUpdateArcReg() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAddonsClient().BeginCreateOrUpdate(ctx, "group1", "cloud1", "arc", armavs.Addon{ - Properties: &armavs.AddonArcProperties{ - AddonType: to.Ptr(armavs.AddonTypeArc), - VCenter: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg_test/providers/Microsoft.ConnectedVMwarevSphere/VCenters/test-vcenter"), - }, - }, 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.Addon = armavs.Addon{ - // Name: to.Ptr("arc"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/addons"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/addons/arc"), - // Properties: &armavs.AddonArcProperties{ - // AddonType: to.Ptr(armavs.AddonTypeArc), - // ProvisioningState: to.Ptr(armavs.AddonProvisioningStateSucceeded), - // VCenter: to.Ptr("subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg_test/providers/Microsoft.ConnectedVMwarevSphere/VCenters/test-vcenter"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Addons_CreateOrUpdate_HCX.json -func ExampleAddonsClient_BeginCreateOrUpdate_addonsCreateOrUpdateHcx() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAddonsClient().BeginCreateOrUpdate(ctx, "group1", "cloud1", "hcx", armavs.Addon{ - Properties: &armavs.AddonHcxProperties{ - AddonType: to.Ptr(armavs.AddonTypeHCX), - Offer: to.Ptr("VMware MaaS Cloud Provider (Enterprise)"), - }, - }, 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.Addon = armavs.Addon{ - // Name: to.Ptr("hcx"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/addons"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/addons/hcx"), - // Properties: &armavs.AddonHcxProperties{ - // AddonType: to.Ptr(armavs.AddonTypeHCX), - // ProvisioningState: to.Ptr(armavs.AddonProvisioningStateSucceeded), - // Offer: to.Ptr("VMware MaaS Cloud Provider (Enterprise)"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Addons_CreateOrUpdate_SRM.json -func ExampleAddonsClient_BeginCreateOrUpdate_addonsCreateOrUpdateSrm() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAddonsClient().BeginCreateOrUpdate(ctx, "group1", "cloud1", "srm", armavs.Addon{ - Properties: &armavs.AddonSrmProperties{ - AddonType: to.Ptr(armavs.AddonTypeSRM), - LicenseKey: to.Ptr("41915178-A8FF-4A4D-B683-6D735AF5E3F5"), - }, - }, 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.Addon = armavs.Addon{ - // Name: to.Ptr("srm"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/addons"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/addons/srm"), - // Properties: &armavs.AddonSrmProperties{ - // AddonType: to.Ptr(armavs.AddonTypeSRM), - // ProvisioningState: to.Ptr(armavs.AddonProvisioningStateSucceeded), - // LicenseKey: to.Ptr("41915178-A8FF-4A4D-B683-6D735AF5E3F5"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Addons_CreateOrUpdate_VR.json -func ExampleAddonsClient_BeginCreateOrUpdate_addonsCreateOrUpdateVr() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAddonsClient().BeginCreateOrUpdate(ctx, "group1", "cloud1", "vr", armavs.Addon{ - Properties: &armavs.AddonVrProperties{ - AddonType: to.Ptr(armavs.AddonTypeVR), - VrsCount: to.Ptr[int32](1), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Addon = armavs.Addon{ - // Name: to.Ptr("vr"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/addons"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/addons/vr"), - // Properties: &armavs.AddonVrProperties{ - // AddonType: to.Ptr(armavs.AddonTypeVR), - // ProvisioningState: to.Ptr(armavs.AddonProvisioningStateSucceeded), - // VrsCount: to.Ptr[int32](1), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Addons_Delete.json -func ExampleAddonsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAddonsClient().BeginDelete(ctx, "group1", "cloud1", "srm", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/avs/armavs/authorizations_client.go b/sdk/resourcemanager/avs/armavs/authorizations_client.go index 5b2de61be043..b822a99cedf9 100644 --- a/sdk/resourcemanager/avs/armavs/authorizations_client.go +++ b/sdk/resourcemanager/avs/armavs/authorizations_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. @@ -97,7 +94,7 @@ func (client *AuthorizationsClient) createOrUpdate(ctx context.Context, resource } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *AuthorizationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, authorizationName string, authorization ExpressRouteAuthorization, options *AuthorizationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *AuthorizationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, authorizationName string, authorization ExpressRouteAuthorization, _ *AuthorizationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -182,7 +179,7 @@ func (client *AuthorizationsClient) deleteOperation(ctx context.Context, resourc } // deleteCreateRequest creates the Delete request. -func (client *AuthorizationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, authorizationName string, options *AuthorizationsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *AuthorizationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, authorizationName string, _ *AuthorizationsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -242,7 +239,7 @@ func (client *AuthorizationsClient) Get(ctx context.Context, resourceGroupName s } // getCreateRequest creates the Get request. -func (client *AuthorizationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, authorizationName string, options *AuthorizationsClientGetOptions) (*policy.Request, error) { +func (client *AuthorizationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, authorizationName string, _ *AuthorizationsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -310,7 +307,7 @@ func (client *AuthorizationsClient) NewListPager(resourceGroupName string, priva } // listCreateRequest creates the List request. -func (client *AuthorizationsClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, options *AuthorizationsClientListOptions) (*policy.Request, error) { +func (client *AuthorizationsClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, _ *AuthorizationsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/avs/armavs/authorizations_client_example_test.go b/sdk/resourcemanager/avs/armavs/authorizations_client_example_test.go deleted file mode 100644 index 560130482003..000000000000 --- a/sdk/resourcemanager/avs/armavs/authorizations_client_example_test.go +++ /dev/null @@ -1,144 +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 armavs_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/avs/armavs/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Authorizations_List.json -func ExampleAuthorizationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAuthorizationsClient().NewListPager("group1", "cloud1", 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.ExpressRouteAuthorizationList = armavs.ExpressRouteAuthorizationList{ - // Value: []*armavs.ExpressRouteAuthorization{ - // { - // Name: to.Ptr("authorization1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/authorizations"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/authorizations/authorization1"), - // Properties: &armavs.ExpressRouteAuthorizationProperties{ - // ExpressRouteAuthorizationID: to.Ptr("/subscriptions/5206f269-120b-41ef-a95b-0dce7109de61/resourceGroups/tnt34-cust-mockp02-spearj2dev/providers/Microsoft.Network/expressroutecircuits/tnt34-cust-mockp02-spearj2dev-er/authorizations/myauth"), - // ExpressRouteAuthorizationKey: to.Ptr("37b0db3b-3b17-4c7b-bf76-bf13b01bcadc"), - // ExpressRouteID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2/providers/Microsoft.Network/expressroutecircuits/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2-xconnect"), - // ProvisioningState: to.Ptr(armavs.ExpressRouteAuthorizationProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Authorizations_Get.json -func ExampleAuthorizationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAuthorizationsClient().Get(ctx, "group1", "cloud1", "authorization1", 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.ExpressRouteAuthorization = armavs.ExpressRouteAuthorization{ - // Name: to.Ptr("authorization1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/authorizations"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/authorizations/authorization1"), - // Properties: &armavs.ExpressRouteAuthorizationProperties{ - // ExpressRouteAuthorizationID: to.Ptr("/subscriptions/5206f269-120b-41ef-a95b-0dce7109de61/resourceGroups/tnt34-cust-mockp02-spearj2dev/providers/Microsoft.Network/expressroutecircuits/tnt34-cust-mockp02-spearj2dev-er/authorizations/myauth"), - // ExpressRouteAuthorizationKey: to.Ptr("37b0db3b-3b17-4c7b-bf76-bf13b01bcadc"), - // ExpressRouteID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2/providers/Microsoft.Network/expressroutecircuits/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2-xconnect"), - // ProvisioningState: to.Ptr(armavs.ExpressRouteAuthorizationProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Authorizations_CreateOrUpdate.json -func ExampleAuthorizationsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAuthorizationsClient().BeginCreateOrUpdate(ctx, "group1", "cloud1", "authorization1", armavs.ExpressRouteAuthorization{}, 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.ExpressRouteAuthorization = armavs.ExpressRouteAuthorization{ - // Name: to.Ptr("authorization1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/authorizations"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/authorizations/authorization1"), - // Properties: &armavs.ExpressRouteAuthorizationProperties{ - // ExpressRouteAuthorizationID: to.Ptr("/subscriptions/5206f269-120b-41ef-a95b-0dce7109de61/resourceGroups/tnt34-cust-mockp02-spearj2dev/providers/Microsoft.Network/expressroutecircuits/tnt34-cust-mockp02-spearj2dev-er/authorizations/myauth"), - // ExpressRouteAuthorizationKey: to.Ptr("37b0db3b-3b17-4c7b-bf76-bf13b01bcadc"), - // ExpressRouteID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2/providers/Microsoft.Network/expressroutecircuits/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2-xconnect"), - // ProvisioningState: to.Ptr(armavs.ExpressRouteAuthorizationProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Authorizations_Delete.json -func ExampleAuthorizationsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAuthorizationsClient().BeginDelete(ctx, "group1", "cloud1", "authorization1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/avs/armavs/autorest.md b/sdk/resourcemanager/avs/armavs/autorest.md index fe6aec05ccf0..1f5cb8f0e25f 100644 --- a/sdk/resourcemanager/avs/armavs/autorest.md +++ b/sdk/resourcemanager/avs/armavs/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/vmware/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/vmware/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 2.0.0 -tag: package-2023-09-01 +module-version: 2.0.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/avs/armavs/client_factory.go b/sdk/resourcemanager/avs/armavs/client_factory.go index b07ffb712851..e8e16c8b284a 100644 --- a/sdk/resourcemanager/avs/armavs/client_factory.go +++ b/sdk/resourcemanager/avs/armavs/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. diff --git a/sdk/resourcemanager/avs/armavs/cloudlinks_client.go b/sdk/resourcemanager/avs/armavs/cloudlinks_client.go index 6875d1fdec15..d0070836e14b 100644 --- a/sdk/resourcemanager/avs/armavs/cloudlinks_client.go +++ b/sdk/resourcemanager/avs/armavs/cloudlinks_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. @@ -97,7 +94,7 @@ func (client *CloudLinksClient) createOrUpdate(ctx context.Context, resourceGrou } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *CloudLinksClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, cloudLinkName string, cloudLink CloudLink, options *CloudLinksClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *CloudLinksClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, cloudLinkName string, cloudLink CloudLink, _ *CloudLinksClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -181,7 +178,7 @@ func (client *CloudLinksClient) deleteOperation(ctx context.Context, resourceGro } // deleteCreateRequest creates the Delete request. -func (client *CloudLinksClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, cloudLinkName string, options *CloudLinksClientBeginDeleteOptions) (*policy.Request, error) { +func (client *CloudLinksClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, cloudLinkName string, _ *CloudLinksClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -241,7 +238,7 @@ func (client *CloudLinksClient) Get(ctx context.Context, resourceGroupName strin } // getCreateRequest creates the Get request. -func (client *CloudLinksClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, cloudLinkName string, options *CloudLinksClientGetOptions) (*policy.Request, error) { +func (client *CloudLinksClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, cloudLinkName string, _ *CloudLinksClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -309,7 +306,7 @@ func (client *CloudLinksClient) NewListPager(resourceGroupName string, privateCl } // listCreateRequest creates the List request. -func (client *CloudLinksClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, options *CloudLinksClientListOptions) (*policy.Request, error) { +func (client *CloudLinksClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, _ *CloudLinksClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/avs/armavs/cloudlinks_client_example_test.go b/sdk/resourcemanager/avs/armavs/cloudlinks_client_example_test.go deleted file mode 100644 index 902c5d005bc1..000000000000 --- a/sdk/resourcemanager/avs/armavs/cloudlinks_client_example_test.go +++ /dev/null @@ -1,143 +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 armavs_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/avs/armavs/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/CloudLinks_List.json -func ExampleCloudLinksClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudLinksClient().NewListPager("group1", "cloud1", 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.CloudLinkList = armavs.CloudLinkList{ - // Value: []*armavs.CloudLink{ - // { - // Name: to.Ptr("cloudLink1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/cloudLinks"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/cloudLinks/cloudLink1"), - // Properties: &armavs.CloudLinkProperties{ - // LinkedCloud: to.Ptr("/subscriptions/12341234-1234-1234-1234-123412341234/resourceGroups/mygroup/providers/Microsoft.AVS/privateClouds/cloud2"), - // Status: to.Ptr(armavs.CloudLinkStatusActive), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/CloudLinks_Get.json -func ExampleCloudLinksClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudLinksClient().Get(ctx, "group1", "cloud1", "cloudLink1", 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.CloudLink = armavs.CloudLink{ - // Name: to.Ptr("cloudLink1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/cloudLinks"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/cloudLinks/cloudLink1"), - // Properties: &armavs.CloudLinkProperties{ - // LinkedCloud: to.Ptr("/subscriptions/12341234-1234-1234-1234-123412341234/resourceGroups/mygroup/providers/Microsoft.AVS/privateClouds/cloud2"), - // Status: to.Ptr(armavs.CloudLinkStatusActive), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/CloudLinks_CreateOrUpdate.json -func ExampleCloudLinksClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudLinksClient().BeginCreateOrUpdate(ctx, "group1", "cloud1", "cloudLink1", armavs.CloudLink{ - Properties: &armavs.CloudLinkProperties{ - LinkedCloud: to.Ptr("/subscriptions/12341234-1234-1234-1234-123412341234/resourceGroups/mygroup/providers/Microsoft.AVS/privateClouds/cloud2"), - }, - }, 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.CloudLink = armavs.CloudLink{ - // Name: to.Ptr("cloudLink1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/cloudLinks"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/cloudLinks/cloudLink1"), - // Properties: &armavs.CloudLinkProperties{ - // LinkedCloud: to.Ptr("/subscriptions/12341234-1234-1234-1234-123412341234/resourceGroups/mygroup/providers/Microsoft.AVS/privateClouds/cloud2"), - // Status: to.Ptr(armavs.CloudLinkStatusActive), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/CloudLinks_Delete.json -func ExampleCloudLinksClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudLinksClient().BeginDelete(ctx, "group1", "cloud1", "cloudLink1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/avs/armavs/clusters_client.go b/sdk/resourcemanager/avs/armavs/clusters_client.go index bbb028d67fe8..a742455bebb6 100644 --- a/sdk/resourcemanager/avs/armavs/clusters_client.go +++ b/sdk/resourcemanager/avs/armavs/clusters_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. @@ -97,7 +94,7 @@ func (client *ClustersClient) createOrUpdate(ctx context.Context, resourceGroupN } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ClustersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, cluster Cluster, options *ClustersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ClustersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, cluster Cluster, _ *ClustersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -181,7 +178,7 @@ func (client *ClustersClient) deleteOperation(ctx context.Context, resourceGroup } // deleteCreateRequest creates the Delete request. -func (client *ClustersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, options *ClustersClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ClustersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, _ *ClustersClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -241,7 +238,7 @@ func (client *ClustersClient) Get(ctx context.Context, resourceGroupName string, } // getCreateRequest creates the Get request. -func (client *ClustersClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, options *ClustersClientGetOptions) (*policy.Request, error) { +func (client *ClustersClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, _ *ClustersClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -309,7 +306,7 @@ func (client *ClustersClient) NewListPager(resourceGroupName string, privateClou } // listCreateRequest creates the List request. -func (client *ClustersClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, options *ClustersClientListOptions) (*policy.Request, error) { +func (client *ClustersClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, _ *ClustersClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -374,7 +371,7 @@ func (client *ClustersClient) ListZones(ctx context.Context, resourceGroupName s } // listZonesCreateRequest creates the ListZones request. -func (client *ClustersClient) listZonesCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, options *ClustersClientListZonesOptions) (*policy.Request, error) { +func (client *ClustersClient) listZonesCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, _ *ClustersClientListZonesOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/listZones" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -465,7 +462,7 @@ func (client *ClustersClient) update(ctx context.Context, resourceGroupName stri } // updateCreateRequest creates the Update request. -func (client *ClustersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, clusterUpdate ClusterUpdate, options *ClustersClientBeginUpdateOptions) (*policy.Request, error) { +func (client *ClustersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, clusterUpdate ClusterUpdate, _ *ClustersClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/avs/armavs/clusters_client_example_test.go b/sdk/resourcemanager/avs/armavs/clusters_client_example_test.go deleted file mode 100644 index 2b517a362b02..000000000000 --- a/sdk/resourcemanager/avs/armavs/clusters_client_example_test.go +++ /dev/null @@ -1,280 +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 armavs_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/avs/armavs/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Clusters_List.json -func ExampleClustersClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewClustersClient().NewListPager("group1", "cloud1", 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.ClusterList = armavs.ClusterList{ - // Value: []*armavs.Cluster{ - // { - // Name: to.Ptr("cluster1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/clusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1"), - // Properties: &armavs.ClusterProperties{ - // ClusterSize: to.Ptr[int32](3), - // Hosts: []*string{ - // to.Ptr("fakehost22.nyc1.kubernetes.center"), - // to.Ptr("fakehost23.nyc1.kubernetes.center"), - // to.Ptr("fakehost24.nyc1.kubernetes.center")}, - // ProvisioningState: to.Ptr(armavs.ClusterProvisioningStateSucceeded), - // }, - // SKU: &armavs.SKU{ - // Name: to.Ptr("AV20"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Clusters_Get.json -func ExampleClustersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClustersClient().Get(ctx, "group1", "cloud1", "cluster1", 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.Cluster = armavs.Cluster{ - // Name: to.Ptr("cluster1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/clusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1"), - // Properties: &armavs.ClusterProperties{ - // ClusterSize: to.Ptr[int32](4), - // Hosts: []*string{ - // to.Ptr("fakehost22.nyc1.kubernetes.center"), - // to.Ptr("fakehost23.nyc1.kubernetes.center"), - // to.Ptr("fakehost24.nyc1.kubernetes.center"), - // to.Ptr("fakehost25.nyc1.kubernetes.center")}, - // ProvisioningState: to.Ptr(armavs.ClusterProvisioningStateSucceeded), - // }, - // SKU: &armavs.SKU{ - // Name: to.Ptr("AV20"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Clusters_CreateOrUpdate.json -func ExampleClustersClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginCreateOrUpdate(ctx, "group1", "cloud1", "cluster1", armavs.Cluster{ - Properties: &armavs.ClusterProperties{ - ClusterSize: to.Ptr[int32](3), - }, - SKU: &armavs.SKU{ - Name: to.Ptr("AV20"), - }, - }, 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.Cluster = armavs.Cluster{ - // Name: to.Ptr("cluster1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/clusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1"), - // Properties: &armavs.ClusterProperties{ - // ClusterSize: to.Ptr[int32](3), - // Hosts: []*string{ - // to.Ptr("fakehost22.nyc1.kubernetes.center"), - // to.Ptr("fakehost23.nyc1.kubernetes.center"), - // to.Ptr("fakehost24.nyc1.kubernetes.center")}, - // ProvisioningState: to.Ptr(armavs.ClusterProvisioningStateSucceeded), - // }, - // SKU: &armavs.SKU{ - // Name: to.Ptr("AV20"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Clusters_Update.json -func ExampleClustersClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginUpdate(ctx, "group1", "cloud1", "cluster1", armavs.ClusterUpdate{ - Properties: &armavs.ClusterUpdateProperties{ - ClusterSize: to.Ptr[int32](4), - }, - }, 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.Cluster = armavs.Cluster{ - // Name: to.Ptr("cluster1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/clusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1"), - // Properties: &armavs.ClusterProperties{ - // ClusterSize: to.Ptr[int32](4), - // Hosts: []*string{ - // to.Ptr("fakehost22.nyc1.kubernetes.center"), - // to.Ptr("fakehost23.nyc1.kubernetes.center"), - // to.Ptr("fakehost24.nyc1.kubernetes.center"), - // to.Ptr("fakehost25.nyc1.kubernetes.center")}, - // ProvisioningState: to.Ptr(armavs.ClusterProvisioningStateSucceeded), - // }, - // SKU: &armavs.SKU{ - // Name: to.Ptr("AV20"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Clusters_Delete.json -func ExampleClustersClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewClustersClient().BeginDelete(ctx, "group1", "cloud1", "cluster1", 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/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Clusters_ListZones.json -func ExampleClustersClient_ListZones_clustersListZones() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClustersClient().ListZones(ctx, "group1", "cloud1", "cluster1", 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.ClusterZoneList = armavs.ClusterZoneList{ - // Zones: []*armavs.ClusterZone{ - // { - // Hosts: []*string{ - // to.Ptr("fakehost22.nyc1.kubernetes.center"), - // to.Ptr("fakehost23.nyc1.kubernetes.center"), - // to.Ptr("fakehost24.nyc1.kubernetes.center")}, - // Zone: to.Ptr("2"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Clusters_ListZones_Stretched.json -func ExampleClustersClient_ListZones_clustersListZonesStretched() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewClustersClient().ListZones(ctx, "group1", "cloud1", "cluster1", 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.ClusterZoneList = armavs.ClusterZoneList{ - // Zones: []*armavs.ClusterZone{ - // { - // Hosts: []*string{ - // to.Ptr("fakehost22.nyc1.kubernetes.center"), - // to.Ptr("fakehost23.nyc1.kubernetes.center"), - // to.Ptr("fakehost24.nyc1.kubernetes.center")}, - // Zone: to.Ptr("2"), - // }, - // { - // Hosts: []*string{ - // to.Ptr("fakehost74.nyc2.kubernetes.center"), - // to.Ptr("fakehost75.nyc2.kubernetes.center"), - // to.Ptr("fakehost76.nyc2.kubernetes.center")}, - // Zone: to.Ptr("1"), - // }}, - // } -} diff --git a/sdk/resourcemanager/avs/armavs/constants.go b/sdk/resourcemanager/avs/armavs/constants.go index 6df69d74d1a7..bf647ee1c4cd 100644 --- a/sdk/resourcemanager/avs/armavs/constants.go +++ b/sdk/resourcemanager/avs/armavs/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 armavs const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/avs/armavs" - moduleVersion = "v2.0.0" + moduleVersion = "v2.0.1" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/avs/armavs/datastores_client.go b/sdk/resourcemanager/avs/armavs/datastores_client.go index dd343221f5a1..c039dfbe2d63 100644 --- a/sdk/resourcemanager/avs/armavs/datastores_client.go +++ b/sdk/resourcemanager/avs/armavs/datastores_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. @@ -98,7 +95,7 @@ func (client *DatastoresClient) createOrUpdate(ctx context.Context, resourceGrou } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *DatastoresClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, datastoreName string, datastore Datastore, options *DatastoresClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *DatastoresClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, datastoreName string, datastore Datastore, _ *DatastoresClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -187,7 +184,7 @@ func (client *DatastoresClient) deleteOperation(ctx context.Context, resourceGro } // deleteCreateRequest creates the Delete request. -func (client *DatastoresClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, datastoreName string, options *DatastoresClientBeginDeleteOptions) (*policy.Request, error) { +func (client *DatastoresClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, datastoreName string, _ *DatastoresClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -252,7 +249,7 @@ func (client *DatastoresClient) Get(ctx context.Context, resourceGroupName strin } // getCreateRequest creates the Get request. -func (client *DatastoresClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, datastoreName string, options *DatastoresClientGetOptions) (*policy.Request, error) { +func (client *DatastoresClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, datastoreName string, _ *DatastoresClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -325,7 +322,7 @@ func (client *DatastoresClient) NewListPager(resourceGroupName string, privateCl } // listCreateRequest creates the List request. -func (client *DatastoresClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, options *DatastoresClientListOptions) (*policy.Request, error) { +func (client *DatastoresClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, _ *DatastoresClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/avs/armavs/datastores_client_example_test.go b/sdk/resourcemanager/avs/armavs/datastores_client_example_test.go deleted file mode 100644 index a7d573df3951..000000000000 --- a/sdk/resourcemanager/avs/armavs/datastores_client_example_test.go +++ /dev/null @@ -1,181 +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 armavs_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/avs/armavs/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Datastores_List.json -func ExampleDatastoresClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDatastoresClient().NewListPager("group1", "cloud1", "cluster1", 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.DatastoreList = armavs.DatastoreList{ - // Value: []*armavs.Datastore{ - // { - // Name: to.Ptr("datastore1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/clusters/datastores"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/datastores/datastore1"), - // Properties: &armavs.DatastoreProperties{ - // NetAppVolume: &armavs.NetAppVolume{ - // ID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/ResourceGroup1/providers/Microsoft.NetApp/netAppAccounts/NetAppAccount1/capacityPools/CapacityPool1/volumes/NFSVol1"), - // }, - // ProvisioningState: to.Ptr(armavs.DatastoreProvisioningStateSucceeded), - // Status: to.Ptr(armavs.DatastoreStatusAccessible), - // }, - // }, - // { - // Name: to.Ptr("datastore2"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/clusters/datastores"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/datastores/datastore2"), - // Properties: &armavs.DatastoreProperties{ - // DiskPoolVolume: &armavs.DiskPoolVolume{ - // Path: to.Ptr("/vmfs/devices/disks/naa.6001405f75f6bdf7f6f49db8b4b21723"), - // LunName: to.Ptr("lun0"), - // MountOption: to.Ptr(armavs.MountOptionEnumMOUNT), - // TargetID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/ResourceGroup1/providers/Microsoft.StoragePool/diskPools/DiskPool1/targets/Target1"), - // }, - // ProvisioningState: to.Ptr(armavs.DatastoreProvisioningStateSucceeded), - // Status: to.Ptr(armavs.DatastoreStatusAccessible), - // }, - // }, - // { - // Name: to.Ptr("datastore2"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/clusters/datastores"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/datastores/datastore2"), - // Properties: &armavs.DatastoreProperties{ - // ElasticSanVolume: &armavs.ElasticSanVolume{ - // TargetID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/ResourceGroup1/providers/Microsoft.ElasticSan/elasticSans/ElasticSan1/volumeGroups/VolumeGroup1/volumes/Volume1"), - // }, - // ProvisioningState: to.Ptr(armavs.DatastoreProvisioningStateSucceeded), - // Status: to.Ptr(armavs.DatastoreStatusAccessible), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Datastores_Get.json -func ExampleDatastoresClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDatastoresClient().Get(ctx, "group1", "cloud1", "cluster1", "datastore1", 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.Datastore = armavs.Datastore{ - // Name: to.Ptr("datastore1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/clusters/datastores"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/datastores/datastore1"), - // Properties: &armavs.DatastoreProperties{ - // NetAppVolume: &armavs.NetAppVolume{ - // ID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/ResourceGroup1/providers/Microsoft.NetApp/netAppAccounts/NetAppAccount1/capacityPools/CapacityPool1/volumes/NFSVol1"), - // }, - // ProvisioningState: to.Ptr(armavs.DatastoreProvisioningStateSucceeded), - // Status: to.Ptr(armavs.DatastoreStatusAccessible), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Datastores_CreateOrUpdate.json -func ExampleDatastoresClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatastoresClient().BeginCreateOrUpdate(ctx, "group1", "cloud1", "cluster1", "datastore1", armavs.Datastore{ - Properties: &armavs.DatastoreProperties{ - NetAppVolume: &armavs.NetAppVolume{ - ID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/ResourceGroup1/providers/Microsoft.NetApp/netAppAccounts/NetAppAccount1/capacityPools/CapacityPool1/volumes/NFSVol1"), - }, - }, - }, 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.Datastore = armavs.Datastore{ - // Name: to.Ptr("datastore1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/clusters/datastores"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/datastores/datastore1"), - // Properties: &armavs.DatastoreProperties{ - // NetAppVolume: &armavs.NetAppVolume{ - // ID: to.Ptr("/subscriptions/11111111-1111-1111-1111-111111111111/resourceGroups/ResourceGroup1/providers/Microsoft.NetApp/netAppAccounts/NetAppAccount1/capacityPools/CapacityPool1/volumes/NFSVol1"), - // }, - // ProvisioningState: to.Ptr(armavs.DatastoreProvisioningStateSucceeded), - // Status: to.Ptr(armavs.DatastoreStatusAccessible), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Datastores_Delete.json -func ExampleDatastoresClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDatastoresClient().BeginDelete(ctx, "group1", "cloud1", "cluster1", "datastore1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/avs/armavs/fake/addons_server.go b/sdk/resourcemanager/avs/armavs/fake/addons_server.go index f02eb3ccb5b7..ab9ceee7a25b 100644 --- a/sdk/resourcemanager/avs/armavs/fake/addons_server.go +++ b/sdk/resourcemanager/avs/armavs/fake/addons_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. @@ -70,27 +67,46 @@ func (a *AddonsServerTransport) 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 a.dispatchToMethodFake(req, method) +} - switch method { - case "AddonsClient.BeginCreateOrUpdate": - resp, err = a.dispatchBeginCreateOrUpdate(req) - case "AddonsClient.BeginDelete": - resp, err = a.dispatchBeginDelete(req) - case "AddonsClient.Get": - resp, err = a.dispatchGet(req) - case "AddonsClient.NewListPager": - resp, err = a.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *AddonsServerTransport) 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 addonsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = addonsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AddonsClient.BeginCreateOrUpdate": + res.resp, res.err = a.dispatchBeginCreateOrUpdate(req) + case "AddonsClient.BeginDelete": + res.resp, res.err = a.dispatchBeginDelete(req) + case "AddonsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AddonsClient.NewListPager": + res.resp, res.err = a.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 (a *AddonsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -270,3 +286,9 @@ func (a *AddonsServerTransport) dispatchNewListPager(req *http.Request) (*http.R } return resp, nil } + +// set this to conditionally intercept incoming requests to AddonsServerTransport +var addonsServerTransportInterceptor 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/avs/armavs/fake/authorizations_server.go b/sdk/resourcemanager/avs/armavs/fake/authorizations_server.go index 8853faa85a4e..5e378cb2ad19 100644 --- a/sdk/resourcemanager/avs/armavs/fake/authorizations_server.go +++ b/sdk/resourcemanager/avs/armavs/fake/authorizations_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. @@ -70,27 +67,46 @@ func (a *AuthorizationsServerTransport) Do(req *http.Request) (*http.Response, e return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - switch method { - case "AuthorizationsClient.BeginCreateOrUpdate": - resp, err = a.dispatchBeginCreateOrUpdate(req) - case "AuthorizationsClient.BeginDelete": - resp, err = a.dispatchBeginDelete(req) - case "AuthorizationsClient.Get": - resp, err = a.dispatchGet(req) - case "AuthorizationsClient.NewListPager": - resp, err = a.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *AuthorizationsServerTransport) 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 authorizationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = authorizationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AuthorizationsClient.BeginCreateOrUpdate": + res.resp, res.err = a.dispatchBeginCreateOrUpdate(req) + case "AuthorizationsClient.BeginDelete": + res.resp, res.err = a.dispatchBeginDelete(req) + case "AuthorizationsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AuthorizationsClient.NewListPager": + res.resp, res.err = a.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 (a *AuthorizationsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -270,3 +286,9 @@ func (a *AuthorizationsServerTransport) dispatchNewListPager(req *http.Request) } return resp, nil } + +// set this to conditionally intercept incoming requests to AuthorizationsServerTransport +var authorizationsServerTransportInterceptor 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/avs/armavs/fake/cloudlinks_server.go b/sdk/resourcemanager/avs/armavs/fake/cloudlinks_server.go index 8b43af090577..9cd7d87d5dd8 100644 --- a/sdk/resourcemanager/avs/armavs/fake/cloudlinks_server.go +++ b/sdk/resourcemanager/avs/armavs/fake/cloudlinks_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. @@ -70,27 +67,46 @@ func (c *CloudLinksServerTransport) 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 c.dispatchToMethodFake(req, method) +} - switch method { - case "CloudLinksClient.BeginCreateOrUpdate": - resp, err = c.dispatchBeginCreateOrUpdate(req) - case "CloudLinksClient.BeginDelete": - resp, err = c.dispatchBeginDelete(req) - case "CloudLinksClient.Get": - resp, err = c.dispatchGet(req) - case "CloudLinksClient.NewListPager": - resp, err = c.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (c *CloudLinksServerTransport) 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 cloudLinksServerTransportInterceptor != nil { + res.resp, res.err, intercepted = cloudLinksServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CloudLinksClient.BeginCreateOrUpdate": + res.resp, res.err = c.dispatchBeginCreateOrUpdate(req) + case "CloudLinksClient.BeginDelete": + res.resp, res.err = c.dispatchBeginDelete(req) + case "CloudLinksClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "CloudLinksClient.NewListPager": + res.resp, res.err = c.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 (c *CloudLinksServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -270,3 +286,9 @@ func (c *CloudLinksServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to CloudLinksServerTransport +var cloudLinksServerTransportInterceptor 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/avs/armavs/fake/clusters_server.go b/sdk/resourcemanager/avs/armavs/fake/clusters_server.go index 0823086d444b..e6ac5684becf 100644 --- a/sdk/resourcemanager/avs/armavs/fake/clusters_server.go +++ b/sdk/resourcemanager/avs/armavs/fake/clusters_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. @@ -80,31 +77,50 @@ func (c *ClustersServerTransport) 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 c.dispatchToMethodFake(req, method) +} - switch method { - case "ClustersClient.BeginCreateOrUpdate": - resp, err = c.dispatchBeginCreateOrUpdate(req) - case "ClustersClient.BeginDelete": - resp, err = c.dispatchBeginDelete(req) - case "ClustersClient.Get": - resp, err = c.dispatchGet(req) - case "ClustersClient.NewListPager": - resp, err = c.dispatchNewListPager(req) - case "ClustersClient.ListZones": - resp, err = c.dispatchListZones(req) - case "ClustersClient.BeginUpdate": - resp, err = c.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (c *ClustersServerTransport) 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 clustersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = clustersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ClustersClient.BeginCreateOrUpdate": + res.resp, res.err = c.dispatchBeginCreateOrUpdate(req) + case "ClustersClient.BeginDelete": + res.resp, res.err = c.dispatchBeginDelete(req) + case "ClustersClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "ClustersClient.NewListPager": + res.resp, res.err = c.dispatchNewListPager(req) + case "ClustersClient.ListZones": + res.resp, res.err = c.dispatchListZones(req) + case "ClustersClient.BeginUpdate": + res.resp, res.err = c.dispatchBeginUpdate(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 (c *ClustersServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -373,3 +389,9 @@ func (c *ClustersServerTransport) dispatchBeginUpdate(req *http.Request) (*http. return resp, nil } + +// set this to conditionally intercept incoming requests to ClustersServerTransport +var clustersServerTransportInterceptor 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/avs/armavs/fake/datastores_server.go b/sdk/resourcemanager/avs/armavs/fake/datastores_server.go index d46e4c178ecd..76eb983c0e85 100644 --- a/sdk/resourcemanager/avs/armavs/fake/datastores_server.go +++ b/sdk/resourcemanager/avs/armavs/fake/datastores_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. @@ -70,27 +67,46 @@ func (d *DatastoresServerTransport) 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 d.dispatchToMethodFake(req, method) +} - switch method { - case "DatastoresClient.BeginCreateOrUpdate": - resp, err = d.dispatchBeginCreateOrUpdate(req) - case "DatastoresClient.BeginDelete": - resp, err = d.dispatchBeginDelete(req) - case "DatastoresClient.Get": - resp, err = d.dispatchGet(req) - case "DatastoresClient.NewListPager": - resp, err = d.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (d *DatastoresServerTransport) 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 datastoresServerTransportInterceptor != nil { + res.resp, res.err, intercepted = datastoresServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DatastoresClient.BeginCreateOrUpdate": + res.resp, res.err = d.dispatchBeginCreateOrUpdate(req) + case "DatastoresClient.BeginDelete": + res.resp, res.err = d.dispatchBeginDelete(req) + case "DatastoresClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DatastoresClient.NewListPager": + res.resp, res.err = d.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 (d *DatastoresServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -286,3 +302,9 @@ func (d *DatastoresServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to DatastoresServerTransport +var datastoresServerTransportInterceptor 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/avs/armavs/fake/globalreachconnections_server.go b/sdk/resourcemanager/avs/armavs/fake/globalreachconnections_server.go index 6cd62c4988a1..aef53a7fad3a 100644 --- a/sdk/resourcemanager/avs/armavs/fake/globalreachconnections_server.go +++ b/sdk/resourcemanager/avs/armavs/fake/globalreachconnections_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. @@ -70,27 +67,46 @@ func (g *GlobalReachConnectionsServerTransport) Do(req *http.Request) (*http.Res return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return g.dispatchToMethodFake(req, method) +} - switch method { - case "GlobalReachConnectionsClient.BeginCreateOrUpdate": - resp, err = g.dispatchBeginCreateOrUpdate(req) - case "GlobalReachConnectionsClient.BeginDelete": - resp, err = g.dispatchBeginDelete(req) - case "GlobalReachConnectionsClient.Get": - resp, err = g.dispatchGet(req) - case "GlobalReachConnectionsClient.NewListPager": - resp, err = g.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (g *GlobalReachConnectionsServerTransport) 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 globalReachConnectionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = globalReachConnectionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "GlobalReachConnectionsClient.BeginCreateOrUpdate": + res.resp, res.err = g.dispatchBeginCreateOrUpdate(req) + case "GlobalReachConnectionsClient.BeginDelete": + res.resp, res.err = g.dispatchBeginDelete(req) + case "GlobalReachConnectionsClient.Get": + res.resp, res.err = g.dispatchGet(req) + case "GlobalReachConnectionsClient.NewListPager": + res.resp, res.err = g.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 (g *GlobalReachConnectionsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -270,3 +286,9 @@ func (g *GlobalReachConnectionsServerTransport) dispatchNewListPager(req *http.R } return resp, nil } + +// set this to conditionally intercept incoming requests to GlobalReachConnectionsServerTransport +var globalReachConnectionsServerTransportInterceptor 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/avs/armavs/fake/hcxenterprisesites_server.go b/sdk/resourcemanager/avs/armavs/fake/hcxenterprisesites_server.go index 783d81e9dafa..098cdb61c6dc 100644 --- a/sdk/resourcemanager/avs/armavs/fake/hcxenterprisesites_server.go +++ b/sdk/resourcemanager/avs/armavs/fake/hcxenterprisesites_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. @@ -66,27 +63,46 @@ func (h *HcxEnterpriseSitesServerTransport) Do(req *http.Request) (*http.Respons return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return h.dispatchToMethodFake(req, method) +} - switch method { - case "HcxEnterpriseSitesClient.CreateOrUpdate": - resp, err = h.dispatchCreateOrUpdate(req) - case "HcxEnterpriseSitesClient.Delete": - resp, err = h.dispatchDelete(req) - case "HcxEnterpriseSitesClient.Get": - resp, err = h.dispatchGet(req) - case "HcxEnterpriseSitesClient.NewListPager": - resp, err = h.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (h *HcxEnterpriseSitesServerTransport) 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 hcxEnterpriseSitesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = hcxEnterpriseSitesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "HcxEnterpriseSitesClient.CreateOrUpdate": + res.resp, res.err = h.dispatchCreateOrUpdate(req) + case "HcxEnterpriseSitesClient.Delete": + res.resp, res.err = h.dispatchDelete(req) + case "HcxEnterpriseSitesClient.Get": + res.resp, res.err = h.dispatchGet(req) + case "HcxEnterpriseSitesClient.NewListPager": + res.resp, res.err = h.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 (h *HcxEnterpriseSitesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -244,3 +260,9 @@ func (h *HcxEnterpriseSitesServerTransport) dispatchNewListPager(req *http.Reque } return resp, nil } + +// set this to conditionally intercept incoming requests to HcxEnterpriseSitesServerTransport +var hcxEnterpriseSitesServerTransportInterceptor 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/avs/armavs/fake/internal.go b/sdk/resourcemanager/avs/armavs/fake/internal.go index 5f75802a569e..4b65adc76adb 100644 --- a/sdk/resourcemanager/avs/armavs/fake/internal.go +++ b/sdk/resourcemanager/avs/armavs/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/avs/armavs/fake/iscsipaths_server.go b/sdk/resourcemanager/avs/armavs/fake/iscsipaths_server.go index 62f30783f427..48ebce1b6f0a 100644 --- a/sdk/resourcemanager/avs/armavs/fake/iscsipaths_server.go +++ b/sdk/resourcemanager/avs/armavs/fake/iscsipaths_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. @@ -70,27 +67,46 @@ func (i *IscsiPathsServerTransport) 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 i.dispatchToMethodFake(req, method) +} - switch method { - case "IscsiPathsClient.BeginCreateOrUpdate": - resp, err = i.dispatchBeginCreateOrUpdate(req) - case "IscsiPathsClient.BeginDelete": - resp, err = i.dispatchBeginDelete(req) - case "IscsiPathsClient.Get": - resp, err = i.dispatchGet(req) - case "IscsiPathsClient.NewListByPrivateCloudPager": - resp, err = i.dispatchNewListByPrivateCloudPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (i *IscsiPathsServerTransport) 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 iscsiPathsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = iscsiPathsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "IscsiPathsClient.BeginCreateOrUpdate": + res.resp, res.err = i.dispatchBeginCreateOrUpdate(req) + case "IscsiPathsClient.BeginDelete": + res.resp, res.err = i.dispatchBeginDelete(req) + case "IscsiPathsClient.Get": + res.resp, res.err = i.dispatchGet(req) + case "IscsiPathsClient.NewListByPrivateCloudPager": + res.resp, res.err = i.dispatchNewListByPrivateCloudPager(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 (i *IscsiPathsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -258,3 +274,9 @@ func (i *IscsiPathsServerTransport) dispatchNewListByPrivateCloudPager(req *http } return resp, nil } + +// set this to conditionally intercept incoming requests to IscsiPathsServerTransport +var iscsiPathsServerTransportInterceptor 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/avs/armavs/fake/locations_server.go b/sdk/resourcemanager/avs/armavs/fake/locations_server.go index 0aee39aced66..c5fef279093b 100644 --- a/sdk/resourcemanager/avs/armavs/fake/locations_server.go +++ b/sdk/resourcemanager/avs/armavs/fake/locations_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. @@ -54,23 +51,42 @@ func (l *LocationsServerTransport) 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 l.dispatchToMethodFake(req, method) +} - switch method { - case "LocationsClient.CheckQuotaAvailability": - resp, err = l.dispatchCheckQuotaAvailability(req) - case "LocationsClient.CheckTrialAvailability": - resp, err = l.dispatchCheckTrialAvailability(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (l *LocationsServerTransport) 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 locationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = locationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "LocationsClient.CheckQuotaAvailability": + res.resp, res.err = l.dispatchCheckQuotaAvailability(req) + case "LocationsClient.CheckTrialAvailability": + res.resp, res.err = l.dispatchCheckTrialAvailability(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 (l *LocationsServerTransport) dispatchCheckQuotaAvailability(req *http.Request) (*http.Response, error) { @@ -140,3 +156,9 @@ func (l *LocationsServerTransport) dispatchCheckTrialAvailability(req *http.Requ } return resp, nil } + +// set this to conditionally intercept incoming requests to LocationsServerTransport +var locationsServerTransportInterceptor 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/avs/armavs/fake/operations_server.go b/sdk/resourcemanager/avs/armavs/fake/operations_server.go index 3dbb131299e1..6c7e58d2f356 100644 --- a/sdk/resourcemanager/avs/armavs/fake/operations_server.go +++ b/sdk/resourcemanager/avs/armavs/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. @@ -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/avs/armavs/fake/placementpolicies_server.go b/sdk/resourcemanager/avs/armavs/fake/placementpolicies_server.go index 21390dfe89ee..68015e9b9e98 100644 --- a/sdk/resourcemanager/avs/armavs/fake/placementpolicies_server.go +++ b/sdk/resourcemanager/avs/armavs/fake/placementpolicies_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. @@ -76,29 +73,48 @@ func (p *PlacementPoliciesServerTransport) Do(req *http.Request) (*http.Response return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return p.dispatchToMethodFake(req, method) +} - switch method { - case "PlacementPoliciesClient.BeginCreateOrUpdate": - resp, err = p.dispatchBeginCreateOrUpdate(req) - case "PlacementPoliciesClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "PlacementPoliciesClient.Get": - resp, err = p.dispatchGet(req) - case "PlacementPoliciesClient.NewListPager": - resp, err = p.dispatchNewListPager(req) - case "PlacementPoliciesClient.BeginUpdate": - resp, err = p.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (p *PlacementPoliciesServerTransport) 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 placementPoliciesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = placementPoliciesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PlacementPoliciesClient.BeginCreateOrUpdate": + res.resp, res.err = p.dispatchBeginCreateOrUpdate(req) + case "PlacementPoliciesClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "PlacementPoliciesClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PlacementPoliciesClient.NewListPager": + res.resp, res.err = p.dispatchNewListPager(req) + case "PlacementPoliciesClient.BeginUpdate": + res.resp, res.err = p.dispatchBeginUpdate(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 (p *PlacementPoliciesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -350,3 +366,9 @@ func (p *PlacementPoliciesServerTransport) dispatchBeginUpdate(req *http.Request return resp, nil } + +// set this to conditionally intercept incoming requests to PlacementPoliciesServerTransport +var placementPoliciesServerTransportInterceptor 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/avs/armavs/fake/privateclouds_server.go b/sdk/resourcemanager/avs/armavs/fake/privateclouds_server.go index 74a8b99f6250..effe907ce5b1 100644 --- a/sdk/resourcemanager/avs/armavs/fake/privateclouds_server.go +++ b/sdk/resourcemanager/avs/armavs/fake/privateclouds_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. @@ -49,11 +46,11 @@ type PrivateCloudsServer struct { NewListInSubscriptionPager func(options *armavs.PrivateCloudsClientListInSubscriptionOptions) (resp azfake.PagerResponder[armavs.PrivateCloudsClientListInSubscriptionResponse]) // BeginRotateNsxtPassword is the fake for method PrivateCloudsClient.BeginRotateNsxtPassword - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginRotateNsxtPassword func(ctx context.Context, resourceGroupName string, privateCloudName string, options *armavs.PrivateCloudsClientBeginRotateNsxtPasswordOptions) (resp azfake.PollerResponder[armavs.PrivateCloudsClientRotateNsxtPasswordResponse], errResp azfake.ErrorResponder) // BeginRotateVcenterPassword is the fake for method PrivateCloudsClient.BeginRotateVcenterPassword - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginRotateVcenterPassword func(ctx context.Context, resourceGroupName string, privateCloudName string, options *armavs.PrivateCloudsClientBeginRotateVcenterPasswordOptions) (resp azfake.PollerResponder[armavs.PrivateCloudsClientRotateVcenterPasswordResponse], errResp azfake.ErrorResponder) // BeginUpdate is the fake for method PrivateCloudsClient.BeginUpdate @@ -98,37 +95,56 @@ func (p *PrivateCloudsServerTransport) Do(req *http.Request) (*http.Response, er return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "PrivateCloudsClient.BeginCreateOrUpdate": - resp, err = p.dispatchBeginCreateOrUpdate(req) - case "PrivateCloudsClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "PrivateCloudsClient.Get": - resp, err = p.dispatchGet(req) - case "PrivateCloudsClient.NewListPager": - resp, err = p.dispatchNewListPager(req) - case "PrivateCloudsClient.ListAdminCredentials": - resp, err = p.dispatchListAdminCredentials(req) - case "PrivateCloudsClient.NewListInSubscriptionPager": - resp, err = p.dispatchNewListInSubscriptionPager(req) - case "PrivateCloudsClient.BeginRotateNsxtPassword": - resp, err = p.dispatchBeginRotateNsxtPassword(req) - case "PrivateCloudsClient.BeginRotateVcenterPassword": - resp, err = p.dispatchBeginRotateVcenterPassword(req) - case "PrivateCloudsClient.BeginUpdate": - resp, err = p.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return p.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (p *PrivateCloudsServerTransport) 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 privateCloudsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateCloudsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateCloudsClient.BeginCreateOrUpdate": + res.resp, res.err = p.dispatchBeginCreateOrUpdate(req) + case "PrivateCloudsClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "PrivateCloudsClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PrivateCloudsClient.NewListPager": + res.resp, res.err = p.dispatchNewListPager(req) + case "PrivateCloudsClient.ListAdminCredentials": + res.resp, res.err = p.dispatchListAdminCredentials(req) + case "PrivateCloudsClient.NewListInSubscriptionPager": + res.resp, res.err = p.dispatchNewListInSubscriptionPager(req) + case "PrivateCloudsClient.BeginRotateNsxtPassword": + res.resp, res.err = p.dispatchBeginRotateNsxtPassword(req) + case "PrivateCloudsClient.BeginRotateVcenterPassword": + res.resp, res.err = p.dispatchBeginRotateVcenterPassword(req) + case "PrivateCloudsClient.BeginUpdate": + res.resp, res.err = p.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 (p *PrivateCloudsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -392,9 +408,9 @@ func (p *PrivateCloudsServerTransport) dispatchBeginRotateNsxtPassword(req *http return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { p.beginRotateNsxtPassword.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginRotateNsxtPassword) { p.beginRotateNsxtPassword.remove(req) @@ -436,9 +452,9 @@ func (p *PrivateCloudsServerTransport) dispatchBeginRotateVcenterPassword(req *h return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { p.beginRotateVcenterPassword.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginRotateVcenterPassword) { p.beginRotateVcenterPassword.remove(req) @@ -494,3 +510,9 @@ func (p *PrivateCloudsServerTransport) dispatchBeginUpdate(req *http.Request) (* return resp, nil } + +// set this to conditionally intercept incoming requests to PrivateCloudsServerTransport +var privateCloudsServerTransportInterceptor 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/avs/armavs/fake/scriptcmdlets_server.go b/sdk/resourcemanager/avs/armavs/fake/scriptcmdlets_server.go index c9c6ccb3a4dd..224145dbc6ab 100644 --- a/sdk/resourcemanager/avs/armavs/fake/scriptcmdlets_server.go +++ b/sdk/resourcemanager/avs/armavs/fake/scriptcmdlets_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. @@ -58,23 +55,42 @@ func (s *ScriptCmdletsServerTransport) Do(req *http.Request) (*http.Response, er return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "ScriptCmdletsClient.Get": - resp, err = s.dispatchGet(req) - case "ScriptCmdletsClient.NewListPager": - resp, err = s.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *ScriptCmdletsServerTransport) 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 scriptCmdletsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = scriptCmdletsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ScriptCmdletsClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "ScriptCmdletsClient.NewListPager": + res.resp, res.err = s.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 (s *ScriptCmdletsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -162,3 +178,9 @@ func (s *ScriptCmdletsServerTransport) dispatchNewListPager(req *http.Request) ( } return resp, nil } + +// set this to conditionally intercept incoming requests to ScriptCmdletsServerTransport +var scriptCmdletsServerTransportInterceptor 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/avs/armavs/fake/scriptexecutions_server.go b/sdk/resourcemanager/avs/armavs/fake/scriptexecutions_server.go index a33312dda42e..d2deca4ee103 100644 --- a/sdk/resourcemanager/avs/armavs/fake/scriptexecutions_server.go +++ b/sdk/resourcemanager/avs/armavs/fake/scriptexecutions_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. @@ -74,29 +71,48 @@ func (s *ScriptExecutionsServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "ScriptExecutionsClient.BeginCreateOrUpdate": - resp, err = s.dispatchBeginCreateOrUpdate(req) - case "ScriptExecutionsClient.BeginDelete": - resp, err = s.dispatchBeginDelete(req) - case "ScriptExecutionsClient.Get": - resp, err = s.dispatchGet(req) - case "ScriptExecutionsClient.GetExecutionLogs": - resp, err = s.dispatchGetExecutionLogs(req) - case "ScriptExecutionsClient.NewListPager": - resp, err = s.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *ScriptExecutionsServerTransport) 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 scriptExecutionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = scriptExecutionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ScriptExecutionsClient.BeginCreateOrUpdate": + res.resp, res.err = s.dispatchBeginCreateOrUpdate(req) + case "ScriptExecutionsClient.BeginDelete": + res.resp, res.err = s.dispatchBeginDelete(req) + case "ScriptExecutionsClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "ScriptExecutionsClient.GetExecutionLogs": + res.resp, res.err = s.dispatchGetExecutionLogs(req) + case "ScriptExecutionsClient.NewListPager": + res.resp, res.err = s.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 (s *ScriptExecutionsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -323,3 +339,9 @@ func (s *ScriptExecutionsServerTransport) dispatchNewListPager(req *http.Request } return resp, nil } + +// set this to conditionally intercept incoming requests to ScriptExecutionsServerTransport +var scriptExecutionsServerTransportInterceptor 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/avs/armavs/fake/scriptpackages_server.go b/sdk/resourcemanager/avs/armavs/fake/scriptpackages_server.go index 1c4a8b89decf..11959606a728 100644 --- a/sdk/resourcemanager/avs/armavs/fake/scriptpackages_server.go +++ b/sdk/resourcemanager/avs/armavs/fake/scriptpackages_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. @@ -58,23 +55,42 @@ func (s *ScriptPackagesServerTransport) Do(req *http.Request) (*http.Response, e return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "ScriptPackagesClient.Get": - resp, err = s.dispatchGet(req) - case "ScriptPackagesClient.NewListPager": - resp, err = s.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *ScriptPackagesServerTransport) 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 scriptPackagesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = scriptPackagesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ScriptPackagesClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "ScriptPackagesClient.NewListPager": + res.resp, res.err = s.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 (s *ScriptPackagesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -154,3 +170,9 @@ func (s *ScriptPackagesServerTransport) dispatchNewListPager(req *http.Request) } return resp, nil } + +// set this to conditionally intercept incoming requests to ScriptPackagesServerTransport +var scriptPackagesServerTransportInterceptor 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/avs/armavs/fake/server_factory.go b/sdk/resourcemanager/avs/armavs/fake/server_factory.go index 9e0196453d51..a4afbab64e84 100644 --- a/sdk/resourcemanager/avs/armavs/fake/server_factory.go +++ b/sdk/resourcemanager/avs/armavs/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,23 +16,56 @@ import ( // ServerFactory is a fake server for instances of the armavs.ClientFactory type. type ServerFactory struct { - AddonsServer AddonsServer - AuthorizationsServer AuthorizationsServer - CloudLinksServer CloudLinksServer - ClustersServer ClustersServer - DatastoresServer DatastoresServer + // AddonsServer contains the fakes for client AddonsClient + AddonsServer AddonsServer + + // AuthorizationsServer contains the fakes for client AuthorizationsClient + AuthorizationsServer AuthorizationsServer + + // CloudLinksServer contains the fakes for client CloudLinksClient + CloudLinksServer CloudLinksServer + + // ClustersServer contains the fakes for client ClustersClient + ClustersServer ClustersServer + + // DatastoresServer contains the fakes for client DatastoresClient + DatastoresServer DatastoresServer + + // GlobalReachConnectionsServer contains the fakes for client GlobalReachConnectionsClient GlobalReachConnectionsServer GlobalReachConnectionsServer - HcxEnterpriseSitesServer HcxEnterpriseSitesServer - IscsiPathsServer IscsiPathsServer - LocationsServer LocationsServer - OperationsServer OperationsServer - PlacementPoliciesServer PlacementPoliciesServer - PrivateCloudsServer PrivateCloudsServer - ScriptCmdletsServer ScriptCmdletsServer - ScriptExecutionsServer ScriptExecutionsServer - ScriptPackagesServer ScriptPackagesServer - VirtualMachinesServer VirtualMachinesServer - WorkloadNetworksServer WorkloadNetworksServer + + // HcxEnterpriseSitesServer contains the fakes for client HcxEnterpriseSitesClient + HcxEnterpriseSitesServer HcxEnterpriseSitesServer + + // IscsiPathsServer contains the fakes for client IscsiPathsClient + IscsiPathsServer IscsiPathsServer + + // LocationsServer contains the fakes for client LocationsClient + LocationsServer LocationsServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // PlacementPoliciesServer contains the fakes for client PlacementPoliciesClient + PlacementPoliciesServer PlacementPoliciesServer + + // PrivateCloudsServer contains the fakes for client PrivateCloudsClient + PrivateCloudsServer PrivateCloudsServer + + // ScriptCmdletsServer contains the fakes for client ScriptCmdletsClient + ScriptCmdletsServer ScriptCmdletsServer + + // ScriptExecutionsServer contains the fakes for client ScriptExecutionsClient + ScriptExecutionsServer ScriptExecutionsServer + + // ScriptPackagesServer contains the fakes for client ScriptPackagesClient + ScriptPackagesServer ScriptPackagesServer + + // VirtualMachinesServer contains the fakes for client VirtualMachinesClient + VirtualMachinesServer VirtualMachinesServer + + // WorkloadNetworksServer contains the fakes for client WorkloadNetworksClient + WorkloadNetworksServer WorkloadNetworksServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. diff --git a/sdk/resourcemanager/avs/armavs/fake/virtualmachines_server.go b/sdk/resourcemanager/avs/armavs/fake/virtualmachines_server.go index e9ebb8453978..afa4d91c2ab2 100644 --- a/sdk/resourcemanager/avs/armavs/fake/virtualmachines_server.go +++ b/sdk/resourcemanager/avs/armavs/fake/virtualmachines_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. @@ -33,7 +30,7 @@ type VirtualMachinesServer struct { NewListPager func(resourceGroupName string, privateCloudName string, clusterName string, options *armavs.VirtualMachinesClientListOptions) (resp azfake.PagerResponder[armavs.VirtualMachinesClientListResponse]) // BeginRestrictMovement is the fake for method VirtualMachinesClient.BeginRestrictMovement - // HTTP status codes to indicate success: http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginRestrictMovement func(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, virtualMachineID string, restrictMovement armavs.VirtualMachineRestrictMovement, options *armavs.VirtualMachinesClientBeginRestrictMovementOptions) (resp azfake.PollerResponder[armavs.VirtualMachinesClientRestrictMovementResponse], errResp azfake.ErrorResponder) } @@ -64,25 +61,44 @@ func (v *VirtualMachinesServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return v.dispatchToMethodFake(req, method) +} - switch method { - case "VirtualMachinesClient.Get": - resp, err = v.dispatchGet(req) - case "VirtualMachinesClient.NewListPager": - resp, err = v.dispatchNewListPager(req) - case "VirtualMachinesClient.BeginRestrictMovement": - resp, err = v.dispatchBeginRestrictMovement(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (v *VirtualMachinesServerTransport) 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 virtualMachinesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = virtualMachinesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "VirtualMachinesClient.Get": + res.resp, res.err = v.dispatchGet(req) + case "VirtualMachinesClient.NewListPager": + res.resp, res.err = v.dispatchNewListPager(req) + case "VirtualMachinesClient.BeginRestrictMovement": + res.resp, res.err = v.dispatchBeginRestrictMovement(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 (v *VirtualMachinesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -216,9 +232,9 @@ func (v *VirtualMachinesServerTransport) dispatchBeginRestrictMovement(req *http return nil, err } - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { v.beginRestrictMovement.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginRestrictMovement) { v.beginRestrictMovement.remove(req) @@ -226,3 +242,9 @@ func (v *VirtualMachinesServerTransport) dispatchBeginRestrictMovement(req *http return resp, nil } + +// set this to conditionally intercept incoming requests to VirtualMachinesServerTransport +var virtualMachinesServerTransportInterceptor 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/avs/armavs/fake/workloadnetworks_server.go b/sdk/resourcemanager/avs/armavs/fake/workloadnetworks_server.go index 57f198ccf41c..5a738f841330 100644 --- a/sdk/resourcemanager/avs/armavs/fake/workloadnetworks_server.go +++ b/sdk/resourcemanager/avs/armavs/fake/workloadnetworks_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. @@ -268,99 +265,118 @@ func (w *WorkloadNetworksServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "WorkloadNetworksClient.BeginCreateDNSService": - resp, err = w.dispatchBeginCreateDNSService(req) - case "WorkloadNetworksClient.BeginCreateDNSZone": - resp, err = w.dispatchBeginCreateDNSZone(req) - case "WorkloadNetworksClient.BeginCreateDhcp": - resp, err = w.dispatchBeginCreateDhcp(req) - case "WorkloadNetworksClient.BeginCreatePortMirroring": - resp, err = w.dispatchBeginCreatePortMirroring(req) - case "WorkloadNetworksClient.BeginCreatePublicIP": - resp, err = w.dispatchBeginCreatePublicIP(req) - case "WorkloadNetworksClient.BeginCreateSegments": - resp, err = w.dispatchBeginCreateSegments(req) - case "WorkloadNetworksClient.BeginCreateVMGroup": - resp, err = w.dispatchBeginCreateVMGroup(req) - case "WorkloadNetworksClient.BeginDeleteDNSService": - resp, err = w.dispatchBeginDeleteDNSService(req) - case "WorkloadNetworksClient.BeginDeleteDNSZone": - resp, err = w.dispatchBeginDeleteDNSZone(req) - case "WorkloadNetworksClient.BeginDeleteDhcp": - resp, err = w.dispatchBeginDeleteDhcp(req) - case "WorkloadNetworksClient.BeginDeletePortMirroring": - resp, err = w.dispatchBeginDeletePortMirroring(req) - case "WorkloadNetworksClient.BeginDeletePublicIP": - resp, err = w.dispatchBeginDeletePublicIP(req) - case "WorkloadNetworksClient.BeginDeleteSegment": - resp, err = w.dispatchBeginDeleteSegment(req) - case "WorkloadNetworksClient.BeginDeleteVMGroup": - resp, err = w.dispatchBeginDeleteVMGroup(req) - case "WorkloadNetworksClient.Get": - resp, err = w.dispatchGet(req) - case "WorkloadNetworksClient.GetDNSService": - resp, err = w.dispatchGetDNSService(req) - case "WorkloadNetworksClient.GetDNSZone": - resp, err = w.dispatchGetDNSZone(req) - case "WorkloadNetworksClient.GetDhcp": - resp, err = w.dispatchGetDhcp(req) - case "WorkloadNetworksClient.GetGateway": - resp, err = w.dispatchGetGateway(req) - case "WorkloadNetworksClient.GetPortMirroring": - resp, err = w.dispatchGetPortMirroring(req) - case "WorkloadNetworksClient.GetPublicIP": - resp, err = w.dispatchGetPublicIP(req) - case "WorkloadNetworksClient.GetSegment": - resp, err = w.dispatchGetSegment(req) - case "WorkloadNetworksClient.GetVMGroup": - resp, err = w.dispatchGetVMGroup(req) - case "WorkloadNetworksClient.GetVirtualMachine": - resp, err = w.dispatchGetVirtualMachine(req) - case "WorkloadNetworksClient.NewListPager": - resp, err = w.dispatchNewListPager(req) - case "WorkloadNetworksClient.NewListDNSServicesPager": - resp, err = w.dispatchNewListDNSServicesPager(req) - case "WorkloadNetworksClient.NewListDNSZonesPager": - resp, err = w.dispatchNewListDNSZonesPager(req) - case "WorkloadNetworksClient.NewListDhcpPager": - resp, err = w.dispatchNewListDhcpPager(req) - case "WorkloadNetworksClient.NewListGatewaysPager": - resp, err = w.dispatchNewListGatewaysPager(req) - case "WorkloadNetworksClient.NewListPortMirroringPager": - resp, err = w.dispatchNewListPortMirroringPager(req) - case "WorkloadNetworksClient.NewListPublicIPsPager": - resp, err = w.dispatchNewListPublicIPsPager(req) - case "WorkloadNetworksClient.NewListSegmentsPager": - resp, err = w.dispatchNewListSegmentsPager(req) - case "WorkloadNetworksClient.NewListVMGroupsPager": - resp, err = w.dispatchNewListVMGroupsPager(req) - case "WorkloadNetworksClient.NewListVirtualMachinesPager": - resp, err = w.dispatchNewListVirtualMachinesPager(req) - case "WorkloadNetworksClient.BeginUpdateDNSService": - resp, err = w.dispatchBeginUpdateDNSService(req) - case "WorkloadNetworksClient.BeginUpdateDNSZone": - resp, err = w.dispatchBeginUpdateDNSZone(req) - case "WorkloadNetworksClient.BeginUpdateDhcp": - resp, err = w.dispatchBeginUpdateDhcp(req) - case "WorkloadNetworksClient.BeginUpdatePortMirroring": - resp, err = w.dispatchBeginUpdatePortMirroring(req) - case "WorkloadNetworksClient.BeginUpdateSegments": - resp, err = w.dispatchBeginUpdateSegments(req) - case "WorkloadNetworksClient.BeginUpdateVMGroup": - resp, err = w.dispatchBeginUpdateVMGroup(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return w.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err +func (w *WorkloadNetworksServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if workloadNetworksServerTransportInterceptor != nil { + res.resp, res.err, intercepted = workloadNetworksServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "WorkloadNetworksClient.BeginCreateDNSService": + res.resp, res.err = w.dispatchBeginCreateDNSService(req) + case "WorkloadNetworksClient.BeginCreateDNSZone": + res.resp, res.err = w.dispatchBeginCreateDNSZone(req) + case "WorkloadNetworksClient.BeginCreateDhcp": + res.resp, res.err = w.dispatchBeginCreateDhcp(req) + case "WorkloadNetworksClient.BeginCreatePortMirroring": + res.resp, res.err = w.dispatchBeginCreatePortMirroring(req) + case "WorkloadNetworksClient.BeginCreatePublicIP": + res.resp, res.err = w.dispatchBeginCreatePublicIP(req) + case "WorkloadNetworksClient.BeginCreateSegments": + res.resp, res.err = w.dispatchBeginCreateSegments(req) + case "WorkloadNetworksClient.BeginCreateVMGroup": + res.resp, res.err = w.dispatchBeginCreateVMGroup(req) + case "WorkloadNetworksClient.BeginDeleteDNSService": + res.resp, res.err = w.dispatchBeginDeleteDNSService(req) + case "WorkloadNetworksClient.BeginDeleteDNSZone": + res.resp, res.err = w.dispatchBeginDeleteDNSZone(req) + case "WorkloadNetworksClient.BeginDeleteDhcp": + res.resp, res.err = w.dispatchBeginDeleteDhcp(req) + case "WorkloadNetworksClient.BeginDeletePortMirroring": + res.resp, res.err = w.dispatchBeginDeletePortMirroring(req) + case "WorkloadNetworksClient.BeginDeletePublicIP": + res.resp, res.err = w.dispatchBeginDeletePublicIP(req) + case "WorkloadNetworksClient.BeginDeleteSegment": + res.resp, res.err = w.dispatchBeginDeleteSegment(req) + case "WorkloadNetworksClient.BeginDeleteVMGroup": + res.resp, res.err = w.dispatchBeginDeleteVMGroup(req) + case "WorkloadNetworksClient.Get": + res.resp, res.err = w.dispatchGet(req) + case "WorkloadNetworksClient.GetDNSService": + res.resp, res.err = w.dispatchGetDNSService(req) + case "WorkloadNetworksClient.GetDNSZone": + res.resp, res.err = w.dispatchGetDNSZone(req) + case "WorkloadNetworksClient.GetDhcp": + res.resp, res.err = w.dispatchGetDhcp(req) + case "WorkloadNetworksClient.GetGateway": + res.resp, res.err = w.dispatchGetGateway(req) + case "WorkloadNetworksClient.GetPortMirroring": + res.resp, res.err = w.dispatchGetPortMirroring(req) + case "WorkloadNetworksClient.GetPublicIP": + res.resp, res.err = w.dispatchGetPublicIP(req) + case "WorkloadNetworksClient.GetSegment": + res.resp, res.err = w.dispatchGetSegment(req) + case "WorkloadNetworksClient.GetVMGroup": + res.resp, res.err = w.dispatchGetVMGroup(req) + case "WorkloadNetworksClient.GetVirtualMachine": + res.resp, res.err = w.dispatchGetVirtualMachine(req) + case "WorkloadNetworksClient.NewListPager": + res.resp, res.err = w.dispatchNewListPager(req) + case "WorkloadNetworksClient.NewListDNSServicesPager": + res.resp, res.err = w.dispatchNewListDNSServicesPager(req) + case "WorkloadNetworksClient.NewListDNSZonesPager": + res.resp, res.err = w.dispatchNewListDNSZonesPager(req) + case "WorkloadNetworksClient.NewListDhcpPager": + res.resp, res.err = w.dispatchNewListDhcpPager(req) + case "WorkloadNetworksClient.NewListGatewaysPager": + res.resp, res.err = w.dispatchNewListGatewaysPager(req) + case "WorkloadNetworksClient.NewListPortMirroringPager": + res.resp, res.err = w.dispatchNewListPortMirroringPager(req) + case "WorkloadNetworksClient.NewListPublicIPsPager": + res.resp, res.err = w.dispatchNewListPublicIPsPager(req) + case "WorkloadNetworksClient.NewListSegmentsPager": + res.resp, res.err = w.dispatchNewListSegmentsPager(req) + case "WorkloadNetworksClient.NewListVMGroupsPager": + res.resp, res.err = w.dispatchNewListVMGroupsPager(req) + case "WorkloadNetworksClient.NewListVirtualMachinesPager": + res.resp, res.err = w.dispatchNewListVirtualMachinesPager(req) + case "WorkloadNetworksClient.BeginUpdateDNSService": + res.resp, res.err = w.dispatchBeginUpdateDNSService(req) + case "WorkloadNetworksClient.BeginUpdateDNSZone": + res.resp, res.err = w.dispatchBeginUpdateDNSZone(req) + case "WorkloadNetworksClient.BeginUpdateDhcp": + res.resp, res.err = w.dispatchBeginUpdateDhcp(req) + case "WorkloadNetworksClient.BeginUpdatePortMirroring": + res.resp, res.err = w.dispatchBeginUpdatePortMirroring(req) + case "WorkloadNetworksClient.BeginUpdateSegments": + res.resp, res.err = w.dispatchBeginUpdateSegments(req) + case "WorkloadNetworksClient.BeginUpdateVMGroup": + res.resp, res.err = w.dispatchBeginUpdateVMGroup(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 } - - return resp, nil } func (w *WorkloadNetworksServerTransport) dispatchBeginCreateDNSService(req *http.Request) (*http.Response, error) { @@ -2150,3 +2166,9 @@ func (w *WorkloadNetworksServerTransport) dispatchBeginUpdateVMGroup(req *http.R return resp, nil } + +// set this to conditionally intercept incoming requests to WorkloadNetworksServerTransport +var workloadNetworksServerTransportInterceptor 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/avs/armavs/globalreachconnections_client.go b/sdk/resourcemanager/avs/armavs/globalreachconnections_client.go index 5b68e51cbf18..8f8f367b6de6 100644 --- a/sdk/resourcemanager/avs/armavs/globalreachconnections_client.go +++ b/sdk/resourcemanager/avs/armavs/globalreachconnections_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. @@ -97,7 +94,7 @@ func (client *GlobalReachConnectionsClient) createOrUpdate(ctx context.Context, } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *GlobalReachConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, globalReachConnectionName string, globalReachConnection GlobalReachConnection, options *GlobalReachConnectionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *GlobalReachConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, globalReachConnectionName string, globalReachConnection GlobalReachConnection, _ *GlobalReachConnectionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -182,7 +179,7 @@ func (client *GlobalReachConnectionsClient) deleteOperation(ctx context.Context, } // deleteCreateRequest creates the Delete request. -func (client *GlobalReachConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, globalReachConnectionName string, options *GlobalReachConnectionsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *GlobalReachConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, globalReachConnectionName string, _ *GlobalReachConnectionsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -243,7 +240,7 @@ func (client *GlobalReachConnectionsClient) Get(ctx context.Context, resourceGro } // getCreateRequest creates the Get request. -func (client *GlobalReachConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, globalReachConnectionName string, options *GlobalReachConnectionsClientGetOptions) (*policy.Request, error) { +func (client *GlobalReachConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, globalReachConnectionName string, _ *GlobalReachConnectionsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -312,7 +309,7 @@ func (client *GlobalReachConnectionsClient) NewListPager(resourceGroupName strin } // listCreateRequest creates the List request. -func (client *GlobalReachConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, options *GlobalReachConnectionsClientListOptions) (*policy.Request, error) { +func (client *GlobalReachConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, _ *GlobalReachConnectionsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/avs/armavs/globalreachconnections_client_example_test.go b/sdk/resourcemanager/avs/armavs/globalreachconnections_client_example_test.go deleted file mode 100644 index 954237f04815..000000000000 --- a/sdk/resourcemanager/avs/armavs/globalreachconnections_client_example_test.go +++ /dev/null @@ -1,156 +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 armavs_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/avs/armavs/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/GlobalReachConnections_List.json -func ExampleGlobalReachConnectionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGlobalReachConnectionsClient().NewListPager("group1", "cloud1", 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.GlobalReachConnectionList = armavs.GlobalReachConnectionList{ - // Value: []*armavs.GlobalReachConnection{ - // { - // Name: to.Ptr("connection1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/globalReachConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/globalReachConnections/connection1"), - // Properties: &armavs.GlobalReachConnectionProperties{ - // AddressPrefix: to.Ptr("10.2.3.16/29"), - // AuthorizationKey: to.Ptr("01010101-0101-0101-0101-010101010101"), - // CircuitConnectionStatus: to.Ptr(armavs.GlobalReachConnectionStatusConnected), - // ExpressRouteID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2/providers/Microsoft.Network/expressroutecircuits/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2-xconnect"), - // PeerExpressRouteCircuit: to.Ptr("/subscriptions/12341234-1234-1234-1234-123412341234/resourceGroups/mygroup/providers/Microsoft.Network/expressRouteCircuits/mypeer"), - // ProvisioningState: to.Ptr(armavs.GlobalReachConnectionProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/GlobalReachConnections_Get.json -func ExampleGlobalReachConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGlobalReachConnectionsClient().Get(ctx, "group1", "cloud1", "connection1", 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.GlobalReachConnection = armavs.GlobalReachConnection{ - // Name: to.Ptr("connection1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/globalReachConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/globalReachConnections/connection1"), - // Properties: &armavs.GlobalReachConnectionProperties{ - // AddressPrefix: to.Ptr("10.2.3.16/29"), - // AuthorizationKey: to.Ptr("01010101-0101-0101-0101-010101010101"), - // CircuitConnectionStatus: to.Ptr(armavs.GlobalReachConnectionStatusConnected), - // ExpressRouteID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2/providers/Microsoft.Network/expressroutecircuits/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2-xconnect"), - // PeerExpressRouteCircuit: to.Ptr("/subscriptions/12341234-1234-1234-1234-123412341234/resourceGroups/mygroup/providers/Microsoft.Network/expressRouteCircuits/mypeer"), - // ProvisioningState: to.Ptr(armavs.GlobalReachConnectionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/GlobalReachConnections_CreateOrUpdate.json -func ExampleGlobalReachConnectionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGlobalReachConnectionsClient().BeginCreateOrUpdate(ctx, "group1", "cloud1", "connection1", armavs.GlobalReachConnection{ - Properties: &armavs.GlobalReachConnectionProperties{ - AuthorizationKey: to.Ptr("01010101-0101-0101-0101-010101010101"), - PeerExpressRouteCircuit: to.Ptr("/subscriptions/12341234-1234-1234-1234-123412341234/resourceGroups/mygroup/providers/Microsoft.Network/expressRouteCircuits/mypeer"), - }, - }, 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.GlobalReachConnection = armavs.GlobalReachConnection{ - // Name: to.Ptr("connection1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/globalReachConnections"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/globalReachConnections/connection1"), - // Properties: &armavs.GlobalReachConnectionProperties{ - // AddressPrefix: to.Ptr("10.2.3.16/29"), - // AuthorizationKey: to.Ptr("01010101-0101-0101-0101-010101010101"), - // CircuitConnectionStatus: to.Ptr(armavs.GlobalReachConnectionStatusConnected), - // ExpressRouteID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2/providers/Microsoft.Network/expressroutecircuits/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2-xconnect"), - // PeerExpressRouteCircuit: to.Ptr("/subscriptions/12341234-1234-1234-1234-123412341234/resourceGroups/mygroup/providers/Microsoft.Network/expressRouteCircuits/mypeer"), - // ProvisioningState: to.Ptr(armavs.GlobalReachConnectionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/GlobalReachConnections_Delete.json -func ExampleGlobalReachConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGlobalReachConnectionsClient().BeginDelete(ctx, "group1", "cloud1", "connection1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/avs/armavs/go.mod b/sdk/resourcemanager/avs/armavs/go.mod index ff8743526d54..01228701e936 100644 --- a/sdk/resourcemanager/avs/armavs/go.mod +++ b/sdk/resourcemanager/avs/armavs/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/avs/armavs/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 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.2 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.36.0 // indirect golang.org/x/net v0.38.0 // indirect - golang.org/x/sys v0.31.0 // indirect golang.org/x/text v0.23.0 // indirect ) diff --git a/sdk/resourcemanager/avs/armavs/go.sum b/sdk/resourcemanager/avs/armavs/go.sum index 4bacf756f06c..4de695d9e23a 100644 --- a/sdk/resourcemanager/avs/armavs/go.sum +++ b/sdk/resourcemanager/avs/armavs/go.sum @@ -1,44 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 h1:DSDNVxqkoXJiko6x8a90zidoYqnYYa6c1MTzDKzKkTo= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1/go.mod h1:zGqV2R4Cr/k8Uye5w+dgQ06WJtEcbQG/8J7BB6hnCr4= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 h1:F0gBpfdPLGsw+nsgk6aqqkZS1jiixa5WwFe3fk/T3Ys= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2/go.mod h1:SqINnQ9lVVdRlyC8cd1lCI0SdX4n2paeABd2K8ggfnE= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2 h1:yz1bePFlP5Vws5+8ez6T3HWXPmwOK7Yvq8QxDBD3SKY= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2/go.mod h1:Pa9ZNPuoNu/GztvBSKk9J1cDJW6vk/n0zLtV4mgd8N8= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= -github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 h1:oygO0locgZJe7PpYPXT5A29ZkwJaPqcva7BVeemZOZs= -github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= -github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= -github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8= -github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6 h1:IsMZxCuZqKuao2vNdfD82fjjgPLfyHLpR41Z88viRWs= -github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6/go.mod h1:3VeWNIJaW+O5xpRQbPp0Ybqu1vJd/pm7s2F473HRrkw= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E= -github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= -golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= -golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/avs/armavs/hcxenterprisesites_client.go b/sdk/resourcemanager/avs/armavs/hcxenterprisesites_client.go index c9b2f65f304a..f844dc63c940 100644 --- a/sdk/resourcemanager/avs/armavs/hcxenterprisesites_client.go +++ b/sdk/resourcemanager/avs/armavs/hcxenterprisesites_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. @@ -76,7 +73,7 @@ func (client *HcxEnterpriseSitesClient) CreateOrUpdate(ctx context.Context, reso } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *HcxEnterpriseSitesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, hcxEnterpriseSiteName string, hcxEnterpriseSite HcxEnterpriseSite, options *HcxEnterpriseSitesClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *HcxEnterpriseSitesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, hcxEnterpriseSiteName string, hcxEnterpriseSite HcxEnterpriseSite, _ *HcxEnterpriseSitesClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -148,7 +145,7 @@ func (client *HcxEnterpriseSitesClient) Delete(ctx context.Context, resourceGrou } // deleteCreateRequest creates the Delete request. -func (client *HcxEnterpriseSitesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, hcxEnterpriseSiteName string, options *HcxEnterpriseSitesClientDeleteOptions) (*policy.Request, error) { +func (client *HcxEnterpriseSitesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, hcxEnterpriseSiteName string, _ *HcxEnterpriseSitesClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -208,7 +205,7 @@ func (client *HcxEnterpriseSitesClient) Get(ctx context.Context, resourceGroupNa } // getCreateRequest creates the Get request. -func (client *HcxEnterpriseSitesClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, hcxEnterpriseSiteName string, options *HcxEnterpriseSitesClientGetOptions) (*policy.Request, error) { +func (client *HcxEnterpriseSitesClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, hcxEnterpriseSiteName string, _ *HcxEnterpriseSitesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -277,7 +274,7 @@ func (client *HcxEnterpriseSitesClient) NewListPager(resourceGroupName string, p } // listCreateRequest creates the List request. -func (client *HcxEnterpriseSitesClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, options *HcxEnterpriseSitesClientListOptions) (*policy.Request, error) { +func (client *HcxEnterpriseSitesClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, _ *HcxEnterpriseSitesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/avs/armavs/hcxenterprisesites_client_example_test.go b/sdk/resourcemanager/avs/armavs/hcxenterprisesites_client_example_test.go deleted file mode 100644 index 69ae24e0a2a7..000000000000 --- a/sdk/resourcemanager/avs/armavs/hcxenterprisesites_client_example_test.go +++ /dev/null @@ -1,130 +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 armavs_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/avs/armavs/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/HcxEnterpriseSites_List.json -func ExampleHcxEnterpriseSitesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewHcxEnterpriseSitesClient().NewListPager("group1", "cloud1", 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.HcxEnterpriseSiteList = armavs.HcxEnterpriseSiteList{ - // Value: []*armavs.HcxEnterpriseSite{ - // { - // Name: to.Ptr("site1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/hcxEnterpriseSites"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/hcxEnterpriseSites/site1"), - // Properties: &armavs.HcxEnterpriseSiteProperties{ - // ActivationKey: to.Ptr("0276EF1A9A1749A5A362BF73EA9F8D0D"), - // Status: to.Ptr(armavs.HcxEnterpriseSiteStatusAvailable), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/HcxEnterpriseSites_Get.json -func ExampleHcxEnterpriseSitesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewHcxEnterpriseSitesClient().Get(ctx, "group1", "cloud1", "site1", 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.HcxEnterpriseSite = armavs.HcxEnterpriseSite{ - // Name: to.Ptr("site1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/hcxEnterpriseSites"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/hcxEnterpriseSites/site1"), - // Properties: &armavs.HcxEnterpriseSiteProperties{ - // ActivationKey: to.Ptr("0276EF1A9A1749A5A362BF73EA9F8D0D"), - // Status: to.Ptr(armavs.HcxEnterpriseSiteStatusAvailable), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/HcxEnterpriseSites_CreateOrUpdate.json -func ExampleHcxEnterpriseSitesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewHcxEnterpriseSitesClient().CreateOrUpdate(ctx, "group1", "cloud1", "site1", armavs.HcxEnterpriseSite{}, 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.HcxEnterpriseSite = armavs.HcxEnterpriseSite{ - // Name: to.Ptr("site1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/hcxEnterpriseSites"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/hcxEnterpriseSites/site1"), - // Properties: &armavs.HcxEnterpriseSiteProperties{ - // ActivationKey: to.Ptr("0276EF1A9A1749A5A362BF73EA9F8D0D"), - // Status: to.Ptr(armavs.HcxEnterpriseSiteStatusAvailable), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/HcxEnterpriseSites_Delete.json -func ExampleHcxEnterpriseSitesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewHcxEnterpriseSitesClient().Delete(ctx, "group1", "cloud1", "site1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/avs/armavs/interfaces.go b/sdk/resourcemanager/avs/armavs/interfaces.go index 8a304979cdf8..b2a120bf4ca5 100644 --- a/sdk/resourcemanager/avs/armavs/interfaces.go +++ b/sdk/resourcemanager/avs/armavs/interfaces.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. diff --git a/sdk/resourcemanager/avs/armavs/iscsipaths_client.go b/sdk/resourcemanager/avs/armavs/iscsipaths_client.go index a1198005c021..2a95ecd3d922 100644 --- a/sdk/resourcemanager/avs/armavs/iscsipaths_client.go +++ b/sdk/resourcemanager/avs/armavs/iscsipaths_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. @@ -96,7 +93,7 @@ func (client *IscsiPathsClient) createOrUpdate(ctx context.Context, resourceGrou } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *IscsiPathsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, resource IscsiPath, options *IscsiPathsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *IscsiPathsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, resource IscsiPath, _ *IscsiPathsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/iscsiPaths/default" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -175,7 +172,7 @@ func (client *IscsiPathsClient) deleteOperation(ctx context.Context, resourceGro } // deleteCreateRequest creates the Delete request. -func (client *IscsiPathsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, options *IscsiPathsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *IscsiPathsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, _ *IscsiPathsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/iscsiPaths/default" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -230,7 +227,7 @@ func (client *IscsiPathsClient) Get(ctx context.Context, resourceGroupName strin } // getCreateRequest creates the Get request. -func (client *IscsiPathsClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, options *IscsiPathsClientGetOptions) (*policy.Request, error) { +func (client *IscsiPathsClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, _ *IscsiPathsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/iscsiPaths/default" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -295,7 +292,7 @@ func (client *IscsiPathsClient) NewListByPrivateCloudPager(resourceGroupName str } // listByPrivateCloudCreateRequest creates the ListByPrivateCloud request. -func (client *IscsiPathsClient) listByPrivateCloudCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, options *IscsiPathsClientListByPrivateCloudOptions) (*policy.Request, error) { +func (client *IscsiPathsClient) listByPrivateCloudCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, _ *IscsiPathsClientListByPrivateCloudOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/iscsiPaths" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/avs/armavs/iscsipaths_client_example_test.go b/sdk/resourcemanager/avs/armavs/iscsipaths_client_example_test.go deleted file mode 100644 index 851782683ac5..000000000000 --- a/sdk/resourcemanager/avs/armavs/iscsipaths_client_example_test.go +++ /dev/null @@ -1,143 +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 armavs_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/avs/armavs/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/IscsiPaths_List.json -func ExampleIscsiPathsClient_NewListByPrivateCloudPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewIscsiPathsClient().NewListByPrivateCloudPager("group1", "cloud1", 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.IscsiPathListResult = armavs.IscsiPathListResult{ - // Value: []*armavs.IscsiPath{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/iscsiPaths"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/iscsiPaths/default"), - // Properties: &armavs.IscsiPathProperties{ - // NetworkBlock: to.Ptr("192.168.0.0/24"), - // ProvisioningState: to.Ptr(armavs.IscsiPathProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/IscsiPaths_Get.json -func ExampleIscsiPathsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIscsiPathsClient().Get(ctx, "group1", "cloud1", 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.IscsiPath = armavs.IscsiPath{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/iscsiPaths"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/iscsiPaths/default"), - // Properties: &armavs.IscsiPathProperties{ - // NetworkBlock: to.Ptr("192.168.0.0/24"), - // ProvisioningState: to.Ptr(armavs.IscsiPathProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/IscsiPaths_CreateOrUpdate.json -func ExampleIscsiPathsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewIscsiPathsClient().BeginCreateOrUpdate(ctx, "group1", "cloud1", armavs.IscsiPath{ - Properties: &armavs.IscsiPathProperties{ - NetworkBlock: to.Ptr("192.168.0.0/24"), - }, - }, 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.IscsiPath = armavs.IscsiPath{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/iscsiPaths"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/iscsiPaths/default"), - // Properties: &armavs.IscsiPathProperties{ - // NetworkBlock: to.Ptr("192.168.0.0/24"), - // ProvisioningState: to.Ptr(armavs.IscsiPathProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/IscsiPaths_Delete.json -func ExampleIscsiPathsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewIscsiPathsClient().BeginDelete(ctx, "group1", "cloud1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/avs/armavs/locations_client.go b/sdk/resourcemanager/avs/armavs/locations_client.go index 25bd9bc155a1..7a15c73a3044 100644 --- a/sdk/resourcemanager/avs/armavs/locations_client.go +++ b/sdk/resourcemanager/avs/armavs/locations_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. @@ -73,7 +70,7 @@ func (client *LocationsClient) CheckQuotaAvailability(ctx context.Context, locat } // checkQuotaAvailabilityCreateRequest creates the CheckQuotaAvailability request. -func (client *LocationsClient) checkQuotaAvailabilityCreateRequest(ctx context.Context, location string, options *LocationsClientCheckQuotaAvailabilityOptions) (*policy.Request, error) { +func (client *LocationsClient) checkQuotaAvailabilityCreateRequest(ctx context.Context, location string, _ *LocationsClientCheckQuotaAvailabilityOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkQuotaAvailability" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/avs/armavs/locations_client_example_test.go b/sdk/resourcemanager/avs/armavs/locations_client_example_test.go deleted file mode 100644 index a153d338bf9f..000000000000 --- a/sdk/resourcemanager/avs/armavs/locations_client_example_test.go +++ /dev/null @@ -1,97 +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 armavs_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/avs/armavs/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Locations_CheckQuotaAvailability.json -func ExampleLocationsClient_CheckQuotaAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLocationsClient().CheckQuotaAvailability(ctx, "eastus", 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.Quota = armavs.Quota{ - // HostsRemaining: map[string]*int32{ - // "AV20": to.Ptr[int32](0), - // "AV36": to.Ptr[int32](999), - // }, - // QuotaEnabled: to.Ptr(armavs.QuotaEnabledEnabled), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Locations_CheckTrialAvailability.json -func ExampleLocationsClient_CheckTrialAvailability_locationsCheckTrialAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLocationsClient().CheckTrialAvailability(ctx, "eastus", &armavs.LocationsClientCheckTrialAvailabilityOptions{SKU: 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.Trial = armavs.Trial{ - // AvailableHosts: to.Ptr[int32](4), - // Status: to.Ptr(armavs.TrialStatusTrialAvailable), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/Locations_CheckTrialAvailabilityWithSku.json -func ExampleLocationsClient_CheckTrialAvailability_locationsCheckTrialAvailabilityWithSku() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLocationsClient().CheckTrialAvailability(ctx, "eastus", &armavs.LocationsClientCheckTrialAvailabilityOptions{SKU: &armavs.SKU{ - Name: to.Ptr("avs52t"), - }, - }) - 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.Trial = armavs.Trial{ - // AvailableHosts: to.Ptr[int32](4), - // Status: to.Ptr(armavs.TrialStatusTrialAvailable), - // } -} diff --git a/sdk/resourcemanager/avs/armavs/models.go b/sdk/resourcemanager/avs/armavs/models.go index 282525ad5f1b..bff2fbbccd47 100644 --- a/sdk/resourcemanager/avs/armavs/models.go +++ b/sdk/resourcemanager/avs/armavs/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. diff --git a/sdk/resourcemanager/avs/armavs/models_serde.go b/sdk/resourcemanager/avs/armavs/models_serde.go index fa49fff4e089..a070c3d43601 100644 --- a/sdk/resourcemanager/avs/armavs/models_serde.go +++ b/sdk/resourcemanager/avs/armavs/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. diff --git a/sdk/resourcemanager/avs/armavs/operations_client.go b/sdk/resourcemanager/avs/armavs/operations_client.go index b1236ce7d4da..07b85a44f8b9 100644 --- a/sdk/resourcemanager/avs/armavs/operations_client.go +++ b/sdk/resourcemanager/avs/armavs/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. @@ -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.AVS/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { diff --git a/sdk/resourcemanager/avs/armavs/operations_client_example_test.go b/sdk/resourcemanager/avs/armavs/operations_client_example_test.go deleted file mode 100644 index 3f76a8e97c5a..000000000000 --- a/sdk/resourcemanager/avs/armavs/operations_client_example_test.go +++ /dev/null @@ -1,354 +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 armavs_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/avs/armavs/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-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 := armavs.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 = armavs.OperationListResult{ - // Value: []*armavs.Operation{ - // { - // Name: to.Ptr("Microsoft.AVS/operations/read"), - // Display: &armavs.OperationDisplay{ - // Description: to.Ptr("Lists operations available on Microsoft.AVS resource provider."), - // Operation: to.Ptr("List available Microsoft.AVS operations"), - // Provider: to.Ptr("Microsoft.AVS"), - // Resource: to.Ptr("operations"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armavs.OriginUserSystem), - // }, - // { - // Name: to.Ptr("Microsoft.AVS/register/action"), - // Display: &armavs.OperationDisplay{ - // Description: to.Ptr("Register Subscription for Microsoft.AVS resource provider."), - // Operation: to.Ptr("Register Subscription for Microsoft.AVS"), - // Provider: to.Ptr("Microsoft.AVS"), - // Resource: to.Ptr(""), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armavs.OriginUserSystem), - // }, - // { - // Name: to.Ptr("Microsoft.AVS/unregister/action"), - // Display: &armavs.OperationDisplay{ - // Description: to.Ptr("Unregister Subscription for Microsoft.AVS resource provider."), - // Operation: to.Ptr("Unregister Subscription for Microsoft.AVS"), - // Provider: to.Ptr("Microsoft.AVS"), - // Resource: to.Ptr(""), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armavs.OriginUserSystem), - // }, - // { - // Name: to.Ptr("Microsoft.AVS/checkNameAvailability/read"), - // Display: &armavs.OperationDisplay{ - // Description: to.Ptr("Checks if the privateCloud Name is available"), - // Operation: to.Ptr("Check Name Availability"), - // Provider: to.Ptr("Microsoft.AVS"), - // Resource: to.Ptr("checkNameAvailability"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armavs.OriginUserSystem), - // }, - // { - // Name: to.Ptr("Microsoft.AVS/locations/checkNameAvailability/read"), - // Display: &armavs.OperationDisplay{ - // Description: to.Ptr("Checks if the privateCloud Name is available"), - // Operation: to.Ptr("Check Name Availability"), - // Provider: to.Ptr("Microsoft.AVS"), - // Resource: to.Ptr("locations/checkNameAvailability"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armavs.OriginUserSystem), - // }, - // { - // Name: to.Ptr("Microsoft.AVS/locations/checkQuotaAvailability/read"), - // Display: &armavs.OperationDisplay{ - // Description: to.Ptr("Checks if quota is available for the subscription"), - // Operation: to.Ptr("Check Quota Availability"), - // Provider: to.Ptr("Microsoft.AVS"), - // Resource: to.Ptr("locations/checkQuotaAvailability"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armavs.OriginUserSystem), - // }, - // { - // Name: to.Ptr("Microsoft.AVS/locations/checkTrialAvailability/read"), - // Display: &armavs.OperationDisplay{ - // Description: to.Ptr("Checks if trial is available for the subscription"), - // Operation: to.Ptr("Check Trial Availability"), - // Provider: to.Ptr("Microsoft.AVS"), - // Resource: to.Ptr("locations/checkTrialAvailability"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armavs.OriginUserSystem), - // }, - // { - // Name: to.Ptr("Microsoft.AVS/privateClouds/register/action"), - // Display: &armavs.OperationDisplay{ - // Description: to.Ptr("Registers the Microsoft Microsoft.AVS resource provider and enables creation of Private Clouds."), - // Operation: to.Ptr("Register Microsoft.AVS resource provider."), - // Provider: to.Ptr("Microsoft.AVS"), - // Resource: to.Ptr("privateClouds"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armavs.OriginUserSystem), - // }, - // { - // Name: to.Ptr("Microsoft.AVS/privateClouds/write"), - // Display: &armavs.OperationDisplay{ - // Description: to.Ptr("Creates or updates a PrivateCloud resource."), - // Operation: to.Ptr("Create or update a PrivateCloud."), - // Provider: to.Ptr("Microsoft.AVS"), - // Resource: to.Ptr("privateClouds"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armavs.OriginUserSystem), - // }, - // { - // Name: to.Ptr("Microsoft.AVS/privateClouds/read"), - // Display: &armavs.OperationDisplay{ - // Description: to.Ptr("Gets the settings for the specified PrivateCloud."), - // Operation: to.Ptr("Read PrivateCloud settings"), - // Provider: to.Ptr("Microsoft.AVS"), - // Resource: to.Ptr("privateClouds"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armavs.OriginUserSystem), - // }, - // { - // Name: to.Ptr("Microsoft.AVS/privateClouds/delete"), - // Display: &armavs.OperationDisplay{ - // Description: to.Ptr("Delete a specific PrivateCloud."), - // Operation: to.Ptr("Delete a PrivateCloud."), - // Provider: to.Ptr("Microsoft.AVS"), - // Resource: to.Ptr("privateClouds"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armavs.OriginUserSystem), - // }, - // { - // Name: to.Ptr("Microsoft.AVS/privateClouds/operationstatuses/read"), - // Display: &armavs.OperationDisplay{ - // Description: to.Ptr("Reads privateClouds operationstatuses."), - // Operation: to.Ptr("Read privateClouds operationstatuses"), - // Provider: to.Ptr("Microsoft.AVS"), - // Resource: to.Ptr("privateClouds/operationstatuses"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armavs.OriginUserSystem), - // }, - // { - // Name: to.Ptr("Microsoft.AVS/privateClouds/clusters/read"), - // Display: &armavs.OperationDisplay{ - // Description: to.Ptr("Gets the cluster settings for a PrivateCloud cluster."), - // Operation: to.Ptr("Read Cluster settings."), - // Provider: to.Ptr("Microsoft.AVS"), - // Resource: to.Ptr("privateClouds/clusters"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armavs.OriginUserSystem), - // }, - // { - // Name: to.Ptr("Microsoft.AVS/privateClouds/clusters/write"), - // Display: &armavs.OperationDisplay{ - // Description: to.Ptr("Create or update a PrivateCloud cluster resource."), - // Operation: to.Ptr("Create or update a PrivateCloud cluster."), - // Provider: to.Ptr("Microsoft.AVS"), - // Resource: to.Ptr("privateClouds/clusters"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armavs.OriginUserSystem), - // }, - // { - // Name: to.Ptr("Microsoft.AVS/privateClouds/clusters/delete"), - // Display: &armavs.OperationDisplay{ - // Description: to.Ptr("Delete a specific PrivateCloud cluster."), - // Operation: to.Ptr("Delete a PriveCloud cluster."), - // Provider: to.Ptr("Microsoft.AVS"), - // Resource: to.Ptr("privateClouds/clusters"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armavs.OriginUserSystem), - // }, - // { - // Name: to.Ptr("Microsoft.AVS/privateClouds/clusters/operationstatuses/read"), - // Display: &armavs.OperationDisplay{ - // Description: to.Ptr("Reads privateClouds/clusters operationstatuses."), - // Operation: to.Ptr("Read privateClouds/clusters operationstatuses"), - // Provider: to.Ptr("Microsoft.AVS"), - // Resource: to.Ptr("privateClouds/clusters/operationstatuses"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armavs.OriginUserSystem), - // }, - // { - // Name: to.Ptr("Microsoft.AVS/privateclouds/clusters/operationresults/read"), - // Display: &armavs.OperationDisplay{ - // Description: to.Ptr("Reads privateClouds/clusters operationresults."), - // Operation: to.Ptr("Read privateClouds/clusters operationresults"), - // Provider: to.Ptr("Microsoft.AVS"), - // Resource: to.Ptr("privateclouds/clusters/operationresults"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armavs.OriginUserSystem), - // }, - // { - // Name: to.Ptr("Microsoft.AVS/privateClouds/operationresults/read"), - // Display: &armavs.OperationDisplay{ - // Description: to.Ptr("Reads privateClouds operationresults."), - // Operation: to.Ptr("Read privateClouds operationresults"), - // Provider: to.Ptr("Microsoft.AVS"), - // Resource: to.Ptr("privateClouds/operationresults"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armavs.OriginUserSystem), - // }, - // { - // Name: to.Ptr("Microsoft.AVS/privateClouds/authorizations/read"), - // Display: &armavs.OperationDisplay{ - // Description: to.Ptr("Gets the authorization settings for a PrivateCloud cluster."), - // Operation: to.Ptr("Read Authorization settings."), - // Provider: to.Ptr("Microsoft.AVS"), - // Resource: to.Ptr("privateClouds/authorizations"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armavs.OriginUserSystem), - // }, - // { - // Name: to.Ptr("Microsoft.AVS/privateClouds/authorizations/write"), - // Display: &armavs.OperationDisplay{ - // Description: to.Ptr("Create or update a PrivateCloud authorization resource."), - // Operation: to.Ptr("Create or update a PrivateCloud authorization."), - // Provider: to.Ptr("Microsoft.AVS"), - // Resource: to.Ptr("privateClouds/authorizations"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armavs.OriginUserSystem), - // }, - // { - // Name: to.Ptr("Microsoft.AVS/privateClouds/authorizations/delete"), - // Display: &armavs.OperationDisplay{ - // Description: to.Ptr("Delete a specific PrivateCloud authorization."), - // Operation: to.Ptr("Delete a PriveCloud authorization."), - // Provider: to.Ptr("Microsoft.AVS"), - // Resource: to.Ptr("privateClouds/authorizations"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armavs.OriginUserSystem), - // }, - // { - // Name: to.Ptr("Microsoft.AVS/privateClouds/listAdminCredentials/action"), - // Display: &armavs.OperationDisplay{ - // Description: to.Ptr("Lists the AdminCredentials for privateClouds."), - // Operation: to.Ptr("List privateClouds AdminCredentials"), - // Provider: to.Ptr("Microsoft.AVS"), - // Resource: to.Ptr("privateClouds"), - // }, - // IsDataAction: to.Ptr(true), - // Origin: to.Ptr(armavs.OriginUserSystem), - // }, - // { - // Name: to.Ptr("Microsoft.AVS/privateClouds/hcxEnterpriseSites/read"), - // Display: &armavs.OperationDisplay{ - // Description: to.Ptr("Gets the hcxEnterpriseSites for a PrivateCloud."), - // Operation: to.Ptr("Read hcxEnterpriseSites"), - // Provider: to.Ptr("Microsoft.AVS"), - // Resource: to.Ptr("privateClouds/hcxEnterpriseSites"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armavs.OriginUserSystem), - // }, - // { - // Name: to.Ptr("Microsoft.AVS/privateClouds/hcxEnterpriseSites/write"), - // Display: &armavs.OperationDisplay{ - // Description: to.Ptr("Create or update a hcxEnterpriseSites."), - // Operation: to.Ptr("Create or update a hcxEnterpriseSites"), - // Provider: to.Ptr("Microsoft.AVS"), - // Resource: to.Ptr("privateClouds/hcxEnterpriseSites"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armavs.OriginUserSystem), - // }, - // { - // Name: to.Ptr("Microsoft.AVS/privateClouds/hcxEnterpriseSites/delete"), - // Display: &armavs.OperationDisplay{ - // Description: to.Ptr("Delete a specific hcxEnterpriseSites."), - // Operation: to.Ptr("Delete a hcxEnterpriseSites"), - // Provider: to.Ptr("Microsoft.AVS"), - // Resource: to.Ptr("privateClouds/hcxEnterpriseSites"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armavs.OriginUserSystem), - // }, - // { - // Name: to.Ptr("Microsoft.AVS/privateClouds/hostInstances/read"), - // Display: &armavs.OperationDisplay{ - // Description: to.Ptr("Gets the hostInstances for a PrivateCloud."), - // Operation: to.Ptr("Read hostInstances"), - // Provider: to.Ptr("Microsoft.AVS"), - // Resource: to.Ptr("privateClouds/hostInstances"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armavs.OriginUserSystem), - // }, - // { - // Name: to.Ptr("Microsoft.AVS/privateClouds/hostInstances/write"), - // Display: &armavs.OperationDisplay{ - // Description: to.Ptr("Create or update a hostInstances."), - // Operation: to.Ptr("Create or update a hostInstances"), - // Provider: to.Ptr("Microsoft.AVS"), - // Resource: to.Ptr("privateClouds/hostInstances"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armavs.OriginUserSystem), - // }, - // { - // Name: to.Ptr("Microsoft.AVS/privateClouds/hostInstances/delete"), - // Display: &armavs.OperationDisplay{ - // Description: to.Ptr("Delete a specific hostInstances."), - // Operation: to.Ptr("Delete a hostInstances"), - // Provider: to.Ptr("Microsoft.AVS"), - // Resource: to.Ptr("privateClouds/hostInstances"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armavs.OriginUserSystem), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/avs/armavs/options.go b/sdk/resourcemanager/avs/armavs/options.go index 143dd111845d..1fb7d9d6c404 100644 --- a/sdk/resourcemanager/avs/armavs/options.go +++ b/sdk/resourcemanager/avs/armavs/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. @@ -10,13 +7,13 @@ package armavs // AddonsClientBeginCreateOrUpdateOptions contains the optional parameters for the AddonsClient.BeginCreateOrUpdate method. type AddonsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // AddonsClientBeginDeleteOptions contains the optional parameters for the AddonsClient.BeginDelete method. type AddonsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -33,13 +30,13 @@ type AddonsClientListOptions struct { // AuthorizationsClientBeginCreateOrUpdateOptions contains the optional parameters for the AuthorizationsClient.BeginCreateOrUpdate // method. type AuthorizationsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // AuthorizationsClientBeginDeleteOptions contains the optional parameters for the AuthorizationsClient.BeginDelete method. type AuthorizationsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -56,13 +53,13 @@ type AuthorizationsClientListOptions struct { // CloudLinksClientBeginCreateOrUpdateOptions contains the optional parameters for the CloudLinksClient.BeginCreateOrUpdate // method. type CloudLinksClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // CloudLinksClientBeginDeleteOptions contains the optional parameters for the CloudLinksClient.BeginDelete method. type CloudLinksClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -78,19 +75,19 @@ type CloudLinksClientListOptions struct { // ClustersClientBeginCreateOrUpdateOptions contains the optional parameters for the ClustersClient.BeginCreateOrUpdate method. type ClustersClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ClustersClientBeginDeleteOptions contains the optional parameters for the ClustersClient.BeginDelete method. type ClustersClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ClustersClientBeginUpdateOptions contains the optional parameters for the ClustersClient.BeginUpdate method. type ClustersClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -112,13 +109,13 @@ type ClustersClientListZonesOptions struct { // DatastoresClientBeginCreateOrUpdateOptions contains the optional parameters for the DatastoresClient.BeginCreateOrUpdate // method. type DatastoresClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // DatastoresClientBeginDeleteOptions contains the optional parameters for the DatastoresClient.BeginDelete method. type DatastoresClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -135,14 +132,14 @@ type DatastoresClientListOptions struct { // GlobalReachConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the GlobalReachConnectionsClient.BeginCreateOrUpdate // method. type GlobalReachConnectionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // GlobalReachConnectionsClientBeginDeleteOptions contains the optional parameters for the GlobalReachConnectionsClient.BeginDelete // method. type GlobalReachConnectionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -181,13 +178,13 @@ type HcxEnterpriseSitesClientListOptions struct { // IscsiPathsClientBeginCreateOrUpdateOptions contains the optional parameters for the IscsiPathsClient.BeginCreateOrUpdate // method. type IscsiPathsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // IscsiPathsClientBeginDeleteOptions contains the optional parameters for the IscsiPathsClient.BeginDelete method. type IscsiPathsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -223,21 +220,21 @@ type OperationsClientListOptions struct { // PlacementPoliciesClientBeginCreateOrUpdateOptions contains the optional parameters for the PlacementPoliciesClient.BeginCreateOrUpdate // method. type PlacementPoliciesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // PlacementPoliciesClientBeginDeleteOptions contains the optional parameters for the PlacementPoliciesClient.BeginDelete // method. type PlacementPoliciesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // PlacementPoliciesClientBeginUpdateOptions contains the optional parameters for the PlacementPoliciesClient.BeginUpdate // method. type PlacementPoliciesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -254,33 +251,33 @@ type PlacementPoliciesClientListOptions struct { // PrivateCloudsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateCloudsClient.BeginCreateOrUpdate // method. type PrivateCloudsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // PrivateCloudsClientBeginDeleteOptions contains the optional parameters for the PrivateCloudsClient.BeginDelete method. type PrivateCloudsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // PrivateCloudsClientBeginRotateNsxtPasswordOptions contains the optional parameters for the PrivateCloudsClient.BeginRotateNsxtPassword // method. type PrivateCloudsClientBeginRotateNsxtPasswordOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // PrivateCloudsClientBeginRotateVcenterPasswordOptions contains the optional parameters for the PrivateCloudsClient.BeginRotateVcenterPassword // method. type PrivateCloudsClientBeginRotateVcenterPasswordOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // PrivateCloudsClientBeginUpdateOptions contains the optional parameters for the PrivateCloudsClient.BeginUpdate method. type PrivateCloudsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -319,13 +316,13 @@ type ScriptCmdletsClientListOptions struct { // ScriptExecutionsClientBeginCreateOrUpdateOptions contains the optional parameters for the ScriptExecutionsClient.BeginCreateOrUpdate // method. type ScriptExecutionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ScriptExecutionsClientBeginDeleteOptions contains the optional parameters for the ScriptExecutionsClient.BeginDelete method. type ScriptExecutionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -359,7 +356,7 @@ type ScriptPackagesClientListOptions struct { // VirtualMachinesClientBeginRestrictMovementOptions contains the optional parameters for the VirtualMachinesClient.BeginRestrictMovement // method. type VirtualMachinesClientBeginRestrictMovementOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -376,140 +373,140 @@ type VirtualMachinesClientListOptions struct { // WorkloadNetworksClientBeginCreateDNSServiceOptions contains the optional parameters for the WorkloadNetworksClient.BeginCreateDNSService // method. type WorkloadNetworksClientBeginCreateDNSServiceOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // WorkloadNetworksClientBeginCreateDNSZoneOptions contains the optional parameters for the WorkloadNetworksClient.BeginCreateDNSZone // method. type WorkloadNetworksClientBeginCreateDNSZoneOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // WorkloadNetworksClientBeginCreateDhcpOptions contains the optional parameters for the WorkloadNetworksClient.BeginCreateDhcp // method. type WorkloadNetworksClientBeginCreateDhcpOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // WorkloadNetworksClientBeginCreatePortMirroringOptions contains the optional parameters for the WorkloadNetworksClient.BeginCreatePortMirroring // method. type WorkloadNetworksClientBeginCreatePortMirroringOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // WorkloadNetworksClientBeginCreatePublicIPOptions contains the optional parameters for the WorkloadNetworksClient.BeginCreatePublicIP // method. type WorkloadNetworksClientBeginCreatePublicIPOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // WorkloadNetworksClientBeginCreateSegmentsOptions contains the optional parameters for the WorkloadNetworksClient.BeginCreateSegments // method. type WorkloadNetworksClientBeginCreateSegmentsOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // WorkloadNetworksClientBeginCreateVMGroupOptions contains the optional parameters for the WorkloadNetworksClient.BeginCreateVMGroup // method. type WorkloadNetworksClientBeginCreateVMGroupOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // WorkloadNetworksClientBeginDeleteDNSServiceOptions contains the optional parameters for the WorkloadNetworksClient.BeginDeleteDNSService // method. type WorkloadNetworksClientBeginDeleteDNSServiceOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // WorkloadNetworksClientBeginDeleteDNSZoneOptions contains the optional parameters for the WorkloadNetworksClient.BeginDeleteDNSZone // method. type WorkloadNetworksClientBeginDeleteDNSZoneOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // WorkloadNetworksClientBeginDeleteDhcpOptions contains the optional parameters for the WorkloadNetworksClient.BeginDeleteDhcp // method. type WorkloadNetworksClientBeginDeleteDhcpOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // WorkloadNetworksClientBeginDeletePortMirroringOptions contains the optional parameters for the WorkloadNetworksClient.BeginDeletePortMirroring // method. type WorkloadNetworksClientBeginDeletePortMirroringOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // WorkloadNetworksClientBeginDeletePublicIPOptions contains the optional parameters for the WorkloadNetworksClient.BeginDeletePublicIP // method. type WorkloadNetworksClientBeginDeletePublicIPOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // WorkloadNetworksClientBeginDeleteSegmentOptions contains the optional parameters for the WorkloadNetworksClient.BeginDeleteSegment // method. type WorkloadNetworksClientBeginDeleteSegmentOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // WorkloadNetworksClientBeginDeleteVMGroupOptions contains the optional parameters for the WorkloadNetworksClient.BeginDeleteVMGroup // method. type WorkloadNetworksClientBeginDeleteVMGroupOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // WorkloadNetworksClientBeginUpdateDNSServiceOptions contains the optional parameters for the WorkloadNetworksClient.BeginUpdateDNSService // method. type WorkloadNetworksClientBeginUpdateDNSServiceOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // WorkloadNetworksClientBeginUpdateDNSZoneOptions contains the optional parameters for the WorkloadNetworksClient.BeginUpdateDNSZone // method. type WorkloadNetworksClientBeginUpdateDNSZoneOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // WorkloadNetworksClientBeginUpdateDhcpOptions contains the optional parameters for the WorkloadNetworksClient.BeginUpdateDhcp // method. type WorkloadNetworksClientBeginUpdateDhcpOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // WorkloadNetworksClientBeginUpdatePortMirroringOptions contains the optional parameters for the WorkloadNetworksClient.BeginUpdatePortMirroring // method. type WorkloadNetworksClientBeginUpdatePortMirroringOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // WorkloadNetworksClientBeginUpdateSegmentsOptions contains the optional parameters for the WorkloadNetworksClient.BeginUpdateSegments // method. type WorkloadNetworksClientBeginUpdateSegmentsOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // WorkloadNetworksClientBeginUpdateVMGroupOptions contains the optional parameters for the WorkloadNetworksClient.BeginUpdateVMGroup // method. type WorkloadNetworksClientBeginUpdateVMGroupOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } diff --git a/sdk/resourcemanager/avs/armavs/placementpolicies_client.go b/sdk/resourcemanager/avs/armavs/placementpolicies_client.go index 0571e23a951d..dc9a2d7a52b3 100644 --- a/sdk/resourcemanager/avs/armavs/placementpolicies_client.go +++ b/sdk/resourcemanager/avs/armavs/placementpolicies_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. @@ -98,7 +95,7 @@ func (client *PlacementPoliciesClient) createOrUpdate(ctx context.Context, resou } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *PlacementPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, placementPolicyName string, placementPolicy PlacementPolicy, options *PlacementPoliciesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *PlacementPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, placementPolicyName string, placementPolicy PlacementPolicy, _ *PlacementPoliciesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -188,7 +185,7 @@ func (client *PlacementPoliciesClient) deleteOperation(ctx context.Context, reso } // deleteCreateRequest creates the Delete request. -func (client *PlacementPoliciesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, placementPolicyName string, options *PlacementPoliciesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *PlacementPoliciesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, placementPolicyName string, _ *PlacementPoliciesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -253,7 +250,7 @@ func (client *PlacementPoliciesClient) Get(ctx context.Context, resourceGroupNam } // getCreateRequest creates the Get request. -func (client *PlacementPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, placementPolicyName string, options *PlacementPoliciesClientGetOptions) (*policy.Request, error) { +func (client *PlacementPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, placementPolicyName string, _ *PlacementPoliciesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -327,7 +324,7 @@ func (client *PlacementPoliciesClient) NewListPager(resourceGroupName string, pr } // listCreateRequest creates the List request. -func (client *PlacementPoliciesClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, options *PlacementPoliciesClientListOptions) (*policy.Request, error) { +func (client *PlacementPoliciesClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, _ *PlacementPoliciesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -420,7 +417,7 @@ func (client *PlacementPoliciesClient) update(ctx context.Context, resourceGroup } // updateCreateRequest creates the Update request. -func (client *PlacementPoliciesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, placementPolicyName string, placementPolicyUpdate PlacementPolicyUpdate, options *PlacementPoliciesClientBeginUpdateOptions) (*policy.Request, error) { +func (client *PlacementPoliciesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, placementPolicyName string, placementPolicyUpdate PlacementPolicyUpdate, _ *PlacementPoliciesClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/avs/armavs/placementpolicies_client_example_test.go b/sdk/resourcemanager/avs/armavs/placementpolicies_client_example_test.go deleted file mode 100644 index 60fd3c0e2c41..000000000000 --- a/sdk/resourcemanager/avs/armavs/placementpolicies_client_example_test.go +++ /dev/null @@ -1,262 +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 armavs_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/avs/armavs/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PlacementPolicies_List.json -func ExamplePlacementPoliciesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPlacementPoliciesClient().NewListPager("group1", "cloud1", "cluster1", 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.PlacementPoliciesList = armavs.PlacementPoliciesList{ - // Value: []*armavs.PlacementPolicy{ - // { - // Name: to.Ptr("policy1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/clusters/placementPolicies"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/placementPolicies/policy1"), - // Properties: &armavs.VMHostPlacementPolicyProperties{ - // Type: to.Ptr(armavs.PlacementPolicyTypeVMHost), - // DisplayName: to.Ptr("policy1"), - // ProvisioningState: to.Ptr(armavs.PlacementPolicyProvisioningStateSucceeded), - // State: to.Ptr(armavs.PlacementPolicyStateEnabled), - // AffinityStrength: to.Ptr(armavs.AffinityStrengthMust), - // AffinityType: to.Ptr(armavs.AffinityTypeAntiAffinity), - // AzureHybridBenefitType: to.Ptr(armavs.AzureHybridBenefitTypeSQLHost), - // HostMembers: []*string{ - // to.Ptr("fakehost22.nyc1.kubernetes.center"), - // to.Ptr("fakehost23.nyc1.kubernetes.center"), - // to.Ptr("fakehost24.nyc1.kubernetes.center")}, - // VMMembers: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/virtualMachines/vm-128"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/virtualMachines/vm-256")}, - // }, - // }, - // { - // Name: to.Ptr("policy2"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/clusters/placementPolicies"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/placementPolicies/policy2"), - // Properties: &armavs.VMPlacementPolicyProperties{ - // Type: to.Ptr(armavs.PlacementPolicyTypeVMVM), - // DisplayName: to.Ptr("policy2"), - // ProvisioningState: to.Ptr(armavs.PlacementPolicyProvisioningStateSucceeded), - // State: to.Ptr(armavs.PlacementPolicyStateEnabled), - // AffinityType: to.Ptr(armavs.AffinityTypeAffinity), - // VMMembers: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/virtualMachines/vm-128"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/virtualMachines/vm-256")}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PlacementPolicies_Get.json -func ExamplePlacementPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPlacementPoliciesClient().Get(ctx, "group1", "cloud1", "cluster1", "policy1", 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.PlacementPolicy = armavs.PlacementPolicy{ - // Name: to.Ptr("policy1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/clusters/placementPolicies"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/placementPolicies/policy1"), - // Properties: &armavs.VMHostPlacementPolicyProperties{ - // Type: to.Ptr(armavs.PlacementPolicyTypeVMHost), - // DisplayName: to.Ptr("policy1"), - // ProvisioningState: to.Ptr(armavs.PlacementPolicyProvisioningStateSucceeded), - // State: to.Ptr(armavs.PlacementPolicyStateEnabled), - // AffinityStrength: to.Ptr(armavs.AffinityStrengthMust), - // AffinityType: to.Ptr(armavs.AffinityTypeAntiAffinity), - // AzureHybridBenefitType: to.Ptr(armavs.AzureHybridBenefitTypeSQLHost), - // HostMembers: []*string{ - // to.Ptr("fakehost22.nyc1.kubernetes.center"), - // to.Ptr("fakehost23.nyc1.kubernetes.center"), - // to.Ptr("fakehost24.nyc1.kubernetes.center")}, - // VMMembers: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/virtualMachines/vm-128"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/virtualMachines/vm-256")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PlacementPolicies_CreateOrUpdate.json -func ExamplePlacementPoliciesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPlacementPoliciesClient().BeginCreateOrUpdate(ctx, "group1", "cloud1", "cluster1", "policy1", armavs.PlacementPolicy{ - Properties: &armavs.VMHostPlacementPolicyProperties{ - Type: to.Ptr(armavs.PlacementPolicyTypeVMHost), - AffinityStrength: to.Ptr(armavs.AffinityStrengthMust), - AffinityType: to.Ptr(armavs.AffinityTypeAntiAffinity), - AzureHybridBenefitType: to.Ptr(armavs.AzureHybridBenefitTypeSQLHost), - HostMembers: []*string{ - to.Ptr("fakehost22.nyc1.kubernetes.center"), - to.Ptr("fakehost23.nyc1.kubernetes.center"), - to.Ptr("fakehost24.nyc1.kubernetes.center")}, - VMMembers: []*string{ - to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/virtualMachines/vm-128"), - to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/virtualMachines/vm-256")}, - }, - }, 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.PlacementPolicy = armavs.PlacementPolicy{ - // Name: to.Ptr("policy1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/clusters/placementPolicies"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/placementPolicies/policy1"), - // Properties: &armavs.VMHostPlacementPolicyProperties{ - // Type: to.Ptr(armavs.PlacementPolicyTypeVMHost), - // DisplayName: to.Ptr("policy1"), - // ProvisioningState: to.Ptr(armavs.PlacementPolicyProvisioningStateSucceeded), - // State: to.Ptr(armavs.PlacementPolicyStateEnabled), - // AffinityStrength: to.Ptr(armavs.AffinityStrengthMust), - // AffinityType: to.Ptr(armavs.AffinityTypeAntiAffinity), - // AzureHybridBenefitType: to.Ptr(armavs.AzureHybridBenefitTypeSQLHost), - // HostMembers: []*string{ - // to.Ptr("fakehost22.nyc1.kubernetes.center"), - // to.Ptr("fakehost23.nyc1.kubernetes.center"), - // to.Ptr("fakehost24.nyc1.kubernetes.center")}, - // VMMembers: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/virtualMachines/vm-128"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/virtualMachines/vm-256")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PlacementPolicies_Update.json -func ExamplePlacementPoliciesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPlacementPoliciesClient().BeginUpdate(ctx, "group1", "cloud1", "cluster1", "policy1", armavs.PlacementPolicyUpdate{ - Properties: &armavs.PlacementPolicyUpdateProperties{ - AffinityStrength: to.Ptr(armavs.AffinityStrengthMust), - AzureHybridBenefitType: to.Ptr(armavs.AzureHybridBenefitTypeSQLHost), - HostMembers: []*string{ - to.Ptr("fakehost22.nyc1.kubernetes.center"), - to.Ptr("fakehost23.nyc1.kubernetes.center"), - to.Ptr("fakehost24.nyc1.kubernetes.center")}, - State: to.Ptr(armavs.PlacementPolicyStateDisabled), - VMMembers: []*string{ - to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/virtualMachines/vm-128"), - to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/virtualMachines/vm-256")}, - }, - }, 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.PlacementPolicy = armavs.PlacementPolicy{ - // Name: to.Ptr("policy1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/clusters/placementPolicies"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/placementPolicies/policy1"), - // Properties: &armavs.VMHostPlacementPolicyProperties{ - // Type: to.Ptr(armavs.PlacementPolicyTypeVMHost), - // DisplayName: to.Ptr("policy1"), - // ProvisioningState: to.Ptr(armavs.PlacementPolicyProvisioningStateSucceeded), - // State: to.Ptr(armavs.PlacementPolicyStateDisabled), - // AffinityStrength: to.Ptr(armavs.AffinityStrengthMust), - // AffinityType: to.Ptr(armavs.AffinityTypeAntiAffinity), - // AzureHybridBenefitType: to.Ptr(armavs.AzureHybridBenefitTypeSQLHost), - // HostMembers: []*string{ - // to.Ptr("fakehost22.nyc1.kubernetes.center"), - // to.Ptr("fakehost23.nyc1.kubernetes.center"), - // to.Ptr("fakehost24.nyc1.kubernetes.center")}, - // VMMembers: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/virtualMachines/vm-128"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/virtualMachines/vm-256")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PlacementPolicies_Delete.json -func ExamplePlacementPoliciesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPlacementPoliciesClient().BeginDelete(ctx, "group1", "cloud1", "cluster1", "policy1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/avs/armavs/polymorphic_helpers.go b/sdk/resourcemanager/avs/armavs/polymorphic_helpers.go index de10530fa253..cc43db20145e 100644 --- a/sdk/resourcemanager/avs/armavs/polymorphic_helpers.go +++ b/sdk/resourcemanager/avs/armavs/polymorphic_helpers.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. diff --git a/sdk/resourcemanager/avs/armavs/privateclouds_client.go b/sdk/resourcemanager/avs/armavs/privateclouds_client.go index 5a67feeb08f2..4930d378fd1d 100644 --- a/sdk/resourcemanager/avs/armavs/privateclouds_client.go +++ b/sdk/resourcemanager/avs/armavs/privateclouds_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. @@ -96,7 +93,7 @@ func (client *PrivateCloudsClient) createOrUpdate(ctx context.Context, resourceG } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *PrivateCloudsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, privateCloud PrivateCloud, options *PrivateCloudsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *PrivateCloudsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, privateCloud PrivateCloud, _ *PrivateCloudsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -176,7 +173,7 @@ func (client *PrivateCloudsClient) deleteOperation(ctx context.Context, resource } // deleteCreateRequest creates the Delete request. -func (client *PrivateCloudsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, options *PrivateCloudsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *PrivateCloudsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, _ *PrivateCloudsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -231,7 +228,7 @@ func (client *PrivateCloudsClient) Get(ctx context.Context, resourceGroupName st } // getCreateRequest creates the Get request. -func (client *PrivateCloudsClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, options *PrivateCloudsClientGetOptions) (*policy.Request, error) { +func (client *PrivateCloudsClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, _ *PrivateCloudsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -294,7 +291,7 @@ func (client *PrivateCloudsClient) NewListPager(resourceGroupName string, option } // listCreateRequest creates the List request. -func (client *PrivateCloudsClient) listCreateRequest(ctx context.Context, resourceGroupName string, options *PrivateCloudsClientListOptions) (*policy.Request, error) { +func (client *PrivateCloudsClient) listCreateRequest(ctx context.Context, resourceGroupName string, _ *PrivateCloudsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -355,7 +352,7 @@ func (client *PrivateCloudsClient) ListAdminCredentials(ctx context.Context, res } // listAdminCredentialsCreateRequest creates the ListAdminCredentials request. -func (client *PrivateCloudsClient) listAdminCredentialsCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, options *PrivateCloudsClientListAdminCredentialsOptions) (*policy.Request, error) { +func (client *PrivateCloudsClient) listAdminCredentialsCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, _ *PrivateCloudsClientListAdminCredentialsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/listAdminCredentials" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -418,7 +415,7 @@ func (client *PrivateCloudsClient) NewListInSubscriptionPager(options *PrivateCl } // listInSubscriptionCreateRequest creates the ListInSubscription request. -func (client *PrivateCloudsClient) listInSubscriptionCreateRequest(ctx context.Context, options *PrivateCloudsClientListInSubscriptionOptions) (*policy.Request, error) { +func (client *PrivateCloudsClient) listInSubscriptionCreateRequest(ctx context.Context, _ *PrivateCloudsClientListInSubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.AVS/privateClouds" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -496,7 +493,7 @@ func (client *PrivateCloudsClient) rotateNsxtPassword(ctx context.Context, resou } // rotateNsxtPasswordCreateRequest creates the RotateNsxtPassword request. -func (client *PrivateCloudsClient) rotateNsxtPasswordCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, options *PrivateCloudsClientBeginRotateNsxtPasswordOptions) (*policy.Request, error) { +func (client *PrivateCloudsClient) rotateNsxtPasswordCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, _ *PrivateCloudsClientBeginRotateNsxtPasswordOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateNsxtPassword" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -573,7 +570,7 @@ func (client *PrivateCloudsClient) rotateVcenterPassword(ctx context.Context, re } // rotateVcenterPasswordCreateRequest creates the RotateVcenterPassword request. -func (client *PrivateCloudsClient) rotateVcenterPasswordCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, options *PrivateCloudsClientBeginRotateVcenterPasswordOptions) (*policy.Request, error) { +func (client *PrivateCloudsClient) rotateVcenterPasswordCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, _ *PrivateCloudsClientBeginRotateVcenterPasswordOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateVcenterPassword" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -651,7 +648,7 @@ func (client *PrivateCloudsClient) update(ctx context.Context, resourceGroupName } // updateCreateRequest creates the Update request. -func (client *PrivateCloudsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, privateCloudUpdate PrivateCloudUpdate, options *PrivateCloudsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *PrivateCloudsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, privateCloudUpdate PrivateCloudUpdate, _ *PrivateCloudsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/avs/armavs/privateclouds_client_example_test.go b/sdk/resourcemanager/avs/armavs/privateclouds_client_example_test.go deleted file mode 100644 index 80b2ebea3744..000000000000 --- a/sdk/resourcemanager/avs/armavs/privateclouds_client_example_test.go +++ /dev/null @@ -1,1019 +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 armavs_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/avs/armavs/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PrivateClouds_ListInSubscription.json -func ExamplePrivateCloudsClient_NewListInSubscriptionPager_privateCloudsListInSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateCloudsClient().NewListInSubscriptionPager(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.PrivateCloudList = armavs.PrivateCloudList{ - // Value: []*armavs.PrivateCloud{ - // { - // Name: to.Ptr("cloud1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1"), - // Location: to.Ptr("eastus2"), - // Tags: map[string]*string{ - // }, - // Properties: &armavs.PrivateCloudProperties{ - // Availability: &armavs.AvailabilityProperties{ - // Strategy: to.Ptr(armavs.AvailabilityStrategySingleZone), - // Zone: to.Ptr[int32](1), - // }, - // Circuit: &armavs.Circuit{ - // ExpressRouteID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2/providers/Microsoft.Network/expressroutecircuits/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2-xconnect"), - // ExpressRoutePrivatePeeringID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt42-cust-p01-dmo01/providers/Microsoft.Network/expressroutecircuits/tnt42-cust-p01-dmo01-er/peerings/AzurePrivatePeering"), - // PrimarySubnet: to.Ptr("192.168.53.0/30"), - // SecondarySubnet: to.Ptr("192.168.53.4/30"), - // }, - // Endpoints: &armavs.Endpoints{ - // HcxCloudManager: to.Ptr("https://hcx.290351365f5b41a19b77af.eastus.avslab.azure.com/"), - // HcxCloudManagerIP: to.Ptr("192.168.50.4"), - // NsxtManager: to.Ptr("https://nsx.290351365f5b41a19b77af.eastus.avslab.azure.com/"), - // NsxtManagerIP: to.Ptr("192.168.50.3"), - // VcenterIP: to.Ptr("192.168.50.2"), - // Vcsa: to.Ptr("https://vc.290351365f5b41a19b77af.eastus.avslab.azure.com/"), - // }, - // IdentitySources: []*armavs.IdentitySource{ - // { - // Name: to.Ptr("group1"), - // Alias: to.Ptr("groupAlias"), - // BaseGroupDN: to.Ptr("ou=baseGroup"), - // BaseUserDN: to.Ptr("ou=baseUser"), - // Domain: to.Ptr("domain1"), - // PrimaryServer: to.Ptr("ldaps://1.1.1.1:636/"), - // SecondaryServer: to.Ptr("ldaps://1.1.1.2:636/"), - // SSL: to.Ptr(armavs.SSLEnumEnabled), - // }}, - // Internet: to.Ptr(armavs.InternetEnumDisabled), - // ManagementCluster: &armavs.ManagementCluster{ - // ClusterID: to.Ptr[int32](1), - // ClusterSize: to.Ptr[int32](4), - // Hosts: []*string{ - // to.Ptr("fakehost18.nyc1.kubernetes.center"), - // to.Ptr("fakehost19.nyc1.kubernetes.center"), - // to.Ptr("fakehost20.nyc1.kubernetes.center"), - // to.Ptr("fakehost21.nyc1.kubernetes.center")}, - // }, - // NetworkBlock: to.Ptr("192.168.48.0/22"), - // ProvisioningState: to.Ptr(armavs.PrivateCloudProvisioningStateSucceeded), - // }, - // SKU: &armavs.SKU{ - // Name: to.Ptr("AV36"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PrivateClouds_ListInSubscription_Stretched.json -func ExamplePrivateCloudsClient_NewListInSubscriptionPager_privateCloudsListInSubscriptionStretched() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateCloudsClient().NewListInSubscriptionPager(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.PrivateCloudList = armavs.PrivateCloudList{ - // Value: []*armavs.PrivateCloud{ - // { - // Name: to.Ptr("cloud1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1"), - // Location: to.Ptr("eastus2"), - // Tags: map[string]*string{ - // }, - // Properties: &armavs.PrivateCloudProperties{ - // Availability: &armavs.AvailabilityProperties{ - // SecondaryZone: to.Ptr[int32](2), - // Strategy: to.Ptr(armavs.AvailabilityStrategyDualZone), - // Zone: to.Ptr[int32](1), - // }, - // Circuit: &armavs.Circuit{ - // ExpressRouteID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2/providers/Microsoft.Network/expressroutecircuits/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2-xconnect"), - // ExpressRoutePrivatePeeringID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt42-cust-p01-dmo01/providers/Microsoft.Network/expressroutecircuits/tnt42-cust-p01-dmo01-er/peerings/AzurePrivatePeering"), - // PrimarySubnet: to.Ptr("192.168.53.0/30"), - // SecondarySubnet: to.Ptr("192.168.53.4/30"), - // }, - // Endpoints: &armavs.Endpoints{ - // HcxCloudManager: to.Ptr("https://hcx.290351365f5b41a19b77af.eastus.avslab.azure.com/"), - // HcxCloudManagerIP: to.Ptr("192.168.50.4"), - // NsxtManager: to.Ptr("https://nsx.290351365f5b41a19b77af.eastus.avslab.azure.com/"), - // NsxtManagerIP: to.Ptr("192.168.50.3"), - // VcenterIP: to.Ptr("192.168.50.2"), - // Vcsa: to.Ptr("https://vc.290351365f5b41a19b77af.eastus.avslab.azure.com/"), - // }, - // IdentitySources: []*armavs.IdentitySource{ - // { - // Name: to.Ptr("group1"), - // Alias: to.Ptr("groupAlias"), - // BaseGroupDN: to.Ptr("ou=baseGroup"), - // BaseUserDN: to.Ptr("ou=baseUser"), - // Domain: to.Ptr("domain1"), - // PrimaryServer: to.Ptr("ldaps://1.1.1.1:636/"), - // SecondaryServer: to.Ptr("ldaps://1.1.1.2:636/"), - // SSL: to.Ptr(armavs.SSLEnumEnabled), - // }}, - // Internet: to.Ptr(armavs.InternetEnumDisabled), - // ManagementCluster: &armavs.ManagementCluster{ - // ClusterID: to.Ptr[int32](1), - // ClusterSize: to.Ptr[int32](4), - // Hosts: []*string{ - // to.Ptr("fakehost18.nyc1.kubernetes.center"), - // to.Ptr("fakehost19.nyc1.kubernetes.center"), - // to.Ptr("fakehost20.nyc1.kubernetes.center"), - // to.Ptr("fakehost21.nyc1.kubernetes.center")}, - // }, - // NetworkBlock: to.Ptr("192.168.48.0/22"), - // ProvisioningState: to.Ptr(armavs.PrivateCloudProvisioningStateSucceeded), - // SecondaryCircuit: &armavs.Circuit{ - // ExpressRouteID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2/providers/Microsoft.Network/expressroutecircuits/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2-xconnect2"), - // ExpressRoutePrivatePeeringID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt42-cust-p01-dmo01/providers/Microsoft.Network/expressroutecircuits/tnt42-cust-p01-dmo01-er2/peerings/AzurePrivatePeering"), - // PrimarySubnet: to.Ptr("192.168.53.0/30"), - // SecondarySubnet: to.Ptr("192.168.53.4/30"), - // }, - // }, - // SKU: &armavs.SKU{ - // Name: to.Ptr("AV36"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PrivateClouds_List.json -func ExamplePrivateCloudsClient_NewListPager_privateCloudsList() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateCloudsClient().NewListPager("group1", 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.PrivateCloudList = armavs.PrivateCloudList{ - // Value: []*armavs.PrivateCloud{ - // { - // Name: to.Ptr("cloud1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1"), - // Location: to.Ptr("eastus2"), - // Tags: map[string]*string{ - // }, - // Properties: &armavs.PrivateCloudProperties{ - // Availability: &armavs.AvailabilityProperties{ - // Strategy: to.Ptr(armavs.AvailabilityStrategySingleZone), - // Zone: to.Ptr[int32](1), - // }, - // Circuit: &armavs.Circuit{ - // ExpressRouteID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2/providers/Microsoft.Network/expressroutecircuits/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2-xconnect"), - // ExpressRoutePrivatePeeringID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt42-cust-p01-dmo01/providers/Microsoft.Network/expressroutecircuits/tnt42-cust-p01-dmo01-er/peerings/AzurePrivatePeering"), - // PrimarySubnet: to.Ptr("192.168.53.0/30"), - // SecondarySubnet: to.Ptr("192.168.53.4/30"), - // }, - // Endpoints: &armavs.Endpoints{ - // HcxCloudManager: to.Ptr("https://hcx.290351365f5b41a19b77af.eastus.avslab.azure.com/"), - // HcxCloudManagerIP: to.Ptr("192.168.50.4"), - // NsxtManager: to.Ptr("https://nsx.290351365f5b41a19b77af.eastus.avslab.azure.com/"), - // NsxtManagerIP: to.Ptr("192.168.50.3"), - // VcenterIP: to.Ptr("192.168.50.2"), - // Vcsa: to.Ptr("https://vc.290351365f5b41a19b77af.eastus.avslab.azure.com/"), - // }, - // ExternalCloudLinks: []*string{ - // to.Ptr("/subscriptions/12341234-1234-1234-1234-123412341234/resourceGroups/mygroup/providers/Microsoft.AVS/privateClouds/cloud2")}, - // IdentitySources: []*armavs.IdentitySource{ - // { - // Name: to.Ptr("group1"), - // Alias: to.Ptr("groupAlias"), - // BaseGroupDN: to.Ptr("ou=baseGroup"), - // BaseUserDN: to.Ptr("ou=baseUser"), - // Domain: to.Ptr("domain1"), - // PrimaryServer: to.Ptr("ldaps://1.1.1.1:636/"), - // SecondaryServer: to.Ptr("ldaps://1.1.1.2:636/"), - // SSL: to.Ptr(armavs.SSLEnumEnabled), - // }}, - // Internet: to.Ptr(armavs.InternetEnumDisabled), - // ManagementCluster: &armavs.ManagementCluster{ - // ClusterID: to.Ptr[int32](1), - // ClusterSize: to.Ptr[int32](4), - // Hosts: []*string{ - // to.Ptr("fakehost18.nyc1.kubernetes.center"), - // to.Ptr("fakehost19.nyc1.kubernetes.center"), - // to.Ptr("fakehost20.nyc1.kubernetes.center"), - // to.Ptr("fakehost21.nyc1.kubernetes.center")}, - // }, - // NetworkBlock: to.Ptr("192.168.48.0/22"), - // ProvisioningState: to.Ptr(armavs.PrivateCloudProvisioningStateSucceeded), - // }, - // SKU: &armavs.SKU{ - // Name: to.Ptr("AV36"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PrivateClouds_List_Stretched.json -func ExamplePrivateCloudsClient_NewListPager_privateCloudsListStretched() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateCloudsClient().NewListPager("group1", 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.PrivateCloudList = armavs.PrivateCloudList{ - // Value: []*armavs.PrivateCloud{ - // { - // Name: to.Ptr("cloud1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1"), - // Location: to.Ptr("eastus2"), - // Tags: map[string]*string{ - // }, - // Properties: &armavs.PrivateCloudProperties{ - // Availability: &armavs.AvailabilityProperties{ - // SecondaryZone: to.Ptr[int32](2), - // Strategy: to.Ptr(armavs.AvailabilityStrategyDualZone), - // Zone: to.Ptr[int32](1), - // }, - // Circuit: &armavs.Circuit{ - // ExpressRouteID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2/providers/Microsoft.Network/expressroutecircuits/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2-xconnect"), - // ExpressRoutePrivatePeeringID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt42-cust-p01-dmo01/providers/Microsoft.Network/expressroutecircuits/tnt42-cust-p01-dmo01-er/peerings/AzurePrivatePeering"), - // PrimarySubnet: to.Ptr("192.168.53.0/30"), - // SecondarySubnet: to.Ptr("192.168.53.4/30"), - // }, - // Endpoints: &armavs.Endpoints{ - // HcxCloudManager: to.Ptr("https://hcx.290351365f5b41a19b77af.eastus.avslab.azure.com/"), - // HcxCloudManagerIP: to.Ptr("192.168.50.4"), - // NsxtManager: to.Ptr("https://nsx.290351365f5b41a19b77af.eastus.avslab.azure.com/"), - // NsxtManagerIP: to.Ptr("192.168.50.3"), - // VcenterIP: to.Ptr("192.168.50.2"), - // Vcsa: to.Ptr("https://vc.290351365f5b41a19b77af.eastus.avslab.azure.com/"), - // }, - // ExternalCloudLinks: []*string{ - // to.Ptr("/subscriptions/12341234-1234-1234-1234-123412341234/resourceGroups/mygroup/providers/Microsoft.AVS/privateClouds/cloud2")}, - // IdentitySources: []*armavs.IdentitySource{ - // { - // Name: to.Ptr("group1"), - // Alias: to.Ptr("groupAlias"), - // BaseGroupDN: to.Ptr("ou=baseGroup"), - // BaseUserDN: to.Ptr("ou=baseUser"), - // Domain: to.Ptr("domain1"), - // PrimaryServer: to.Ptr("ldaps://1.1.1.1:636/"), - // SecondaryServer: to.Ptr("ldaps://1.1.1.2:636/"), - // SSL: to.Ptr(armavs.SSLEnumEnabled), - // }}, - // Internet: to.Ptr(armavs.InternetEnumDisabled), - // ManagementCluster: &armavs.ManagementCluster{ - // ClusterID: to.Ptr[int32](1), - // ClusterSize: to.Ptr[int32](4), - // Hosts: []*string{ - // to.Ptr("fakehost18.nyc1.kubernetes.center"), - // to.Ptr("fakehost19.nyc1.kubernetes.center"), - // to.Ptr("fakehost20.nyc1.kubernetes.center"), - // to.Ptr("fakehost21.nyc1.kubernetes.center")}, - // }, - // NetworkBlock: to.Ptr("192.168.48.0/22"), - // ProvisioningState: to.Ptr(armavs.PrivateCloudProvisioningStateSucceeded), - // SecondaryCircuit: &armavs.Circuit{ - // ExpressRouteID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2/providers/Microsoft.Network/expressroutecircuits/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2-xconnect2"), - // ExpressRoutePrivatePeeringID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt42-cust-p01-dmo01/providers/Microsoft.Network/expressroutecircuits/tnt42-cust-p01-dmo01-er2/peerings/AzurePrivatePeering"), - // PrimarySubnet: to.Ptr("192.168.53.0/30"), - // SecondarySubnet: to.Ptr("192.168.53.4/30"), - // }, - // }, - // SKU: &armavs.SKU{ - // Name: to.Ptr("AV36"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PrivateClouds_Get.json -func ExamplePrivateCloudsClient_Get_privateCloudsGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateCloudsClient().Get(ctx, "group1", "cloud1", 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.PrivateCloud = armavs.PrivateCloud{ - // Name: to.Ptr("cloud1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1"), - // Location: to.Ptr("eastus2"), - // Tags: map[string]*string{ - // }, - // Identity: &armavs.PrivateCloudIdentity{ - // Type: to.Ptr(armavs.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("881e5573-063f-49e4-8c08-79d7df0169d8"), - // TenantID: to.Ptr("881e5573-063f-49e4-8c08-79d7df0169d8"), - // }, - // Properties: &armavs.PrivateCloudProperties{ - // Availability: &armavs.AvailabilityProperties{ - // Strategy: to.Ptr(armavs.AvailabilityStrategySingleZone), - // Zone: to.Ptr[int32](1), - // }, - // Circuit: &armavs.Circuit{ - // ExpressRouteID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2/providers/Microsoft.Network/expressroutecircuits/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2-xconnect"), - // ExpressRoutePrivatePeeringID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt42-cust-p01-dmo01/providers/Microsoft.Network/expressroutecircuits/tnt42-cust-p01-dmo01-er/peerings/AzurePrivatePeering"), - // PrimarySubnet: to.Ptr("192.168.53.0/30"), - // SecondarySubnet: to.Ptr("192.168.53.4/30"), - // }, - // Encryption: &armavs.Encryption{ - // KeyVaultProperties: &armavs.EncryptionKeyVaultProperties{ - // KeyName: to.Ptr("keyname1"), - // KeyState: to.Ptr(armavs.EncryptionKeyStatusConnected), - // KeyVaultURL: to.Ptr("https://keyvault1-kmip-kvault.vault.azure.net/"), - // KeyVersion: to.Ptr("ver1.0"), - // VersionType: to.Ptr(armavs.EncryptionVersionTypeFixed), - // }, - // Status: to.Ptr(armavs.EncryptionStateEnabled), - // }, - // Endpoints: &armavs.Endpoints{ - // HcxCloudManager: to.Ptr("https://hcx.290351365f5b41a19b77af.eastus.avslab.azure.com/"), - // HcxCloudManagerIP: to.Ptr("192.168.50.4"), - // NsxtManager: to.Ptr("https://nsx.290351365f5b41a19b77af.eastus.avslab.azure.com/"), - // NsxtManagerIP: to.Ptr("192.168.50.3"), - // VcenterIP: to.Ptr("192.168.50.2"), - // Vcsa: to.Ptr("https://vc.290351365f5b41a19b77af.eastus.avslab.azure.com/"), - // }, - // ExternalCloudLinks: []*string{ - // to.Ptr("/subscriptions/12341234-1234-1234-1234-123412341234/resourceGroups/mygroup/providers/Microsoft.AVS/privateClouds/cloud2")}, - // IdentitySources: []*armavs.IdentitySource{ - // { - // Name: to.Ptr("group1"), - // Alias: to.Ptr("groupAlias"), - // BaseGroupDN: to.Ptr("ou=baseGroup"), - // BaseUserDN: to.Ptr("ou=baseUser"), - // Domain: to.Ptr("domain1"), - // PrimaryServer: to.Ptr("ldaps://1.1.1.1:636/"), - // SecondaryServer: to.Ptr("ldaps://1.1.1.2:636/"), - // SSL: to.Ptr(armavs.SSLEnumEnabled), - // }}, - // Internet: to.Ptr(armavs.InternetEnumDisabled), - // ManagementCluster: &armavs.ManagementCluster{ - // ClusterID: to.Ptr[int32](1), - // ClusterSize: to.Ptr[int32](4), - // Hosts: []*string{ - // to.Ptr("fakehost18.nyc1.kubernetes.center"), - // to.Ptr("fakehost19.nyc1.kubernetes.center"), - // to.Ptr("fakehost20.nyc1.kubernetes.center"), - // to.Ptr("fakehost21.nyc1.kubernetes.center")}, - // }, - // NetworkBlock: to.Ptr("192.168.48.0/22"), - // ProvisioningState: to.Ptr(armavs.PrivateCloudProvisioningStateSucceeded), - // }, - // SKU: &armavs.SKU{ - // Name: to.Ptr("AV36"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PrivateClouds_Get_Stretched.json -func ExamplePrivateCloudsClient_Get_privateCloudsGetStretched() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateCloudsClient().Get(ctx, "group1", "cloud1", 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.PrivateCloud = armavs.PrivateCloud{ - // Name: to.Ptr("cloud1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1"), - // Location: to.Ptr("eastus2"), - // Tags: map[string]*string{ - // }, - // Properties: &armavs.PrivateCloudProperties{ - // Availability: &armavs.AvailabilityProperties{ - // SecondaryZone: to.Ptr[int32](2), - // Strategy: to.Ptr(armavs.AvailabilityStrategyDualZone), - // Zone: to.Ptr[int32](1), - // }, - // Circuit: &armavs.Circuit{ - // ExpressRouteID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2/providers/Microsoft.Network/expressroutecircuits/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2-xconnect"), - // ExpressRoutePrivatePeeringID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt42-cust-p01-dmo01/providers/Microsoft.Network/expressroutecircuits/tnt42-cust-p01-dmo01-er/peerings/AzurePrivatePeering"), - // PrimarySubnet: to.Ptr("192.168.53.0/30"), - // SecondarySubnet: to.Ptr("192.168.53.4/30"), - // }, - // Endpoints: &armavs.Endpoints{ - // HcxCloudManager: to.Ptr("https://hcx.290351365f5b41a19b77af.eastus.avslab.azure.com/"), - // HcxCloudManagerIP: to.Ptr("192.168.50.4"), - // NsxtManager: to.Ptr("https://nsx.290351365f5b41a19b77af.eastus.avslab.azure.com/"), - // NsxtManagerIP: to.Ptr("192.168.50.3"), - // VcenterIP: to.Ptr("192.168.50.2"), - // Vcsa: to.Ptr("https://vc.290351365f5b41a19b77af.eastus.avslab.azure.com/"), - // }, - // ExternalCloudLinks: []*string{ - // to.Ptr("/subscriptions/12341234-1234-1234-1234-123412341234/resourceGroups/mygroup/providers/Microsoft.AVS/privateClouds/cloud2")}, - // IdentitySources: []*armavs.IdentitySource{ - // { - // Name: to.Ptr("group1"), - // Alias: to.Ptr("groupAlias"), - // BaseGroupDN: to.Ptr("ou=baseGroup"), - // BaseUserDN: to.Ptr("ou=baseUser"), - // Domain: to.Ptr("domain1"), - // PrimaryServer: to.Ptr("ldaps://1.1.1.1:636/"), - // SecondaryServer: to.Ptr("ldaps://1.1.1.2:636/"), - // SSL: to.Ptr(armavs.SSLEnumEnabled), - // }}, - // Internet: to.Ptr(armavs.InternetEnumDisabled), - // ManagementCluster: &armavs.ManagementCluster{ - // ClusterID: to.Ptr[int32](1), - // ClusterSize: to.Ptr[int32](4), - // Hosts: []*string{ - // to.Ptr("fakehost18.nyc1.kubernetes.center"), - // to.Ptr("fakehost19.nyc1.kubernetes.center"), - // to.Ptr("fakehost20.nyc1.kubernetes.center"), - // to.Ptr("fakehost21.nyc1.kubernetes.center")}, - // }, - // NetworkBlock: to.Ptr("192.168.48.0/22"), - // ProvisioningState: to.Ptr(armavs.PrivateCloudProvisioningStateSucceeded), - // SecondaryCircuit: &armavs.Circuit{ - // ExpressRouteID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2/providers/Microsoft.Network/expressroutecircuits/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2-xconnect"), - // ExpressRoutePrivatePeeringID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt42-cust-p01-dmo01/providers/Microsoft.Network/expressroutecircuits/tnt42-cust-p01-dmo01-er2/peerings/AzurePrivatePeering"), - // PrimarySubnet: to.Ptr("192.168.53.0/30"), - // SecondarySubnet: to.Ptr("192.168.53.4/30"), - // }, - // }, - // SKU: &armavs.SKU{ - // Name: to.Ptr("AV36"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PrivateClouds_CreateOrUpdate.json -func ExamplePrivateCloudsClient_BeginCreateOrUpdate_privateCloudsCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateCloudsClient().BeginCreateOrUpdate(ctx, "group1", "cloud1", armavs.PrivateCloud{ - Location: to.Ptr("eastus2"), - Tags: map[string]*string{}, - Identity: &armavs.PrivateCloudIdentity{ - Type: to.Ptr(armavs.ResourceIdentityTypeSystemAssigned), - }, - Properties: &armavs.PrivateCloudProperties{ - ManagementCluster: &armavs.ManagementCluster{ - ClusterSize: to.Ptr[int32](4), - }, - NetworkBlock: to.Ptr("192.168.48.0/22"), - }, - SKU: &armavs.SKU{ - Name: to.Ptr("AV36"), - }, - }, 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.PrivateCloud = armavs.PrivateCloud{ - // Name: to.Ptr("cloud1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1"), - // Location: to.Ptr("eastus2"), - // Tags: map[string]*string{ - // }, - // Properties: &armavs.PrivateCloudProperties{ - // Availability: &armavs.AvailabilityProperties{ - // Strategy: to.Ptr(armavs.AvailabilityStrategySingleZone), - // Zone: to.Ptr[int32](1), - // }, - // Circuit: &armavs.Circuit{ - // ExpressRouteID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2/providers/Microsoft.Network/expressroutecircuits/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2-xconnect"), - // PrimarySubnet: to.Ptr("192.168.53.0/30"), - // SecondarySubnet: to.Ptr("192.168.53.4/30"), - // }, - // Endpoints: &armavs.Endpoints{ - // NsxtManager: to.Ptr("https://192.168.50.3/"), - // Vcsa: to.Ptr("https://192.168.50.2/"), - // }, - // ExternalCloudLinks: []*string{ - // to.Ptr("/subscriptions/12341234-1234-1234-1234-123412341234/resourceGroups/mygroup/providers/Microsoft.AVS/privateClouds/cloud2")}, - // IdentitySources: []*armavs.IdentitySource{ - // { - // Name: to.Ptr("group1"), - // Alias: to.Ptr("groupAlias"), - // BaseGroupDN: to.Ptr("ou=baseGroup"), - // BaseUserDN: to.Ptr("ou=baseUser"), - // Domain: to.Ptr("domain1"), - // PrimaryServer: to.Ptr("ldaps://1.1.1.1:636/"), - // SecondaryServer: to.Ptr("ldaps://1.1.1.2:636/"), - // SSL: to.Ptr(armavs.SSLEnumEnabled), - // }}, - // Internet: to.Ptr(armavs.InternetEnumDisabled), - // ManagementCluster: &armavs.ManagementCluster{ - // ClusterID: to.Ptr[int32](1), - // ClusterSize: to.Ptr[int32](4), - // Hosts: []*string{ - // to.Ptr("fakehost18.nyc1.kubernetes.center"), - // to.Ptr("fakehost19.nyc1.kubernetes.center"), - // to.Ptr("fakehost20.nyc1.kubernetes.center"), - // to.Ptr("fakehost21.nyc1.kubernetes.center")}, - // }, - // NetworkBlock: to.Ptr("192.168.48.0/22"), - // ProvisioningState: to.Ptr(armavs.PrivateCloudProvisioningStateSucceeded), - // }, - // SKU: &armavs.SKU{ - // Name: to.Ptr("AV36"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PrivateClouds_CreateOrUpdate_Stretched.json -func ExamplePrivateCloudsClient_BeginCreateOrUpdate_privateCloudsCreateOrUpdateStretched() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateCloudsClient().BeginCreateOrUpdate(ctx, "group1", "cloud1", armavs.PrivateCloud{ - Location: to.Ptr("eastus2"), - Tags: map[string]*string{}, - Properties: &armavs.PrivateCloudProperties{ - Availability: &armavs.AvailabilityProperties{ - SecondaryZone: to.Ptr[int32](2), - Strategy: to.Ptr(armavs.AvailabilityStrategyDualZone), - Zone: to.Ptr[int32](1), - }, - ManagementCluster: &armavs.ManagementCluster{ - ClusterSize: to.Ptr[int32](4), - }, - NetworkBlock: to.Ptr("192.168.48.0/22"), - }, - SKU: &armavs.SKU{ - Name: to.Ptr("AV36"), - }, - }, 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.PrivateCloud = armavs.PrivateCloud{ - // Name: to.Ptr("cloud1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1"), - // Location: to.Ptr("eastus2"), - // Tags: map[string]*string{ - // }, - // Properties: &armavs.PrivateCloudProperties{ - // Availability: &armavs.AvailabilityProperties{ - // SecondaryZone: to.Ptr[int32](2), - // Strategy: to.Ptr(armavs.AvailabilityStrategyDualZone), - // Zone: to.Ptr[int32](1), - // }, - // Circuit: &armavs.Circuit{ - // ExpressRouteID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2/providers/Microsoft.Network/expressroutecircuits/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2-xconnect"), - // PrimarySubnet: to.Ptr("192.168.53.0/30"), - // SecondarySubnet: to.Ptr("192.168.53.4/30"), - // }, - // Endpoints: &armavs.Endpoints{ - // HcxCloudManager: to.Ptr("https://hcx.290351365f5b41a19b77af.eastus.avslab.azure.com/"), - // HcxCloudManagerIP: to.Ptr("192.168.50.4"), - // NsxtManager: to.Ptr("https://nsx.290351365f5b41a19b77af.eastus.avslab.azure.com/"), - // NsxtManagerIP: to.Ptr("192.168.50.3"), - // VcenterIP: to.Ptr("192.168.50.2"), - // Vcsa: to.Ptr("https://vc.290351365f5b41a19b77af.eastus.avslab.azure.com/"), - // }, - // ExternalCloudLinks: []*string{ - // to.Ptr("/subscriptions/12341234-1234-1234-1234-123412341234/resourceGroups/mygroup/providers/Microsoft.AVS/privateClouds/cloud2")}, - // IdentitySources: []*armavs.IdentitySource{ - // { - // Name: to.Ptr("group1"), - // Alias: to.Ptr("groupAlias"), - // BaseGroupDN: to.Ptr("ou=baseGroup"), - // BaseUserDN: to.Ptr("ou=baseUser"), - // Domain: to.Ptr("domain1"), - // PrimaryServer: to.Ptr("ldaps://1.1.1.1:636/"), - // SecondaryServer: to.Ptr("ldaps://1.1.1.2:636/"), - // SSL: to.Ptr(armavs.SSLEnumEnabled), - // }}, - // Internet: to.Ptr(armavs.InternetEnumDisabled), - // ManagementCluster: &armavs.ManagementCluster{ - // ClusterID: to.Ptr[int32](1), - // ClusterSize: to.Ptr[int32](4), - // Hosts: []*string{ - // to.Ptr("fakehost18.nyc1.kubernetes.center"), - // to.Ptr("fakehost19.nyc1.kubernetes.center"), - // to.Ptr("fakehost20.nyc1.kubernetes.center"), - // to.Ptr("fakehost21.nyc1.kubernetes.center")}, - // }, - // NetworkBlock: to.Ptr("192.168.48.0/22"), - // ProvisioningState: to.Ptr(armavs.PrivateCloudProvisioningStateSucceeded), - // SecondaryCircuit: &armavs.Circuit{ - // ExpressRouteID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2/providers/Microsoft.Network/expressroutecircuits/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2-xconnect2"), - // PrimarySubnet: to.Ptr("192.168.53.0/30"), - // SecondarySubnet: to.Ptr("192.168.53.4/30"), - // }, - // }, - // SKU: &armavs.SKU{ - // Name: to.Ptr("AV36"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PrivateClouds_Update.json -func ExamplePrivateCloudsClient_BeginUpdate_privateCloudsUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateCloudsClient().BeginUpdate(ctx, "group1", "cloud1", armavs.PrivateCloudUpdate{ - Identity: &armavs.PrivateCloudIdentity{ - Type: to.Ptr(armavs.ResourceIdentityTypeNone), - }, - Properties: &armavs.PrivateCloudUpdateProperties{ - Encryption: &armavs.Encryption{ - KeyVaultProperties: &armavs.EncryptionKeyVaultProperties{ - KeyName: to.Ptr("keyname1"), - KeyVaultURL: to.Ptr("https://keyvault1-kmip-kvault.vault.azure.net/"), - KeyVersion: to.Ptr("ver1.0"), - }, - Status: to.Ptr(armavs.EncryptionStateEnabled), - }, - ManagementCluster: &armavs.ManagementCluster{ - ClusterSize: to.Ptr[int32](4), - }, - }, - }, 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.PrivateCloud = armavs.PrivateCloud{ - // Name: to.Ptr("cloud1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1"), - // Location: to.Ptr("eastus2"), - // Tags: map[string]*string{ - // }, - // Properties: &armavs.PrivateCloudProperties{ - // Availability: &armavs.AvailabilityProperties{ - // Strategy: to.Ptr(armavs.AvailabilityStrategySingleZone), - // Zone: to.Ptr[int32](1), - // }, - // Circuit: &armavs.Circuit{ - // ExpressRouteID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2/providers/Microsoft.Network/expressroutecircuits/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2-xconnect"), - // ExpressRoutePrivatePeeringID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt42-cust-p01-dmo01/providers/Microsoft.Network/expressroutecircuits/tnt42-cust-p01-dmo01-er/peerings/AzurePrivatePeering"), - // PrimarySubnet: to.Ptr("192.168.53.0/30"), - // SecondarySubnet: to.Ptr("192.168.53.4/30"), - // }, - // Encryption: &armavs.Encryption{ - // KeyVaultProperties: &armavs.EncryptionKeyVaultProperties{ - // KeyName: to.Ptr("keyname1"), - // KeyVaultURL: to.Ptr("https://keyvault1-kmip-kvault.vault.azure.net/"), - // KeyVersion: to.Ptr("ver1.0"), - // VersionType: to.Ptr(armavs.EncryptionVersionTypeFixed), - // }, - // Status: to.Ptr(armavs.EncryptionStateEnabled), - // }, - // Endpoints: &armavs.Endpoints{ - // HcxCloudManager: to.Ptr("https://hcx.290351365f5b41a19b77af.eastus.avslab.azure.com/"), - // HcxCloudManagerIP: to.Ptr("192.168.50.4"), - // NsxtManager: to.Ptr("https://nsx.290351365f5b41a19b77af.eastus.avslab.azure.com/"), - // NsxtManagerIP: to.Ptr("192.168.50.3"), - // VcenterIP: to.Ptr("192.168.50.2"), - // Vcsa: to.Ptr("https://vc.290351365f5b41a19b77af.eastus.avslab.azure.com/"), - // }, - // ExternalCloudLinks: []*string{ - // to.Ptr("/subscriptions/12341234-1234-1234-1234-123412341234/resourceGroups/mygroup/providers/Microsoft.AVS/privateClouds/cloud2")}, - // IdentitySources: []*armavs.IdentitySource{ - // { - // Name: to.Ptr("group1"), - // Alias: to.Ptr("groupAlias"), - // BaseGroupDN: to.Ptr("ou=baseGroup"), - // BaseUserDN: to.Ptr("ou=baseUser"), - // Domain: to.Ptr("domain1"), - // PrimaryServer: to.Ptr("ldaps://1.1.1.1:636/"), - // SecondaryServer: to.Ptr("ldaps://1.1.1.2:636/"), - // SSL: to.Ptr(armavs.SSLEnumEnabled), - // }}, - // Internet: to.Ptr(armavs.InternetEnumDisabled), - // ManagementCluster: &armavs.ManagementCluster{ - // ClusterID: to.Ptr[int32](1), - // ClusterSize: to.Ptr[int32](4), - // Hosts: []*string{ - // to.Ptr("fakehost18.nyc1.kubernetes.center"), - // to.Ptr("fakehost19.nyc1.kubernetes.center"), - // to.Ptr("fakehost20.nyc1.kubernetes.center"), - // to.Ptr("fakehost21.nyc1.kubernetes.center")}, - // }, - // NetworkBlock: to.Ptr("192.168.48.0/22"), - // ProvisioningState: to.Ptr(armavs.PrivateCloudProvisioningStateSucceeded), - // }, - // SKU: &armavs.SKU{ - // Name: to.Ptr("AV36"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PrivateClouds_Update_Stretched.json -func ExamplePrivateCloudsClient_BeginUpdate_privateCloudsUpdateStretched() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateCloudsClient().BeginUpdate(ctx, "group1", "cloud1", armavs.PrivateCloudUpdate{ - Properties: &armavs.PrivateCloudUpdateProperties{ - ManagementCluster: &armavs.ManagementCluster{ - ClusterSize: to.Ptr[int32](4), - }, - }, - }, 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.PrivateCloud = armavs.PrivateCloud{ - // Name: to.Ptr("cloud1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1"), - // Location: to.Ptr("eastus2"), - // Tags: map[string]*string{ - // }, - // Properties: &armavs.PrivateCloudProperties{ - // Availability: &armavs.AvailabilityProperties{ - // SecondaryZone: to.Ptr[int32](2), - // Strategy: to.Ptr(armavs.AvailabilityStrategyDualZone), - // Zone: to.Ptr[int32](1), - // }, - // Circuit: &armavs.Circuit{ - // ExpressRouteID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2/providers/Microsoft.Network/expressroutecircuits/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2-xconnect"), - // ExpressRoutePrivatePeeringID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt42-cust-p01-dmo01/providers/Microsoft.Network/expressroutecircuits/tnt42-cust-p01-dmo01-er/peerings/AzurePrivatePeering"), - // PrimarySubnet: to.Ptr("192.168.53.0/30"), - // SecondarySubnet: to.Ptr("192.168.53.4/30"), - // }, - // Endpoints: &armavs.Endpoints{ - // HcxCloudManager: to.Ptr("https://hcx.290351365f5b41a19b77af.eastus.avslab.azure.com/"), - // HcxCloudManagerIP: to.Ptr("192.168.50.4"), - // NsxtManager: to.Ptr("https://nsx.290351365f5b41a19b77af.eastus.avslab.azure.com/"), - // NsxtManagerIP: to.Ptr("192.168.50.3"), - // VcenterIP: to.Ptr("192.168.50.2"), - // Vcsa: to.Ptr("https://vc.290351365f5b41a19b77af.eastus.avslab.azure.com/"), - // }, - // ExternalCloudLinks: []*string{ - // to.Ptr("/subscriptions/12341234-1234-1234-1234-123412341234/resourceGroups/mygroup/providers/Microsoft.AVS/privateClouds/cloud2")}, - // IdentitySources: []*armavs.IdentitySource{ - // { - // Name: to.Ptr("group1"), - // Alias: to.Ptr("groupAlias"), - // BaseGroupDN: to.Ptr("ou=baseGroup"), - // BaseUserDN: to.Ptr("ou=baseUser"), - // Domain: to.Ptr("domain1"), - // PrimaryServer: to.Ptr("ldaps://1.1.1.1:636/"), - // SecondaryServer: to.Ptr("ldaps://1.1.1.2:636/"), - // SSL: to.Ptr(armavs.SSLEnumEnabled), - // }}, - // Internet: to.Ptr(armavs.InternetEnumDisabled), - // ManagementCluster: &armavs.ManagementCluster{ - // ClusterID: to.Ptr[int32](1), - // ClusterSize: to.Ptr[int32](4), - // Hosts: []*string{ - // to.Ptr("fakehost18.nyc1.kubernetes.center"), - // to.Ptr("fakehost19.nyc1.kubernetes.center"), - // to.Ptr("fakehost20.nyc1.kubernetes.center"), - // to.Ptr("fakehost21.nyc1.kubernetes.center")}, - // }, - // NetworkBlock: to.Ptr("192.168.48.0/22"), - // ProvisioningState: to.Ptr(armavs.PrivateCloudProvisioningStateSucceeded), - // SecondaryCircuit: &armavs.Circuit{ - // ExpressRouteID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2/providers/Microsoft.Network/expressroutecircuits/tnt13-41a90db2-9d5e-4bd5-a77a-5ce7b58213d6-eastus2-xconnect2"), - // ExpressRoutePrivatePeeringID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/tnt42-cust-p01-dmo01/providers/Microsoft.Network/expressroutecircuits/tnt42-cust-p01-dmo01-er2/peerings/AzurePrivatePeering"), - // PrimarySubnet: to.Ptr("192.168.53.0/30"), - // SecondarySubnet: to.Ptr("192.168.53.4/30"), - // }, - // }, - // SKU: &armavs.SKU{ - // Name: to.Ptr("AV36"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PrivateClouds_Delete.json -func ExamplePrivateCloudsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateCloudsClient().BeginDelete(ctx, "group1", "cloud1", 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/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PrivateClouds_ListAdminCredentials.json -func ExamplePrivateCloudsClient_ListAdminCredentials() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateCloudsClient().ListAdminCredentials(ctx, "group1", "cloud1", 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.AdminCredentials = armavs.AdminCredentials{ - // NsxtPassword: to.Ptr("$(1X4Dkk"), - // NsxtUsername: to.Ptr("admin"), - // VcenterPassword: to.Ptr(""), - // VcenterUsername: to.Ptr("cloudadmin@vsphere.local"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PrivateClouds_RotateNsxtPassword.json -func ExamplePrivateCloudsClient_BeginRotateNsxtPassword() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateCloudsClient().BeginRotateNsxtPassword(ctx, "group1", "cloud1", 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/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/PrivateClouds_RotateVcenterPassword.json -func ExamplePrivateCloudsClient_BeginRotateVcenterPassword() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateCloudsClient().BeginRotateVcenterPassword(ctx, "group1", "cloud1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/avs/armavs/responses.go b/sdk/resourcemanager/avs/armavs/responses.go index c5157b5f66fb..b260381895ef 100644 --- a/sdk/resourcemanager/avs/armavs/responses.go +++ b/sdk/resourcemanager/avs/armavs/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. diff --git a/sdk/resourcemanager/avs/armavs/scriptcmdlets_client.go b/sdk/resourcemanager/avs/armavs/scriptcmdlets_client.go index 3f09d2c8a443..7350a1b19adc 100644 --- a/sdk/resourcemanager/avs/armavs/scriptcmdlets_client.go +++ b/sdk/resourcemanager/avs/armavs/scriptcmdlets_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. @@ -75,7 +72,7 @@ func (client *ScriptCmdletsClient) Get(ctx context.Context, resourceGroupName st } // getCreateRequest creates the Get request. -func (client *ScriptCmdletsClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, scriptPackageName string, scriptCmdletName string, options *ScriptCmdletsClientGetOptions) (*policy.Request, error) { +func (client *ScriptCmdletsClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, scriptPackageName string, scriptCmdletName string, _ *ScriptCmdletsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets/{scriptCmdletName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -148,7 +145,7 @@ func (client *ScriptCmdletsClient) NewListPager(resourceGroupName string, privat } // listCreateRequest creates the List request. -func (client *ScriptCmdletsClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, scriptPackageName string, options *ScriptCmdletsClientListOptions) (*policy.Request, error) { +func (client *ScriptCmdletsClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, scriptPackageName string, _ *ScriptCmdletsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/avs/armavs/scriptcmdlets_client_example_test.go b/sdk/resourcemanager/avs/armavs/scriptcmdlets_client_example_test.go deleted file mode 100644 index 9e880696768b..000000000000 --- a/sdk/resourcemanager/avs/armavs/scriptcmdlets_client_example_test.go +++ /dev/null @@ -1,155 +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 armavs_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/avs/armavs/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptCmdlets_List.json -func ExampleScriptCmdletsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewScriptCmdletsClient().NewListPager("group1", "cloud1", "package@1.0.2", 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.ScriptCmdletsList = armavs.ScriptCmdletsList{ - // Value: []*armavs.ScriptCmdlet{ - // { - // Name: to.Ptr("Set-AvsStoragePolicy"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/scriptPackages/scriptCmdlets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/scriptPackages/package@1.0.2/scriptCmdlets/Set-AvsStoragePolicy"), - // Properties: &armavs.ScriptCmdletProperties{ - // Description: to.Ptr("Allow user to set the storage policy of the specified VM"), - // Audience: to.Ptr(armavs.ScriptCmdletAudienceAny), - // Parameters: []*armavs.ScriptParameter{ - // { - // Name: to.Ptr("VM"), - // Type: to.Ptr(armavs.ScriptParameterTypesString), - // Description: to.Ptr("VM to set the storage policy on"), - // Optional: to.Ptr(armavs.OptionalParamEnumRequired), - // Visibility: to.Ptr(armavs.VisibilityParameterEnumVisible), - // }, - // { - // Name: to.Ptr("StoragePolicyName"), - // Type: to.Ptr(armavs.ScriptParameterTypesString), - // Description: to.Ptr("Name of the storage policy to set"), - // Optional: to.Ptr(armavs.OptionalParamEnumRequired), - // Visibility: to.Ptr(armavs.VisibilityParameterEnumVisible), - // }}, - // Timeout: to.Ptr("P0Y0M0DT0H60M0S"), - // }, - // }, - // { - // Name: to.Ptr("New-ExternalSsoDomain"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/scriptPackages/scriptCmdlets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/scriptPackages/package@1.0.2/scriptCmdlets/New-ExternalSsoDomain"), - // Properties: &armavs.ScriptCmdletProperties{ - // Description: to.Ptr("Add an external Sso domain to their vCenter"), - // Audience: to.Ptr(armavs.ScriptCmdletAudienceAny), - // Parameters: []*armavs.ScriptParameter{ - // { - // Name: to.Ptr("DomainName"), - // Type: to.Ptr(armavs.ScriptParameterTypesString), - // Description: to.Ptr("Domain name of the Server"), - // Optional: to.Ptr(armavs.OptionalParamEnumRequired), - // Visibility: to.Ptr(armavs.VisibilityParameterEnumVisible), - // }, - // { - // Name: to.Ptr("BaseUserDN"), - // Type: to.Ptr(armavs.ScriptParameterTypesString), - // Description: to.Ptr("Base User DN of the Server"), - // Optional: to.Ptr(armavs.OptionalParamEnumRequired), - // Visibility: to.Ptr(armavs.VisibilityParameterEnumVisible), - // }, - // { - // Name: to.Ptr("Password"), - // Type: to.Ptr(armavs.ScriptParameterTypesSecureString), - // Description: to.Ptr("Password for authenticating to the server"), - // Optional: to.Ptr(armavs.OptionalParamEnumRequired), - // Visibility: to.Ptr(armavs.VisibilityParameterEnumHidden), - // }}, - // Timeout: to.Ptr("P0Y0M0DT0H60M0S"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptCmdlets_Get.json -func ExampleScriptCmdletsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScriptCmdletsClient().Get(ctx, "group1", "cloud1", "package@1.0.2", "New-ExternalSsoDomain", 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.ScriptCmdlet = armavs.ScriptCmdlet{ - // Name: to.Ptr("New-ExternalSsoDomain"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/scriptPackages/scriptCmdlets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/package@1.0.2/scriptCmdlets/New-ExternalSsoDomain"), - // Properties: &armavs.ScriptCmdletProperties{ - // Description: to.Ptr("Add an external Sso domain to their vCenter"), - // Audience: to.Ptr(armavs.ScriptCmdletAudienceAny), - // Parameters: []*armavs.ScriptParameter{ - // { - // Name: to.Ptr("DomainName"), - // Type: to.Ptr(armavs.ScriptParameterTypesString), - // Description: to.Ptr("Domain name of the Server"), - // Optional: to.Ptr(armavs.OptionalParamEnumRequired), - // Visibility: to.Ptr(armavs.VisibilityParameterEnumVisible), - // }, - // { - // Name: to.Ptr("BaseUserDN"), - // Type: to.Ptr(armavs.ScriptParameterTypesString), - // Description: to.Ptr("Base User DN of the Server"), - // Optional: to.Ptr(armavs.OptionalParamEnumRequired), - // Visibility: to.Ptr(armavs.VisibilityParameterEnumVisible), - // }, - // { - // Name: to.Ptr("Password"), - // Type: to.Ptr(armavs.ScriptParameterTypesSecureString), - // Description: to.Ptr("Password for authenticating to the server"), - // Optional: to.Ptr(armavs.OptionalParamEnumRequired), - // Visibility: to.Ptr(armavs.VisibilityParameterEnumHidden), - // }}, - // Timeout: to.Ptr("P0Y0M0DT0H60M0S"), - // }, - // } -} diff --git a/sdk/resourcemanager/avs/armavs/scriptexecutions_client.go b/sdk/resourcemanager/avs/armavs/scriptexecutions_client.go index 3ba436f09d07..89fb53e4f66f 100644 --- a/sdk/resourcemanager/avs/armavs/scriptexecutions_client.go +++ b/sdk/resourcemanager/avs/armavs/scriptexecutions_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. @@ -97,7 +94,7 @@ func (client *ScriptExecutionsClient) createOrUpdate(ctx context.Context, resour } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ScriptExecutionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, scriptExecutionName string, scriptExecution ScriptExecution, options *ScriptExecutionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ScriptExecutionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, scriptExecutionName string, scriptExecution ScriptExecution, _ *ScriptExecutionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -182,7 +179,7 @@ func (client *ScriptExecutionsClient) deleteOperation(ctx context.Context, resou } // deleteCreateRequest creates the Delete request. -func (client *ScriptExecutionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, scriptExecutionName string, options *ScriptExecutionsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ScriptExecutionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, scriptExecutionName string, _ *ScriptExecutionsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -242,7 +239,7 @@ func (client *ScriptExecutionsClient) Get(ctx context.Context, resourceGroupName } // getCreateRequest creates the Get request. -func (client *ScriptExecutionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, scriptExecutionName string, options *ScriptExecutionsClientGetOptions) (*policy.Request, error) { +func (client *ScriptExecutionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, scriptExecutionName string, _ *ScriptExecutionsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -387,7 +384,7 @@ func (client *ScriptExecutionsClient) NewListPager(resourceGroupName string, pri } // listCreateRequest creates the List request. -func (client *ScriptExecutionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, options *ScriptExecutionsClientListOptions) (*policy.Request, error) { +func (client *ScriptExecutionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, _ *ScriptExecutionsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/avs/armavs/scriptexecutions_client_example_test.go b/sdk/resourcemanager/avs/armavs/scriptexecutions_client_example_test.go deleted file mode 100644 index 6825b8324121..000000000000 --- a/sdk/resourcemanager/avs/armavs/scriptexecutions_client_example_test.go +++ /dev/null @@ -1,257 +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 armavs_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/avs/armavs/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptExecutions_List.json -func ExampleScriptExecutionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewScriptExecutionsClient().NewListPager("group1", "cloud1", 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.ScriptExecutionsList = armavs.ScriptExecutionsList{ - // Value: []*armavs.ScriptExecution{ - // { - // Name: to.Ptr("addSsoServer"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/scriptExecutions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/scriptExecutions/addSsoServer"), - // Properties: &armavs.ScriptExecutionProperties{ - // FailureReason: to.Ptr("vCenter failed to connect to the external server"), - // FinishedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-21T18:32:28.000Z"); return t}()), - // Parameters: []armavs.ScriptExecutionParameterClassification{ - // &armavs.ScriptStringExecutionParameter{ - // Name: to.Ptr("DomainName"), - // Type: to.Ptr(armavs.ScriptExecutionParameterTypeValue), - // Value: to.Ptr("placeholderDomain.local"), - // }, - // &armavs.ScriptStringExecutionParameter{ - // Name: to.Ptr("BaseUserDN"), - // Type: to.Ptr(armavs.ScriptExecutionParameterTypeValue), - // Value: to.Ptr("DC=placeholder, DC=placeholder"), - // }}, - // ProvisioningState: to.Ptr(armavs.ScriptExecutionProvisioningStateSucceeded), - // Retention: to.Ptr("P0Y0M60DT0H60M60S"), - // ScriptCmdletID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/scriptPackages/AVS:1.0.0/scriptCmdlets/New-SsoExternalIdentitySource"), - // StartedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-21T17:32:28.000Z"); return t}()), - // SubmittedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-21T17:31:28.000Z"); return t}()), - // Timeout: to.Ptr("P0Y0M0DT0H60M60S"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptExecutions_Get.json -func ExampleScriptExecutionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScriptExecutionsClient().Get(ctx, "group1", "cloud1", "addSsoServer", 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.ScriptExecution = armavs.ScriptExecution{ - // Name: to.Ptr("addSsoServer"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/scriptExecutions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/scriptExecutions/addSsoServer"), - // Properties: &armavs.ScriptExecutionProperties{ - // FailureReason: to.Ptr("vCenter failed to connect to the external server"), - // FinishedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-21T18:32:28.000Z"); return t}()), - // Parameters: []armavs.ScriptExecutionParameterClassification{ - // &armavs.ScriptStringExecutionParameter{ - // Name: to.Ptr("DomainName"), - // Type: to.Ptr(armavs.ScriptExecutionParameterTypeValue), - // Value: to.Ptr("placeholderDomain.local"), - // }, - // &armavs.ScriptStringExecutionParameter{ - // Name: to.Ptr("BaseUserDN"), - // Type: to.Ptr(armavs.ScriptExecutionParameterTypeValue), - // Value: to.Ptr("DC=placeholder, DC=placeholder"), - // }}, - // ProvisioningState: to.Ptr(armavs.ScriptExecutionProvisioningStateSucceeded), - // Retention: to.Ptr("P0Y0M60DT0H60M60S"), - // ScriptCmdletID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/scriptPackages/AVS.PowerCommands@1.0.0/scriptCmdlets/New-SsoExternalIdentitySource"), - // StartedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-21T17:32:28.000Z"); return t}()), - // SubmittedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-21T17:31:28.000Z"); return t}()), - // Timeout: to.Ptr("P0Y0M0DT0H60M60S"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptExecutions_CreateOrUpdate.json -func ExampleScriptExecutionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewScriptExecutionsClient().BeginCreateOrUpdate(ctx, "group1", "cloud1", "addSsoServer", armavs.ScriptExecution{ - Properties: &armavs.ScriptExecutionProperties{ - HiddenParameters: []armavs.ScriptExecutionParameterClassification{ - &armavs.ScriptSecureStringExecutionParameter{ - Name: to.Ptr("Password"), - Type: to.Ptr(armavs.ScriptExecutionParameterTypeSecureValue), - SecureValue: to.Ptr("PlaceholderPassword"), - }}, - Parameters: []armavs.ScriptExecutionParameterClassification{ - &armavs.ScriptStringExecutionParameter{ - Name: to.Ptr("DomainName"), - Type: to.Ptr(armavs.ScriptExecutionParameterTypeValue), - Value: to.Ptr("placeholderDomain.local"), - }, - &armavs.ScriptStringExecutionParameter{ - Name: to.Ptr("BaseUserDN"), - Type: to.Ptr(armavs.ScriptExecutionParameterTypeValue), - Value: to.Ptr("DC=placeholder, DC=placeholder"), - }}, - Retention: to.Ptr("P0Y0M60DT0H60M60S"), - ScriptCmdletID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/scriptPackages/AVS.PowerCommands@1.0.0/scriptCmdlets/New-SsoExternalIdentitySource"), - Timeout: to.Ptr("P0Y0M0DT0H60M60S"), - }, - }, 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.ScriptExecution = armavs.ScriptExecution{ - // Name: to.Ptr("addSsoServer"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/scriptExecutions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/scriptExecutions/addSsoServer"), - // Properties: &armavs.ScriptExecutionProperties{ - // FailureReason: to.Ptr("vCenter failed to connect to the external server"), - // Output: []*string{ - // to.Ptr("IdentitySource: placeholder.dc"), - // to.Ptr("BaseDN='dc=placeholder, dc=local")}, - // Parameters: []armavs.ScriptExecutionParameterClassification{ - // &armavs.ScriptStringExecutionParameter{ - // Name: to.Ptr("DomainName"), - // Type: to.Ptr(armavs.ScriptExecutionParameterTypeValue), - // Value: to.Ptr("placeholderDomain.local"), - // }, - // &armavs.ScriptStringExecutionParameter{ - // Name: to.Ptr("BaseUserDN"), - // Type: to.Ptr(armavs.ScriptExecutionParameterTypeValue), - // Value: to.Ptr("DC=placeholder, DC=placeholder"), - // }}, - // ProvisioningState: to.Ptr(armavs.ScriptExecutionProvisioningStateSucceeded), - // Retention: to.Ptr("P0Y0M60DT0H60M60S"), - // ScriptCmdletID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/scriptPackages/AVS.PowerCommands@1.0.0/scriptCmdlets/New-SsoExternalIdentitySource"), - // Timeout: to.Ptr("P0Y0M0DT0H60M60S"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptExecutions_Delete.json -func ExampleScriptExecutionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewScriptExecutionsClient().BeginDelete(ctx, "group1", "cloud1", "addSsoServer", 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/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptExecutions_GetExecutionLogs.json -func ExampleScriptExecutionsClient_GetExecutionLogs() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScriptExecutionsClient().GetExecutionLogs(ctx, "group1", "cloud1", "addSsoServer", &armavs.ScriptExecutionsClientGetExecutionLogsOptions{ScriptOutputStreamType: []*armavs.ScriptOutputStreamType{ - to.Ptr(armavs.ScriptOutputStreamTypeInformation), - to.Ptr(armavs.ScriptOutputStreamType("Warnings")), - to.Ptr(armavs.ScriptOutputStreamType("Errors")), - to.Ptr(armavs.ScriptOutputStreamTypeOutput)}, - }) - 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.ScriptExecution = armavs.ScriptExecution{ - // Name: to.Ptr("addSsoServer"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/scriptExecutions/addSsoServer"), - // Properties: &armavs.ScriptExecutionProperties{ - // Errors: []*string{ - // to.Ptr("Most recent error output"), - // to.Ptr("Second most error recent output")}, - // Information: []*string{ - // to.Ptr("Most recent information output"), - // to.Ptr("Second most recent information output")}, - // Output: []*string{ - // to.Ptr("Most recent output"), - // to.Ptr("Second most recent output")}, - // Timeout: to.Ptr("P0Y0M0D0H060M0S"), - // Warnings: []*string{ - // to.Ptr("Most recent warning output"), - // to.Ptr("Second most recent warning output")}, - // }, - // } -} diff --git a/sdk/resourcemanager/avs/armavs/scriptpackages_client.go b/sdk/resourcemanager/avs/armavs/scriptpackages_client.go index 4e2ef00b6ac0..f4225c62015b 100644 --- a/sdk/resourcemanager/avs/armavs/scriptpackages_client.go +++ b/sdk/resourcemanager/avs/armavs/scriptpackages_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. @@ -74,7 +71,7 @@ func (client *ScriptPackagesClient) Get(ctx context.Context, resourceGroupName s } // getCreateRequest creates the Get request. -func (client *ScriptPackagesClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, scriptPackageName string, options *ScriptPackagesClientGetOptions) (*policy.Request, error) { +func (client *ScriptPackagesClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, scriptPackageName string, _ *ScriptPackagesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -142,7 +139,7 @@ func (client *ScriptPackagesClient) NewListPager(resourceGroupName string, priva } // listCreateRequest creates the List request. -func (client *ScriptPackagesClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, options *ScriptPackagesClientListOptions) (*policy.Request, error) { +func (client *ScriptPackagesClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, _ *ScriptPackagesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/avs/armavs/scriptpackages_client_example_test.go b/sdk/resourcemanager/avs/armavs/scriptpackages_client_example_test.go deleted file mode 100644 index cbccee9375cc..000000000000 --- a/sdk/resourcemanager/avs/armavs/scriptpackages_client_example_test.go +++ /dev/null @@ -1,99 +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 armavs_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/avs/armavs/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptPackages_List.json -func ExampleScriptPackagesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewScriptPackagesClient().NewListPager("group1", "cloud1", 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.ScriptPackagesList = armavs.ScriptPackagesList{ - // Value: []*armavs.ScriptPackage{ - // { - // Name: to.Ptr("Microsoft.AVS.Management@3.0.48"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/scriptPackages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/scriptPackages/Microsoft.AVS.Management@3.0.48"), - // Properties: &armavs.ScriptPackageProperties{ - // Description: to.Ptr("Various cmdlets for elevated access to Private Cloud administrative functions"), - // Company: to.Ptr("Microsoft"), - // URI: to.Ptr("https://microsoft.com"), - // Version: to.Ptr("3.0.48"), - // }, - // }, - // { - // Name: to.Ptr("JSDR.Configuration@1.0.0"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/scriptPackages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/scriptPackages/JSDR.Configuration@1.0.0"), - // Properties: &armavs.ScriptPackageProperties{ - // Description: to.Ptr("Various cmdlets by Jetstream for Private Cloud administration"), - // Company: to.Ptr("Jetstream Software"), - // URI: to.Ptr("https://www.jetstreamsoft.com/about/support/"), - // Version: to.Ptr("1.0.0"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/ScriptPackages_Get.json -func ExampleScriptPackagesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScriptPackagesClient().Get(ctx, "group1", "cloud1", "Microsoft.AVS.Management@3.0.48", 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.ScriptPackage = armavs.ScriptPackage{ - // Name: to.Ptr("Microsoft.AVS.Management@3.0.48"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/scriptPackages"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/scriptPackages/Microsoft.AVS.Management@3.0.48"), - // Properties: &armavs.ScriptPackageProperties{ - // Description: to.Ptr("Various cmdlets for elevated access to Private Cloud administrative functions"), - // Company: to.Ptr("Microsoft"), - // URI: to.Ptr("https://microsoft.com"), - // Version: to.Ptr("3.0.48"), - // }, - // } -} diff --git a/sdk/resourcemanager/avs/armavs/time_rfc3339.go b/sdk/resourcemanager/avs/armavs/time_rfc3339.go index cd17c63544ba..d6b19c0c29b5 100644 --- a/sdk/resourcemanager/avs/armavs/time_rfc3339.go +++ b/sdk/resourcemanager/avs/armavs/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. @@ -60,6 +57,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string diff --git a/sdk/resourcemanager/avs/armavs/virtualmachines_client.go b/sdk/resourcemanager/avs/armavs/virtualmachines_client.go index 1cca4bb8736a..595d9f45b11c 100644 --- a/sdk/resourcemanager/avs/armavs/virtualmachines_client.go +++ b/sdk/resourcemanager/avs/armavs/virtualmachines_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. @@ -75,7 +72,7 @@ func (client *VirtualMachinesClient) Get(ctx context.Context, resourceGroupName } // getCreateRequest creates the Get request. -func (client *VirtualMachinesClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, virtualMachineID string, options *VirtualMachinesClientGetOptions) (*policy.Request, error) { +func (client *VirtualMachinesClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, virtualMachineID string, _ *VirtualMachinesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -149,7 +146,7 @@ func (client *VirtualMachinesClient) NewListPager(resourceGroupName string, priv } // listCreateRequest creates the List request. -func (client *VirtualMachinesClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, options *VirtualMachinesClientListOptions) (*policy.Request, error) { +func (client *VirtualMachinesClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, _ *VirtualMachinesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -242,7 +239,7 @@ func (client *VirtualMachinesClient) restrictMovement(ctx context.Context, resou } // restrictMovementCreateRequest creates the RestrictMovement request. -func (client *VirtualMachinesClient) restrictMovementCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, virtualMachineID string, restrictMovement VirtualMachineRestrictMovement, options *VirtualMachinesClientBeginRestrictMovementOptions) (*policy.Request, error) { +func (client *VirtualMachinesClient) restrictMovementCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, clusterName string, virtualMachineID string, restrictMovement VirtualMachineRestrictMovement, _ *VirtualMachinesClientBeginRestrictMovementOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}/restrictMovement" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/avs/armavs/virtualmachines_client_example_test.go b/sdk/resourcemanager/avs/armavs/virtualmachines_client_example_test.go deleted file mode 100644 index 1a4a6fc05857..000000000000 --- a/sdk/resourcemanager/avs/armavs/virtualmachines_client_example_test.go +++ /dev/null @@ -1,123 +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 armavs_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/avs/armavs/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/VirtualMachines_List.json -func ExampleVirtualMachinesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachinesClient().NewListPager("group1", "cloud1", "cluster1", 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.VirtualMachinesList = armavs.VirtualMachinesList{ - // Value: []*armavs.VirtualMachine{ - // { - // Name: to.Ptr("vm-209"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/clusters/virtualMachines"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/virtualMachines/vm-209"), - // Properties: &armavs.VirtualMachineProperties{ - // DisplayName: to.Ptr("contoso-vm1"), - // FolderPath: to.Ptr("vm/folder-1"), - // MoRefID: to.Ptr("vm-209"), - // RestrictMovement: to.Ptr(armavs.VirtualMachineRestrictMovementStateDisabled), - // }, - // }, - // { - // Name: to.Ptr("vm-128"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/clusters/virtualMachines"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/virtualMachines/vm-128"), - // Properties: &armavs.VirtualMachineProperties{ - // DisplayName: to.Ptr("contoso-vm2"), - // FolderPath: to.Ptr("vm"), - // MoRefID: to.Ptr("vm-128"), - // RestrictMovement: to.Ptr(armavs.VirtualMachineRestrictMovementStateEnabled), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/VirtualMachines_Get.json -func ExampleVirtualMachinesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachinesClient().Get(ctx, "group1", "cloud1", "cluster1", "vm-209", 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.VirtualMachine = armavs.VirtualMachine{ - // Name: to.Ptr("vm-209"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/clusters/virtualMachines"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/clusters/cluster1/virtualMachines/vm-209"), - // Properties: &armavs.VirtualMachineProperties{ - // DisplayName: to.Ptr("contoso-vm"), - // FolderPath: to.Ptr("vm/folder-1"), - // MoRefID: to.Ptr("vm-209"), - // RestrictMovement: to.Ptr(armavs.VirtualMachineRestrictMovementStateDisabled), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/VirtualMachines_RestrictMovement.json -func ExampleVirtualMachinesClient_BeginRestrictMovement() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachinesClient().BeginRestrictMovement(ctx, "group1", "cloud1", "cluster1", "vm-209", armavs.VirtualMachineRestrictMovement{ - RestrictMovement: to.Ptr(armavs.VirtualMachineRestrictMovementStateEnabled), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/avs/armavs/workloadnetworks_client.go b/sdk/resourcemanager/avs/armavs/workloadnetworks_client.go index 7b17d8f8f622..1268ac72ea71 100644 --- a/sdk/resourcemanager/avs/armavs/workloadnetworks_client.go +++ b/sdk/resourcemanager/avs/armavs/workloadnetworks_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. @@ -97,7 +94,7 @@ func (client *WorkloadNetworksClient) createDNSService(ctx context.Context, reso } // createDNSServiceCreateRequest creates the CreateDNSService request. -func (client *WorkloadNetworksClient) createDNSServiceCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, dnsServiceID string, workloadNetworkDNSService WorkloadNetworkDNSService, options *WorkloadNetworksClientBeginCreateDNSServiceOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) createDNSServiceCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, dnsServiceID string, workloadNetworkDNSService WorkloadNetworkDNSService, _ *WorkloadNetworksClientBeginCreateDNSServiceOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -183,7 +180,7 @@ func (client *WorkloadNetworksClient) createDNSZone(ctx context.Context, resourc } // createDNSZoneCreateRequest creates the CreateDNSZone request. -func (client *WorkloadNetworksClient) createDNSZoneCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, dnsZoneID string, workloadNetworkDNSZone WorkloadNetworkDNSZone, options *WorkloadNetworksClientBeginCreateDNSZoneOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) createDNSZoneCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, dnsZoneID string, workloadNetworkDNSZone WorkloadNetworkDNSZone, _ *WorkloadNetworksClientBeginCreateDNSZoneOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -269,7 +266,7 @@ func (client *WorkloadNetworksClient) createDhcp(ctx context.Context, resourceGr } // createDhcpCreateRequest creates the CreateDhcp request. -func (client *WorkloadNetworksClient) createDhcpCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, dhcpID string, workloadNetworkDhcp WorkloadNetworkDhcp, options *WorkloadNetworksClientBeginCreateDhcpOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) createDhcpCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, dhcpID string, workloadNetworkDhcp WorkloadNetworkDhcp, _ *WorkloadNetworksClientBeginCreateDhcpOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -355,7 +352,7 @@ func (client *WorkloadNetworksClient) createPortMirroring(ctx context.Context, r } // createPortMirroringCreateRequest creates the CreatePortMirroring request. -func (client *WorkloadNetworksClient) createPortMirroringCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, portMirroringID string, workloadNetworkPortMirroring WorkloadNetworkPortMirroring, options *WorkloadNetworksClientBeginCreatePortMirroringOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) createPortMirroringCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, portMirroringID string, workloadNetworkPortMirroring WorkloadNetworkPortMirroring, _ *WorkloadNetworksClientBeginCreatePortMirroringOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -441,7 +438,7 @@ func (client *WorkloadNetworksClient) createPublicIP(ctx context.Context, resour } // createPublicIPCreateRequest creates the CreatePublicIP request. -func (client *WorkloadNetworksClient) createPublicIPCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, publicIPID string, workloadNetworkPublicIP WorkloadNetworkPublicIP, options *WorkloadNetworksClientBeginCreatePublicIPOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) createPublicIPCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, publicIPID string, workloadNetworkPublicIP WorkloadNetworkPublicIP, _ *WorkloadNetworksClientBeginCreatePublicIPOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -527,7 +524,7 @@ func (client *WorkloadNetworksClient) createSegments(ctx context.Context, resour } // createSegmentsCreateRequest creates the CreateSegments request. -func (client *WorkloadNetworksClient) createSegmentsCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, segmentID string, workloadNetworkSegment WorkloadNetworkSegment, options *WorkloadNetworksClientBeginCreateSegmentsOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) createSegmentsCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, segmentID string, workloadNetworkSegment WorkloadNetworkSegment, _ *WorkloadNetworksClientBeginCreateSegmentsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -613,7 +610,7 @@ func (client *WorkloadNetworksClient) createVMGroup(ctx context.Context, resourc } // createVMGroupCreateRequest creates the CreateVMGroup request. -func (client *WorkloadNetworksClient) createVMGroupCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, vmGroupID string, workloadNetworkVMGroup WorkloadNetworkVMGroup, options *WorkloadNetworksClientBeginCreateVMGroupOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) createVMGroupCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, vmGroupID string, workloadNetworkVMGroup WorkloadNetworkVMGroup, _ *WorkloadNetworksClientBeginCreateVMGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -698,7 +695,7 @@ func (client *WorkloadNetworksClient) deleteDNSService(ctx context.Context, reso } // deleteDNSServiceCreateRequest creates the DeleteDNSService request. -func (client *WorkloadNetworksClient) deleteDNSServiceCreateRequest(ctx context.Context, resourceGroupName string, dnsServiceID string, privateCloudName string, options *WorkloadNetworksClientBeginDeleteDNSServiceOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) deleteDNSServiceCreateRequest(ctx context.Context, resourceGroupName string, dnsServiceID string, privateCloudName string, _ *WorkloadNetworksClientBeginDeleteDNSServiceOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -780,7 +777,7 @@ func (client *WorkloadNetworksClient) deleteDNSZone(ctx context.Context, resourc } // deleteDNSZoneCreateRequest creates the DeleteDNSZone request. -func (client *WorkloadNetworksClient) deleteDNSZoneCreateRequest(ctx context.Context, resourceGroupName string, dnsZoneID string, privateCloudName string, options *WorkloadNetworksClientBeginDeleteDNSZoneOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) deleteDNSZoneCreateRequest(ctx context.Context, resourceGroupName string, dnsZoneID string, privateCloudName string, _ *WorkloadNetworksClientBeginDeleteDNSZoneOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -862,7 +859,7 @@ func (client *WorkloadNetworksClient) deleteDhcp(ctx context.Context, resourceGr } // deleteDhcpCreateRequest creates the DeleteDhcp request. -func (client *WorkloadNetworksClient) deleteDhcpCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, dhcpID string, options *WorkloadNetworksClientBeginDeleteDhcpOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) deleteDhcpCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, dhcpID string, _ *WorkloadNetworksClientBeginDeleteDhcpOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -944,7 +941,7 @@ func (client *WorkloadNetworksClient) deletePortMirroring(ctx context.Context, r } // deletePortMirroringCreateRequest creates the DeletePortMirroring request. -func (client *WorkloadNetworksClient) deletePortMirroringCreateRequest(ctx context.Context, resourceGroupName string, portMirroringID string, privateCloudName string, options *WorkloadNetworksClientBeginDeletePortMirroringOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) deletePortMirroringCreateRequest(ctx context.Context, resourceGroupName string, portMirroringID string, privateCloudName string, _ *WorkloadNetworksClientBeginDeletePortMirroringOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -1026,7 +1023,7 @@ func (client *WorkloadNetworksClient) deletePublicIP(ctx context.Context, resour } // deletePublicIPCreateRequest creates the DeletePublicIP request. -func (client *WorkloadNetworksClient) deletePublicIPCreateRequest(ctx context.Context, resourceGroupName string, publicIPID string, privateCloudName string, options *WorkloadNetworksClientBeginDeletePublicIPOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) deletePublicIPCreateRequest(ctx context.Context, resourceGroupName string, publicIPID string, privateCloudName string, _ *WorkloadNetworksClientBeginDeletePublicIPOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -1108,7 +1105,7 @@ func (client *WorkloadNetworksClient) deleteSegment(ctx context.Context, resourc } // deleteSegmentCreateRequest creates the DeleteSegment request. -func (client *WorkloadNetworksClient) deleteSegmentCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, segmentID string, options *WorkloadNetworksClientBeginDeleteSegmentOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) deleteSegmentCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, segmentID string, _ *WorkloadNetworksClientBeginDeleteSegmentOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -1190,7 +1187,7 @@ func (client *WorkloadNetworksClient) deleteVMGroup(ctx context.Context, resourc } // deleteVMGroupCreateRequest creates the DeleteVMGroup request. -func (client *WorkloadNetworksClient) deleteVMGroupCreateRequest(ctx context.Context, resourceGroupName string, vmGroupID string, privateCloudName string, options *WorkloadNetworksClientBeginDeleteVMGroupOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) deleteVMGroupCreateRequest(ctx context.Context, resourceGroupName string, vmGroupID string, privateCloudName string, _ *WorkloadNetworksClientBeginDeleteVMGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -1249,7 +1246,7 @@ func (client *WorkloadNetworksClient) Get(ctx context.Context, resourceGroupName } // getCreateRequest creates the Get request. -func (client *WorkloadNetworksClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, options *WorkloadNetworksClientGetOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, _ *WorkloadNetworksClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -1315,7 +1312,7 @@ func (client *WorkloadNetworksClient) GetDNSService(ctx context.Context, resourc } // getDNSServiceCreateRequest creates the GetDNSService request. -func (client *WorkloadNetworksClient) getDNSServiceCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, dnsServiceID string, options *WorkloadNetworksClientGetDNSServiceOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) getDNSServiceCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, dnsServiceID string, _ *WorkloadNetworksClientGetDNSServiceOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -1385,7 +1382,7 @@ func (client *WorkloadNetworksClient) GetDNSZone(ctx context.Context, resourceGr } // getDNSZoneCreateRequest creates the GetDNSZone request. -func (client *WorkloadNetworksClient) getDNSZoneCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, dnsZoneID string, options *WorkloadNetworksClientGetDNSZoneOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) getDNSZoneCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, dnsZoneID string, _ *WorkloadNetworksClientGetDNSZoneOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -1455,7 +1452,7 @@ func (client *WorkloadNetworksClient) GetDhcp(ctx context.Context, resourceGroup } // getDhcpCreateRequest creates the GetDhcp request. -func (client *WorkloadNetworksClient) getDhcpCreateRequest(ctx context.Context, resourceGroupName string, dhcpID string, privateCloudName string, options *WorkloadNetworksClientGetDhcpOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) getDhcpCreateRequest(ctx context.Context, resourceGroupName string, dhcpID string, privateCloudName string, _ *WorkloadNetworksClientGetDhcpOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -1525,7 +1522,7 @@ func (client *WorkloadNetworksClient) GetGateway(ctx context.Context, resourceGr } // getGatewayCreateRequest creates the GetGateway request. -func (client *WorkloadNetworksClient) getGatewayCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, gatewayID string, options *WorkloadNetworksClientGetGatewayOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) getGatewayCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, gatewayID string, _ *WorkloadNetworksClientGetGatewayOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways/{gatewayId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -1595,7 +1592,7 @@ func (client *WorkloadNetworksClient) GetPortMirroring(ctx context.Context, reso } // getPortMirroringCreateRequest creates the GetPortMirroring request. -func (client *WorkloadNetworksClient) getPortMirroringCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, portMirroringID string, options *WorkloadNetworksClientGetPortMirroringOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) getPortMirroringCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, portMirroringID string, _ *WorkloadNetworksClientGetPortMirroringOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -1665,7 +1662,7 @@ func (client *WorkloadNetworksClient) GetPublicIP(ctx context.Context, resourceG } // getPublicIPCreateRequest creates the GetPublicIP request. -func (client *WorkloadNetworksClient) getPublicIPCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, publicIPID string, options *WorkloadNetworksClientGetPublicIPOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) getPublicIPCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, publicIPID string, _ *WorkloadNetworksClientGetPublicIPOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -1735,7 +1732,7 @@ func (client *WorkloadNetworksClient) GetSegment(ctx context.Context, resourceGr } // getSegmentCreateRequest creates the GetSegment request. -func (client *WorkloadNetworksClient) getSegmentCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, segmentID string, options *WorkloadNetworksClientGetSegmentOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) getSegmentCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, segmentID string, _ *WorkloadNetworksClientGetSegmentOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -1805,7 +1802,7 @@ func (client *WorkloadNetworksClient) GetVMGroup(ctx context.Context, resourceGr } // getVMGroupCreateRequest creates the GetVMGroup request. -func (client *WorkloadNetworksClient) getVMGroupCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, vmGroupID string, options *WorkloadNetworksClientGetVMGroupOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) getVMGroupCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, vmGroupID string, _ *WorkloadNetworksClientGetVMGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -1875,7 +1872,7 @@ func (client *WorkloadNetworksClient) GetVirtualMachine(ctx context.Context, res } // getVirtualMachineCreateRequest creates the GetVirtualMachine request. -func (client *WorkloadNetworksClient) getVirtualMachineCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, virtualMachineID string, options *WorkloadNetworksClientGetVirtualMachineOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) getVirtualMachineCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, virtualMachineID string, _ *WorkloadNetworksClientGetVirtualMachineOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines/{virtualMachineId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -1944,7 +1941,7 @@ func (client *WorkloadNetworksClient) NewListPager(resourceGroupName string, pri } // listCreateRequest creates the List request. -func (client *WorkloadNetworksClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, options *WorkloadNetworksClientListOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, _ *WorkloadNetworksClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -2009,7 +2006,7 @@ func (client *WorkloadNetworksClient) NewListDNSServicesPager(resourceGroupName } // listDNSServicesCreateRequest creates the ListDNSServices request. -func (client *WorkloadNetworksClient) listDNSServicesCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, options *WorkloadNetworksClientListDNSServicesOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) listDNSServicesCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, _ *WorkloadNetworksClientListDNSServicesOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -2074,7 +2071,7 @@ func (client *WorkloadNetworksClient) NewListDNSZonesPager(resourceGroupName str } // listDNSZonesCreateRequest creates the ListDNSZones request. -func (client *WorkloadNetworksClient) listDNSZonesCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, options *WorkloadNetworksClientListDNSZonesOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) listDNSZonesCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, _ *WorkloadNetworksClientListDNSZonesOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -2139,7 +2136,7 @@ func (client *WorkloadNetworksClient) NewListDhcpPager(resourceGroupName string, } // listDhcpCreateRequest creates the ListDhcp request. -func (client *WorkloadNetworksClient) listDhcpCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, options *WorkloadNetworksClientListDhcpOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) listDhcpCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, _ *WorkloadNetworksClientListDhcpOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -2204,7 +2201,7 @@ func (client *WorkloadNetworksClient) NewListGatewaysPager(resourceGroupName str } // listGatewaysCreateRequest creates the ListGateways request. -func (client *WorkloadNetworksClient) listGatewaysCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, options *WorkloadNetworksClientListGatewaysOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) listGatewaysCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, _ *WorkloadNetworksClientListGatewaysOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -2269,7 +2266,7 @@ func (client *WorkloadNetworksClient) NewListPortMirroringPager(resourceGroupNam } // listPortMirroringCreateRequest creates the ListPortMirroring request. -func (client *WorkloadNetworksClient) listPortMirroringCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, options *WorkloadNetworksClientListPortMirroringOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) listPortMirroringCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, _ *WorkloadNetworksClientListPortMirroringOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -2334,7 +2331,7 @@ func (client *WorkloadNetworksClient) NewListPublicIPsPager(resourceGroupName st } // listPublicIPsCreateRequest creates the ListPublicIPs request. -func (client *WorkloadNetworksClient) listPublicIPsCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, options *WorkloadNetworksClientListPublicIPsOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) listPublicIPsCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, _ *WorkloadNetworksClientListPublicIPsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -2399,7 +2396,7 @@ func (client *WorkloadNetworksClient) NewListSegmentsPager(resourceGroupName str } // listSegmentsCreateRequest creates the ListSegments request. -func (client *WorkloadNetworksClient) listSegmentsCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, options *WorkloadNetworksClientListSegmentsOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) listSegmentsCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, _ *WorkloadNetworksClientListSegmentsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -2464,7 +2461,7 @@ func (client *WorkloadNetworksClient) NewListVMGroupsPager(resourceGroupName str } // listVMGroupsCreateRequest creates the ListVMGroups request. -func (client *WorkloadNetworksClient) listVMGroupsCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, options *WorkloadNetworksClientListVMGroupsOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) listVMGroupsCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, _ *WorkloadNetworksClientListVMGroupsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -2529,7 +2526,7 @@ func (client *WorkloadNetworksClient) NewListVirtualMachinesPager(resourceGroupN } // listVirtualMachinesCreateRequest creates the ListVirtualMachines request. -func (client *WorkloadNetworksClient) listVirtualMachinesCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, options *WorkloadNetworksClientListVirtualMachinesOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) listVirtualMachinesCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, _ *WorkloadNetworksClientListVirtualMachinesOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -2617,7 +2614,7 @@ func (client *WorkloadNetworksClient) updateDNSService(ctx context.Context, reso } // updateDNSServiceCreateRequest creates the UpdateDNSService request. -func (client *WorkloadNetworksClient) updateDNSServiceCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, dnsServiceID string, workloadNetworkDNSService WorkloadNetworkDNSService, options *WorkloadNetworksClientBeginUpdateDNSServiceOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) updateDNSServiceCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, dnsServiceID string, workloadNetworkDNSService WorkloadNetworkDNSService, _ *WorkloadNetworksClientBeginUpdateDNSServiceOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -2703,7 +2700,7 @@ func (client *WorkloadNetworksClient) updateDNSZone(ctx context.Context, resourc } // updateDNSZoneCreateRequest creates the UpdateDNSZone request. -func (client *WorkloadNetworksClient) updateDNSZoneCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, dnsZoneID string, workloadNetworkDNSZone WorkloadNetworkDNSZone, options *WorkloadNetworksClientBeginUpdateDNSZoneOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) updateDNSZoneCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, dnsZoneID string, workloadNetworkDNSZone WorkloadNetworkDNSZone, _ *WorkloadNetworksClientBeginUpdateDNSZoneOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -2789,7 +2786,7 @@ func (client *WorkloadNetworksClient) updateDhcp(ctx context.Context, resourceGr } // updateDhcpCreateRequest creates the UpdateDhcp request. -func (client *WorkloadNetworksClient) updateDhcpCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, dhcpID string, workloadNetworkDhcp WorkloadNetworkDhcp, options *WorkloadNetworksClientBeginUpdateDhcpOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) updateDhcpCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, dhcpID string, workloadNetworkDhcp WorkloadNetworkDhcp, _ *WorkloadNetworksClientBeginUpdateDhcpOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -2875,7 +2872,7 @@ func (client *WorkloadNetworksClient) updatePortMirroring(ctx context.Context, r } // updatePortMirroringCreateRequest creates the UpdatePortMirroring request. -func (client *WorkloadNetworksClient) updatePortMirroringCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, portMirroringID string, workloadNetworkPortMirroring WorkloadNetworkPortMirroring, options *WorkloadNetworksClientBeginUpdatePortMirroringOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) updatePortMirroringCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, portMirroringID string, workloadNetworkPortMirroring WorkloadNetworkPortMirroring, _ *WorkloadNetworksClientBeginUpdatePortMirroringOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -2961,7 +2958,7 @@ func (client *WorkloadNetworksClient) updateSegments(ctx context.Context, resour } // updateSegmentsCreateRequest creates the UpdateSegments request. -func (client *WorkloadNetworksClient) updateSegmentsCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, segmentID string, workloadNetworkSegment WorkloadNetworkSegment, options *WorkloadNetworksClientBeginUpdateSegmentsOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) updateSegmentsCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, segmentID string, workloadNetworkSegment WorkloadNetworkSegment, _ *WorkloadNetworksClientBeginUpdateSegmentsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -3047,7 +3044,7 @@ func (client *WorkloadNetworksClient) updateVMGroup(ctx context.Context, resourc } // updateVMGroupCreateRequest creates the UpdateVMGroup request. -func (client *WorkloadNetworksClient) updateVMGroupCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, vmGroupID string, workloadNetworkVMGroup WorkloadNetworkVMGroup, options *WorkloadNetworksClientBeginUpdateVMGroupOptions) (*policy.Request, error) { +func (client *WorkloadNetworksClient) updateVMGroupCreateRequest(ctx context.Context, resourceGroupName string, privateCloudName string, vmGroupID string, workloadNetworkVMGroup WorkloadNetworkVMGroup, _ *WorkloadNetworksClientBeginUpdateVMGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/avs/armavs/workloadnetworks_client_example_test.go b/sdk/resourcemanager/avs/armavs/workloadnetworks_client_example_test.go deleted file mode 100644 index 49c02d7c2692..000000000000 --- a/sdk/resourcemanager/avs/armavs/workloadnetworks_client_example_test.go +++ /dev/null @@ -1,1496 +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 armavs_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/avs/armavs/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_List.json -func ExampleWorkloadNetworksClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWorkloadNetworksClient().NewListPager("group1", "cloud1", 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.WorkloadNetworkList = armavs.WorkloadNetworkList{ - // Value: []*armavs.WorkloadNetwork{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_Get.json -func ExampleWorkloadNetworksClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadNetworksClient().Get(ctx, "group1", "cloud1", 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.WorkloadNetwork = armavs.WorkloadNetwork{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_ListDhcp.json -func ExampleWorkloadNetworksClient_NewListDhcpPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWorkloadNetworksClient().NewListDhcpPager("group1", "cloud1", 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.WorkloadNetworkDhcpList = armavs.WorkloadNetworkDhcpList{ - // Value: []*armavs.WorkloadNetworkDhcp{ - // { - // Name: to.Ptr("dhcp1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/dhcpConfigurations"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/dhcpConfigurations/dhcpConfigurations1"), - // Properties: &armavs.WorkloadNetworkDhcpServer{ - // DhcpType: to.Ptr(armavs.DhcpTypeEnumSERVER), - // DisplayName: to.Ptr("dhcpConfigurations1"), - // Revision: to.Ptr[int64](1), - // Segments: []*string{ - // to.Ptr("segment1"), - // to.Ptr("segment2")}, - // LeaseTime: to.Ptr[int64](86400), - // ServerAddress: to.Ptr("40.1.5.1/24"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_GetDhcp.json -func ExampleWorkloadNetworksClient_GetDhcp() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadNetworksClient().GetDhcp(ctx, "group1", "dhcp1", "cloud1", 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.WorkloadNetworkDhcp = armavs.WorkloadNetworkDhcp{ - // Name: to.Ptr("dhcp1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/dhcpConfigurations"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/dhcpConfigurations/dhcpConfigurations1"), - // Properties: &armavs.WorkloadNetworkDhcpServer{ - // DhcpType: to.Ptr(armavs.DhcpTypeEnumSERVER), - // DisplayName: to.Ptr("dhcpConfigurations1"), - // Revision: to.Ptr[int64](1), - // Segments: []*string{ - // to.Ptr("segment1"), - // to.Ptr("segment2")}, - // LeaseTime: to.Ptr[int64](86400), - // ServerAddress: to.Ptr("40.1.5.1/24"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_CreateDhcp.json -func ExampleWorkloadNetworksClient_BeginCreateDhcp() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWorkloadNetworksClient().BeginCreateDhcp(ctx, "group1", "cloud1", "dhcp1", armavs.WorkloadNetworkDhcp{ - Properties: &armavs.WorkloadNetworkDhcpServer{ - DhcpType: to.Ptr(armavs.DhcpTypeEnumSERVER), - DisplayName: to.Ptr("dhcpConfigurations1"), - Revision: to.Ptr[int64](1), - LeaseTime: to.Ptr[int64](86400), - ServerAddress: to.Ptr("40.1.5.1/24"), - }, - }, 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.WorkloadNetworkDhcp = armavs.WorkloadNetworkDhcp{ - // Name: to.Ptr("dhcp1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/dhcpConfigurations"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/dhcpConfigurations/dhcpConfigurations1"), - // Properties: &armavs.WorkloadNetworkDhcpServer{ - // DhcpType: to.Ptr(armavs.DhcpTypeEnumSERVER), - // DisplayName: to.Ptr("dhcpConfigurations1"), - // Revision: to.Ptr[int64](1), - // Segments: []*string{ - // to.Ptr("segment1"), - // to.Ptr("segment2")}, - // LeaseTime: to.Ptr[int64](86400), - // ServerAddress: to.Ptr("40.1.5.1/24"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_UpdateDhcp.json -func ExampleWorkloadNetworksClient_BeginUpdateDhcp() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWorkloadNetworksClient().BeginUpdateDhcp(ctx, "group1", "cloud1", "dhcp1", armavs.WorkloadNetworkDhcp{ - Properties: &armavs.WorkloadNetworkDhcpServer{ - DhcpType: to.Ptr(armavs.DhcpTypeEnumSERVER), - Revision: to.Ptr[int64](1), - LeaseTime: to.Ptr[int64](86400), - ServerAddress: to.Ptr("40.1.5.1/24"), - }, - }, 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.WorkloadNetworkDhcp = armavs.WorkloadNetworkDhcp{ - // Name: to.Ptr("dhcp1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/dhcpConfigurations"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/dhcpConfigurations/dhcpConfigurations1"), - // Properties: &armavs.WorkloadNetworkDhcpServer{ - // DhcpType: to.Ptr(armavs.DhcpTypeEnumSERVER), - // DisplayName: to.Ptr("dhcpConfigurations1"), - // Revision: to.Ptr[int64](2), - // Segments: []*string{ - // to.Ptr("segment1"), - // to.Ptr("segment2")}, - // LeaseTime: to.Ptr[int64](86400), - // ServerAddress: to.Ptr("40.1.5.1/24"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_DeleteDhcp.json -func ExampleWorkloadNetworksClient_BeginDeleteDhcp() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWorkloadNetworksClient().BeginDeleteDhcp(ctx, "group1", "cloud1", "dhcp1", 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/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_ListDnsServices.json -func ExampleWorkloadNetworksClient_NewListDNSServicesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWorkloadNetworksClient().NewListDNSServicesPager("group1", "cloud1", 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.WorkloadNetworkDNSServicesList = armavs.WorkloadNetworkDNSServicesList{ - // Value: []*armavs.WorkloadNetworkDNSService{ - // { - // Name: to.Ptr("portMirroring1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/dnsServices"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/dnsServices/dnsService1"), - // Properties: &armavs.WorkloadNetworkDNSServiceProperties{ - // DefaultDNSZone: to.Ptr("defaultDnsZone1"), - // DisplayName: to.Ptr("dnsService1"), - // DNSServiceIP: to.Ptr("5.5.5.5"), - // FqdnZones: []*string{ - // to.Ptr("fqdnZone1")}, - // LogLevel: to.Ptr(armavs.DNSServiceLogLevelEnumINFO), - // Revision: to.Ptr[int64](1), - // Status: to.Ptr(armavs.DNSServiceStatusEnumSUCCESS), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_GetDnsService.json -func ExampleWorkloadNetworksClient_GetDNSService() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadNetworksClient().GetDNSService(ctx, "group1", "cloud1", "dnsService1", 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.WorkloadNetworkDNSService = armavs.WorkloadNetworkDNSService{ - // Name: to.Ptr("portMirroring1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/dnsServices"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/dnsServices/dnsService1"), - // Properties: &armavs.WorkloadNetworkDNSServiceProperties{ - // DefaultDNSZone: to.Ptr("defaultDnsZone1"), - // DisplayName: to.Ptr("dnsService1"), - // DNSServiceIP: to.Ptr("5.5.5.5"), - // FqdnZones: []*string{ - // to.Ptr("fqdnZone1")}, - // LogLevel: to.Ptr(armavs.DNSServiceLogLevelEnumINFO), - // Revision: to.Ptr[int64](1), - // Status: to.Ptr(armavs.DNSServiceStatusEnumSUCCESS), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_CreateDnsService.json -func ExampleWorkloadNetworksClient_BeginCreateDNSService() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWorkloadNetworksClient().BeginCreateDNSService(ctx, "group1", "cloud1", "dnsService1", armavs.WorkloadNetworkDNSService{ - Properties: &armavs.WorkloadNetworkDNSServiceProperties{ - DefaultDNSZone: to.Ptr("defaultDnsZone1"), - DisplayName: to.Ptr("dnsService1"), - DNSServiceIP: to.Ptr("5.5.5.5"), - FqdnZones: []*string{ - to.Ptr("fqdnZone1")}, - LogLevel: to.Ptr(armavs.DNSServiceLogLevelEnumINFO), - Revision: to.Ptr[int64](1), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.WorkloadNetworkDNSService = armavs.WorkloadNetworkDNSService{ - // Name: to.Ptr("dnsService1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/dnsServices"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/dnsServices/dnsService1"), - // Properties: &armavs.WorkloadNetworkDNSServiceProperties{ - // DefaultDNSZone: to.Ptr("defaultDnsZone1"), - // DisplayName: to.Ptr("dnsService1"), - // DNSServiceIP: to.Ptr("5.5.5.5"), - // FqdnZones: []*string{ - // to.Ptr("fqdnZone1")}, - // LogLevel: to.Ptr(armavs.DNSServiceLogLevelEnumINFO), - // Revision: to.Ptr[int64](1), - // Status: to.Ptr(armavs.DNSServiceStatusEnumSUCCESS), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_UpdateDnsService.json -func ExampleWorkloadNetworksClient_BeginUpdateDNSService() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWorkloadNetworksClient().BeginUpdateDNSService(ctx, "group1", "cloud1", "dnsService1", armavs.WorkloadNetworkDNSService{ - Properties: &armavs.WorkloadNetworkDNSServiceProperties{ - DefaultDNSZone: to.Ptr("defaultDnsZone1"), - DisplayName: to.Ptr("dnsService1"), - DNSServiceIP: to.Ptr("5.5.5.5"), - FqdnZones: []*string{ - to.Ptr("fqdnZone1")}, - LogLevel: to.Ptr(armavs.DNSServiceLogLevelEnumINFO), - Revision: to.Ptr[int64](1), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.WorkloadNetworkDNSService = armavs.WorkloadNetworkDNSService{ - // Name: to.Ptr("dnsService1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/dnsServices"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/dnsServices/dnsService1"), - // Properties: &armavs.WorkloadNetworkDNSServiceProperties{ - // DefaultDNSZone: to.Ptr("defaultDnsZone1"), - // DisplayName: to.Ptr("dnsService1"), - // DNSServiceIP: to.Ptr("5.5.5.5"), - // FqdnZones: []*string{ - // to.Ptr("fqdnZone1")}, - // LogLevel: to.Ptr(armavs.DNSServiceLogLevelEnumINFO), - // Revision: to.Ptr[int64](1), - // Status: to.Ptr(armavs.DNSServiceStatusEnumSUCCESS), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_DeleteDnsService.json -func ExampleWorkloadNetworksClient_BeginDeleteDNSService() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWorkloadNetworksClient().BeginDeleteDNSService(ctx, "group1", "dnsService1", "cloud1", 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/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_ListDnsZones.json -func ExampleWorkloadNetworksClient_NewListDNSZonesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWorkloadNetworksClient().NewListDNSZonesPager("group1", "cloud1", 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.WorkloadNetworkDNSZonesList = armavs.WorkloadNetworkDNSZonesList{ - // Value: []*armavs.WorkloadNetworkDNSZone{ - // { - // Name: to.Ptr("portMirroring1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/dnsZones"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/dnsZones/dnsZone1"), - // Properties: &armavs.WorkloadNetworkDNSZoneProperties{ - // DisplayName: to.Ptr("dnsZone1"), - // DNSServerIPs: []*string{ - // to.Ptr("1.1.1.1")}, - // DNSServices: to.Ptr[int64](0), - // Domain: []*string{ - // }, - // Revision: to.Ptr[int64](1), - // SourceIP: to.Ptr("8.8.8.8"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_GetDnsZone.json -func ExampleWorkloadNetworksClient_GetDNSZone() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadNetworksClient().GetDNSZone(ctx, "group1", "cloud1", "dnsZone1", 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.WorkloadNetworkDNSZone = armavs.WorkloadNetworkDNSZone{ - // Name: to.Ptr("portMirroring1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/dnsZones"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/dnsZones/dnsZone1"), - // Properties: &armavs.WorkloadNetworkDNSZoneProperties{ - // DisplayName: to.Ptr("dnsZone1"), - // DNSServerIPs: []*string{ - // to.Ptr("1.1.1.1")}, - // DNSServices: to.Ptr[int64](0), - // Domain: []*string{ - // }, - // Revision: to.Ptr[int64](1), - // SourceIP: to.Ptr("8.8.8.8"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_CreateDnsZone.json -func ExampleWorkloadNetworksClient_BeginCreateDNSZone() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWorkloadNetworksClient().BeginCreateDNSZone(ctx, "group1", "cloud1", "dnsZone1", armavs.WorkloadNetworkDNSZone{ - Properties: &armavs.WorkloadNetworkDNSZoneProperties{ - DisplayName: to.Ptr("dnsZone1"), - DNSServerIPs: []*string{ - to.Ptr("1.1.1.1")}, - Domain: []*string{}, - Revision: to.Ptr[int64](1), - SourceIP: to.Ptr("8.8.8.8"), - }, - }, 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.WorkloadNetworkDNSZone = armavs.WorkloadNetworkDNSZone{ - // Name: to.Ptr("dnsZone1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/dnsZones"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/dnsZones/dnsZone1"), - // Properties: &armavs.WorkloadNetworkDNSZoneProperties{ - // DisplayName: to.Ptr("dnsZone1"), - // DNSServerIPs: []*string{ - // to.Ptr("1.1.1.1")}, - // DNSServices: to.Ptr[int64](0), - // Domain: []*string{ - // }, - // Revision: to.Ptr[int64](1), - // SourceIP: to.Ptr("8.8.8.8"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_UpdateDnsZone.json -func ExampleWorkloadNetworksClient_BeginUpdateDNSZone() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWorkloadNetworksClient().BeginUpdateDNSZone(ctx, "group1", "cloud1", "dnsZone1", armavs.WorkloadNetworkDNSZone{ - Properties: &armavs.WorkloadNetworkDNSZoneProperties{ - DisplayName: to.Ptr("dnsZone1"), - DNSServerIPs: []*string{ - to.Ptr("1.1.1.1")}, - Domain: []*string{}, - Revision: to.Ptr[int64](1), - SourceIP: to.Ptr("8.8.8.8"), - }, - }, 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.WorkloadNetworkDNSZone = armavs.WorkloadNetworkDNSZone{ - // Name: to.Ptr("dnsZone1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/dnsZones"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/dnsZones/dnsZone1"), - // Properties: &armavs.WorkloadNetworkDNSZoneProperties{ - // DisplayName: to.Ptr("dnsZone1"), - // DNSServerIPs: []*string{ - // to.Ptr("1.1.1.1")}, - // DNSServices: to.Ptr[int64](0), - // Domain: []*string{ - // }, - // Revision: to.Ptr[int64](1), - // SourceIP: to.Ptr("8.8.8.8"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_DeleteDnsZone.json -func ExampleWorkloadNetworksClient_BeginDeleteDNSZone() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWorkloadNetworksClient().BeginDeleteDNSZone(ctx, "group1", "dnsZone1", "cloud1", 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/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_ListGateways.json -func ExampleWorkloadNetworksClient_NewListGatewaysPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWorkloadNetworksClient().NewListGatewaysPager("group1", "cloud1", 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.WorkloadNetworkGatewayList = armavs.WorkloadNetworkGatewayList{ - // Value: []*armavs.WorkloadNetworkGateway{ - // { - // Name: to.Ptr("gateway1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/segments"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/gateways/gateway1"), - // Properties: &armavs.WorkloadNetworkGatewayProperties{ - // Path: to.Ptr("/infra/tier-1s/gateway1"), - // DisplayName: to.Ptr("gateway1"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_GetGateway.json -func ExampleWorkloadNetworksClient_GetGateway() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadNetworksClient().GetGateway(ctx, "group1", "cloud1", "gateway1", 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.WorkloadNetworkGateway = armavs.WorkloadNetworkGateway{ - // Name: to.Ptr("gateway1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/gateways"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/gateways/gateway1"), - // Properties: &armavs.WorkloadNetworkGatewayProperties{ - // Path: to.Ptr("/infra/tier-1s/gateway1"), - // DisplayName: to.Ptr("gateway1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_ListPortMirroring.json -func ExampleWorkloadNetworksClient_NewListPortMirroringPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWorkloadNetworksClient().NewListPortMirroringPager("group1", "cloud1", 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.WorkloadNetworkPortMirroringList = armavs.WorkloadNetworkPortMirroringList{ - // Value: []*armavs.WorkloadNetworkPortMirroring{ - // { - // Name: to.Ptr("cloud1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/portMirroringProfiles"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/portMirroringProfiles/portMirroring1"), - // Properties: &armavs.WorkloadNetworkPortMirroringProperties{ - // Destination: to.Ptr("vmGroup2"), - // Direction: to.Ptr(armavs.PortMirroringDirectionEnumBIDIRECTIONAL), - // DisplayName: to.Ptr("portMirroring1"), - // Revision: to.Ptr[int64](1), - // Source: to.Ptr("vmGroup1"), - // Status: to.Ptr(armavs.PortMirroringStatusEnumSUCCESS), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_GetPortMirroring.json -func ExampleWorkloadNetworksClient_GetPortMirroring() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadNetworksClient().GetPortMirroring(ctx, "group1", "cloud1", "portMirroring1", 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.WorkloadNetworkPortMirroring = armavs.WorkloadNetworkPortMirroring{ - // Name: to.Ptr("portMirroring1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/portMirroringProfiles"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/portMirroringProfiles/portMirroring1"), - // Properties: &armavs.WorkloadNetworkPortMirroringProperties{ - // Destination: to.Ptr("vmGroup2"), - // Direction: to.Ptr(armavs.PortMirroringDirectionEnumBIDIRECTIONAL), - // DisplayName: to.Ptr("portMirroring1"), - // Revision: to.Ptr[int64](1), - // Source: to.Ptr("vmGroup1"), - // Status: to.Ptr(armavs.PortMirroringStatusEnumSUCCESS), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_CreatePortMirroring.json -func ExampleWorkloadNetworksClient_BeginCreatePortMirroring() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWorkloadNetworksClient().BeginCreatePortMirroring(ctx, "group1", "cloud1", "portMirroring1", armavs.WorkloadNetworkPortMirroring{ - Properties: &armavs.WorkloadNetworkPortMirroringProperties{ - Destination: to.Ptr("vmGroup2"), - Direction: to.Ptr(armavs.PortMirroringDirectionEnumBIDIRECTIONAL), - DisplayName: to.Ptr("portMirroring1"), - Revision: to.Ptr[int64](1), - Source: to.Ptr("vmGroup1"), - }, - }, 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.WorkloadNetworkPortMirroring = armavs.WorkloadNetworkPortMirroring{ - // Name: to.Ptr("portMirroring1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/portMirroringProfiles"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/portMirroringProfiles/portMirroring1"), - // Properties: &armavs.WorkloadNetworkPortMirroringProperties{ - // Destination: to.Ptr("vmGroup2"), - // Direction: to.Ptr(armavs.PortMirroringDirectionEnumBIDIRECTIONAL), - // DisplayName: to.Ptr("portMirroring1"), - // Revision: to.Ptr[int64](1), - // Source: to.Ptr("vmGroup1"), - // Status: to.Ptr(armavs.PortMirroringStatusEnumSUCCESS), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_UpdatePortMirroring.json -func ExampleWorkloadNetworksClient_BeginUpdatePortMirroring() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWorkloadNetworksClient().BeginUpdatePortMirroring(ctx, "group1", "cloud1", "portMirroring1", armavs.WorkloadNetworkPortMirroring{ - Properties: &armavs.WorkloadNetworkPortMirroringProperties{ - Destination: to.Ptr("vmGroup2"), - Direction: to.Ptr(armavs.PortMirroringDirectionEnumBIDIRECTIONAL), - Revision: to.Ptr[int64](1), - Source: to.Ptr("vmGroup1"), - }, - }, 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.WorkloadNetworkPortMirroring = armavs.WorkloadNetworkPortMirroring{ - // Name: to.Ptr("portMirroring1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/portMirroringProfiles"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/portMirroringProfiles/portMirroring1"), - // Properties: &armavs.WorkloadNetworkPortMirroringProperties{ - // Destination: to.Ptr("vmGroup2"), - // Direction: to.Ptr(armavs.PortMirroringDirectionEnumBIDIRECTIONAL), - // DisplayName: to.Ptr("portMirroring1"), - // Revision: to.Ptr[int64](2), - // Source: to.Ptr("vmGroup1"), - // Status: to.Ptr(armavs.PortMirroringStatusEnumSUCCESS), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_DeletePortMirroring.json -func ExampleWorkloadNetworksClient_BeginDeletePortMirroring() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWorkloadNetworksClient().BeginDeletePortMirroring(ctx, "group1", "portMirroring1", "cloud1", 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/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_ListPublicIPs.json -func ExampleWorkloadNetworksClient_NewListPublicIPsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWorkloadNetworksClient().NewListPublicIPsPager("group1", "cloud1", 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.WorkloadNetworkPublicIPsList = armavs.WorkloadNetworkPublicIPsList{ - // Value: []*armavs.WorkloadNetworkPublicIP{ - // { - // Name: to.Ptr("publicIP1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/publicIPs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/publicIPs/publicIP1"), - // Properties: &armavs.WorkloadNetworkPublicIPProperties{ - // DisplayName: to.Ptr("publicIP1"), - // PublicIPBlock: to.Ptr("20.20.40.50/32"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_GetPublicIP.json -func ExampleWorkloadNetworksClient_GetPublicIP() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadNetworksClient().GetPublicIP(ctx, "group1", "cloud1", "publicIP1", 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.WorkloadNetworkPublicIP = armavs.WorkloadNetworkPublicIP{ - // Name: to.Ptr("publicIP1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/publicIPs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/publicIPs/publicIP1"), - // Properties: &armavs.WorkloadNetworkPublicIPProperties{ - // DisplayName: to.Ptr("publicIP1"), - // PublicIPBlock: to.Ptr("20.20.40.50/32"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_CreatePublicIP.json -func ExampleWorkloadNetworksClient_BeginCreatePublicIP() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWorkloadNetworksClient().BeginCreatePublicIP(ctx, "group1", "cloud1", "publicIP1", armavs.WorkloadNetworkPublicIP{ - Properties: &armavs.WorkloadNetworkPublicIPProperties{ - DisplayName: to.Ptr("publicIP1"), - NumberOfPublicIPs: to.Ptr[int64](32), - }, - }, 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.WorkloadNetworkPublicIP = armavs.WorkloadNetworkPublicIP{ - // Name: to.Ptr("publicIP1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/publicIPs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/publicIPs/publicIP1"), - // Properties: &armavs.WorkloadNetworkPublicIPProperties{ - // DisplayName: to.Ptr("publicIP1"), - // PublicIPBlock: to.Ptr("20.20.40.50/32"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_DeletePublicIP.json -func ExampleWorkloadNetworksClient_BeginDeletePublicIP() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWorkloadNetworksClient().BeginDeletePublicIP(ctx, "group1", "publicIP1", "cloud1", 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/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_ListSegments.json -func ExampleWorkloadNetworksClient_NewListSegmentsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWorkloadNetworksClient().NewListSegmentsPager("group1", "cloud1", 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.WorkloadNetworkSegmentsList = armavs.WorkloadNetworkSegmentsList{ - // Value: []*armavs.WorkloadNetworkSegment{ - // { - // Name: to.Ptr("segment1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/segments"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/segments/segment1"), - // Properties: &armavs.WorkloadNetworkSegmentProperties{ - // ConnectedGateway: to.Ptr("/infra/tier-1s/gateway"), - // DisplayName: to.Ptr("segment1"), - // PortVif: []*armavs.WorkloadNetworkSegmentPortVif{ - // { - // PortName: to.Ptr("vm1"), - // }}, - // Revision: to.Ptr[int64](1), - // Status: to.Ptr(armavs.SegmentStatusEnumSUCCESS), - // Subnet: &armavs.WorkloadNetworkSegmentSubnet{ - // DhcpRanges: []*string{ - // to.Ptr("40.20.0.0-40.20.0.1")}, - // GatewayAddress: to.Ptr("40.20.20.20/16"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_GetSegment.json -func ExampleWorkloadNetworksClient_GetSegment() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadNetworksClient().GetSegment(ctx, "group1", "cloud1", "segment1", 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.WorkloadNetworkSegment = armavs.WorkloadNetworkSegment{ - // Name: to.Ptr("segment1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/segments"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/segments/segment1"), - // Properties: &armavs.WorkloadNetworkSegmentProperties{ - // ConnectedGateway: to.Ptr("/infra/tier-1s/gateway"), - // DisplayName: to.Ptr("segment1"), - // PortVif: []*armavs.WorkloadNetworkSegmentPortVif{ - // { - // PortName: to.Ptr("vm1"), - // }}, - // Revision: to.Ptr[int64](1), - // Status: to.Ptr(armavs.SegmentStatusEnumSUCCESS), - // Subnet: &armavs.WorkloadNetworkSegmentSubnet{ - // DhcpRanges: []*string{ - // to.Ptr("40.20.0.0-40.20.0.1")}, - // GatewayAddress: to.Ptr("40.20.20.20/16"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_CreateSegments.json -func ExampleWorkloadNetworksClient_BeginCreateSegments() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWorkloadNetworksClient().BeginCreateSegments(ctx, "group1", "cloud1", "segment1", armavs.WorkloadNetworkSegment{ - Properties: &armavs.WorkloadNetworkSegmentProperties{ - ConnectedGateway: to.Ptr("/infra/tier-1s/gateway"), - DisplayName: to.Ptr("segment1"), - Revision: to.Ptr[int64](1), - Subnet: &armavs.WorkloadNetworkSegmentSubnet{ - DhcpRanges: []*string{ - to.Ptr("40.20.0.0-40.20.0.1")}, - GatewayAddress: to.Ptr("40.20.20.20/16"), - }, - }, - }, 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.WorkloadNetworkSegment = armavs.WorkloadNetworkSegment{ - // Name: to.Ptr("segment1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/segments"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/segments/segment1"), - // Properties: &armavs.WorkloadNetworkSegmentProperties{ - // ConnectedGateway: to.Ptr("/infra/tier-1s/gateway"), - // DisplayName: to.Ptr("segment1"), - // PortVif: []*armavs.WorkloadNetworkSegmentPortVif{ - // }, - // Revision: to.Ptr[int64](1), - // Status: to.Ptr(armavs.SegmentStatusEnumSUCCESS), - // Subnet: &armavs.WorkloadNetworkSegmentSubnet{ - // DhcpRanges: []*string{ - // to.Ptr("40.20.0.0-40.20.0.1")}, - // GatewayAddress: to.Ptr("40.20.20.20/16"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_UpdateSegments.json -func ExampleWorkloadNetworksClient_BeginUpdateSegments() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWorkloadNetworksClient().BeginUpdateSegments(ctx, "group1", "cloud1", "segment1", armavs.WorkloadNetworkSegment{ - Properties: &armavs.WorkloadNetworkSegmentProperties{ - ConnectedGateway: to.Ptr("/infra/tier-1s/gateway"), - Revision: to.Ptr[int64](1), - Subnet: &armavs.WorkloadNetworkSegmentSubnet{ - DhcpRanges: []*string{ - to.Ptr("40.20.0.0-40.20.0.1")}, - GatewayAddress: to.Ptr("40.20.20.20/16"), - }, - }, - }, 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.WorkloadNetworkSegment = armavs.WorkloadNetworkSegment{ - // Name: to.Ptr("segment1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/segments"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/segments/segment1"), - // Properties: &armavs.WorkloadNetworkSegmentProperties{ - // ConnectedGateway: to.Ptr("/infra/tier-1s/gateway"), - // DisplayName: to.Ptr("segment1"), - // PortVif: []*armavs.WorkloadNetworkSegmentPortVif{ - // { - // PortName: to.Ptr("vm1"), - // }}, - // Revision: to.Ptr[int64](2), - // Status: to.Ptr(armavs.SegmentStatusEnumSUCCESS), - // Subnet: &armavs.WorkloadNetworkSegmentSubnet{ - // DhcpRanges: []*string{ - // to.Ptr("40.20.0.0-40.20.0.1")}, - // GatewayAddress: to.Ptr("40.20.20.20/16"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_DeleteSegment.json -func ExampleWorkloadNetworksClient_BeginDeleteSegment() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWorkloadNetworksClient().BeginDeleteSegment(ctx, "group1", "cloud1", "segment1", 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/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_ListVirtualMachines.json -func ExampleWorkloadNetworksClient_NewListVirtualMachinesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWorkloadNetworksClient().NewListVirtualMachinesPager("group1", "cloud1", 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.WorkloadNetworkVirtualMachinesList = armavs.WorkloadNetworkVirtualMachinesList{ - // Value: []*armavs.WorkloadNetworkVirtualMachine{ - // { - // Name: to.Ptr("vm1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/virtualMachines"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/virtualMachines/vm1"), - // Properties: &armavs.WorkloadNetworkVirtualMachineProperties{ - // DisplayName: to.Ptr("vm1"), - // VMType: to.Ptr(armavs.VMTypeEnumREGULAR), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_GetVirtualMachine.json -func ExampleWorkloadNetworksClient_GetVirtualMachine() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadNetworksClient().GetVirtualMachine(ctx, "group1", "cloud1", "vm1", 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.WorkloadNetworkVirtualMachine = armavs.WorkloadNetworkVirtualMachine{ - // Name: to.Ptr("vm1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/virtualMachines"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/virtualMachines/vm1"), - // Properties: &armavs.WorkloadNetworkVirtualMachineProperties{ - // DisplayName: to.Ptr("vm1"), - // VMType: to.Ptr(armavs.VMTypeEnumREGULAR), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_ListVMGroups.json -func ExampleWorkloadNetworksClient_NewListVMGroupsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWorkloadNetworksClient().NewListVMGroupsPager("group1", "cloud1", 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.WorkloadNetworkVMGroupsList = armavs.WorkloadNetworkVMGroupsList{ - // Value: []*armavs.WorkloadNetworkVMGroup{ - // { - // Name: to.Ptr("cloud1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/vmGroups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/vmGroups/vmGroup1"), - // Properties: &armavs.WorkloadNetworkVMGroupProperties{ - // DisplayName: to.Ptr("vmGroup1"), - // Members: []*string{ - // to.Ptr("564d43da-fefc-2a3b-1d92-42855622fa50")}, - // Revision: to.Ptr[int64](1), - // Status: to.Ptr(armavs.VMGroupStatusEnumSUCCESS), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_GetVMGroup.json -func ExampleWorkloadNetworksClient_GetVMGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkloadNetworksClient().GetVMGroup(ctx, "group1", "cloud1", "vmGroup1", 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.WorkloadNetworkVMGroup = armavs.WorkloadNetworkVMGroup{ - // Name: to.Ptr("cloud1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/vmGroups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/vmGroups/vmGroup1"), - // Properties: &armavs.WorkloadNetworkVMGroupProperties{ - // DisplayName: to.Ptr("vmGroup1"), - // Members: []*string{ - // to.Ptr("564d43da-fefc-2a3b-1d92-42855622fa50")}, - // Revision: to.Ptr[int64](1), - // Status: to.Ptr(armavs.VMGroupStatusEnumSUCCESS), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_CreateVMGroup.json -func ExampleWorkloadNetworksClient_BeginCreateVMGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWorkloadNetworksClient().BeginCreateVMGroup(ctx, "group1", "cloud1", "vmGroup1", armavs.WorkloadNetworkVMGroup{ - Properties: &armavs.WorkloadNetworkVMGroupProperties{ - DisplayName: to.Ptr("vmGroup1"), - Members: []*string{ - to.Ptr("564d43da-fefc-2a3b-1d92-42855622fa50")}, - Revision: to.Ptr[int64](1), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.WorkloadNetworkVMGroup = armavs.WorkloadNetworkVMGroup{ - // Name: to.Ptr("vmGroup1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/vmGroups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/vmGroups/vmGroup1"), - // Properties: &armavs.WorkloadNetworkVMGroupProperties{ - // DisplayName: to.Ptr("vmGroup1"), - // Members: []*string{ - // to.Ptr("564d43da-fefc-2a3b-1d92-42855622fa50")}, - // Revision: to.Ptr[int64](1), - // Status: to.Ptr(armavs.VMGroupStatusEnumSUCCESS), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_UpdateVMGroup.json -func ExampleWorkloadNetworksClient_BeginUpdateVMGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWorkloadNetworksClient().BeginUpdateVMGroup(ctx, "group1", "cloud1", "vmGroup1", armavs.WorkloadNetworkVMGroup{ - Properties: &armavs.WorkloadNetworkVMGroupProperties{ - Members: []*string{ - to.Ptr("564d43da-fefc-2a3b-1d92-42855622fa50")}, - Revision: to.Ptr[int64](1), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.WorkloadNetworkVMGroup = armavs.WorkloadNetworkVMGroup{ - // Name: to.Ptr("cloud1"), - // Type: to.Ptr("Microsoft.AVS/privateClouds/workloadNetworks/vmGroups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AVS/privateClouds/cloud1/workloadNetworks/default/vmGroups/vmGroup1"), - // Properties: &armavs.WorkloadNetworkVMGroupProperties{ - // DisplayName: to.Ptr("vmGroup1"), - // Members: []*string{ - // to.Ptr("564d43da-fefc-2a3b-1d92-42855622fa50")}, - // Revision: to.Ptr[int64](2), - // Status: to.Ptr(armavs.VMGroupStatusEnumSUCCESS), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e7678455846b1000fd31db27596e4ca3d299a872/specification/vmware/resource-manager/Microsoft.AVS/stable/2023-09-01/examples/WorkloadNetworks_DeleteVMGroup.json -func ExampleWorkloadNetworksClient_BeginDeleteVMGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armavs.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewWorkloadNetworksClient().BeginDeleteVMGroup(ctx, "group1", "vmGroup1", "cloud1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/chaos/armchaos/CHANGELOG.md b/sdk/resourcemanager/chaos/armchaos/CHANGELOG.md index 66d880b0bc91..b0d3d47ec7bb 100644 --- a/sdk/resourcemanager/chaos/armchaos/CHANGELOG.md +++ b/sdk/resourcemanager/chaos/armchaos/CHANGELOG.md @@ -1,5 +1,38 @@ # Release History +## 2.0.0 (2025-04-27) +### Breaking Changes + +- Type of `ContinuousAction.Type` has been changed from `*string` to `*ExperimentActionType` +- Type of `DelayAction.Type` has been changed from `*string` to `*ExperimentActionType` +- Type of `DiscreteAction.Type` has been changed from `*string` to `*ExperimentActionType` +- Type of `Experiment.Identity` has been changed from `*ResourceIdentity` to `*ManagedServiceIdentity` +- Type of `ExperimentAction.Type` has been changed from `*string` to `*ExperimentActionType` +- Type of `ExperimentUpdate.Identity` has been changed from `*ResourceIdentity` to `*ManagedServiceIdentity` +- Enum `ResourceIdentityType` has been removed +- Struct `OperationStatus` has been removed +- Struct `ResourceIdentity` has been removed +- Field `Location` of struct `CapabilityType` has been removed +- Field `OperationStatus` of struct `OperationStatusesClientGetResponse` has been removed +- Field `AdditionalProperties` of struct `TargetListSelector` has been removed +- Field `AdditionalProperties` of struct `TargetQuerySelector` has been removed +- Field `AdditionalProperties` of struct `TargetSelector` has been removed +- Field `Location` of struct `TargetType` has been removed + +### Features Added + +- New enum type `ExperimentActionType` with values `ExperimentActionTypeContinuous`, `ExperimentActionTypeDelay`, `ExperimentActionTypeDiscrete` +- New enum type `ManagedServiceIdentityType` with values `ManagedServiceIdentityTypeNone`, `ManagedServiceIdentityTypeSystemAssigned`, `ManagedServiceIdentityTypeSystemAssignedUserAssigned`, `ManagedServiceIdentityTypeUserAssigned` +- New struct `ManagedServiceIdentity` +- New struct `OperationStatusResult` +- New struct `ProxyResource` +- New field `RequiredAzureRoleDefinitionIDs` in struct `CapabilityTypeProperties` +- New field `SystemData` in struct `ExperimentExecution` +- New anonymous field `OperationStatusResult` in struct `OperationStatusesClientGetResponse` +- New field `SystemData` in struct `Resource` +- New field `SystemData` in struct `TrackedResource` + + ## 1.1.0 (2024-03-22) ### Features Added diff --git a/sdk/resourcemanager/chaos/armchaos/README.md b/sdk/resourcemanager/chaos/armchaos/README.md index f2f15e905827..b527df1268d1 100644 --- a/sdk/resourcemanager/chaos/armchaos/README.md +++ b/sdk/resourcemanager/chaos/armchaos/README.md @@ -19,7 +19,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure Chaos module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2 ``` ## Authorization diff --git a/sdk/resourcemanager/chaos/armchaos/autorest.md b/sdk/resourcemanager/chaos/armchaos/autorest.md index b9f219695dcc..7d1b91bb3d83 100644 --- a/sdk/resourcemanager/chaos/armchaos/autorest.md +++ b/sdk/resourcemanager/chaos/armchaos/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/chaos/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/chaos/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.1.0 -tag: package-2024-01 +module-version: 2.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/chaos/armchaos/capabilities_client.go b/sdk/resourcemanager/chaos/armchaos/capabilities_client.go index 74d548e166ec..a3073ab26723 100644 --- a/sdk/resourcemanager/chaos/armchaos/capabilities_client.go +++ b/sdk/resourcemanager/chaos/armchaos/capabilities_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 CapabilitiesClient struct { } // NewCapabilitiesClient creates a new instance of CapabilitiesClient with the specified values. -// - subscriptionID - GUID that represents an Azure subscription ID. +// - 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 NewCapabilitiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CapabilitiesClient, error) { @@ -46,23 +43,23 @@ func NewCapabilitiesClient(subscriptionID string, credential azcore.TokenCredent // CreateOrUpdate - Create or update a Capability resource that extends a Target resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. -// - parentProviderNamespace - String that represents a resource provider namespace. -// - parentResourceType - String that represents a resource type. -// - parentResourceName - String that represents a resource name. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - parentProviderNamespace - The parent resource provider namespace. +// - parentResourceType - The parent resource type. +// - parentResourceName - The parent resource name. // - targetName - String that represents a Target resource name. // - capabilityName - String that represents a Capability resource name. -// - capability - Capability resource to be created or updated. +// - resource - Capability resource to be created or updated. // - options - CapabilitiesClientCreateOrUpdateOptions contains the optional parameters for the CapabilitiesClient.CreateOrUpdate // method. -func (client *CapabilitiesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, capabilityName string, capability Capability, options *CapabilitiesClientCreateOrUpdateOptions) (CapabilitiesClientCreateOrUpdateResponse, error) { +func (client *CapabilitiesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, capabilityName string, resource Capability, options *CapabilitiesClientCreateOrUpdateOptions) (CapabilitiesClientCreateOrUpdateResponse, error) { var err error const operationName = "CapabilitiesClient.CreateOrUpdate" 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, parentProviderNamespace, parentResourceType, parentResourceName, targetName, capabilityName, capability, options) + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, targetName, capabilityName, resource, options) if err != nil { return CapabilitiesClientCreateOrUpdateResponse{}, err } @@ -70,7 +67,7 @@ func (client *CapabilitiesClient) CreateOrUpdate(ctx context.Context, resourceGr if err != nil { return CapabilitiesClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { err = runtime.NewResponseError(httpResp) return CapabilitiesClientCreateOrUpdateResponse{}, err } @@ -79,7 +76,7 @@ func (client *CapabilitiesClient) CreateOrUpdate(ctx context.Context, resourceGr } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *CapabilitiesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, capabilityName string, capability Capability, options *CapabilitiesClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *CapabilitiesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, capabilityName string, resource Capability, _ *CapabilitiesClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -114,10 +111,10 @@ func (client *CapabilitiesClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, capability); err != nil { + if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } return req, nil @@ -135,11 +132,11 @@ func (client *CapabilitiesClient) createOrUpdateHandleResponse(resp *http.Respon // Delete - Delete a Capability that extends a Target resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. -// - parentProviderNamespace - String that represents a resource provider namespace. -// - parentResourceType - String that represents a resource type. -// - parentResourceName - String that represents a resource name. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - parentProviderNamespace - The parent resource provider namespace. +// - parentResourceType - The parent resource type. +// - parentResourceName - The parent resource name. // - targetName - String that represents a Target resource name. // - capabilityName - String that represents a Capability resource name. // - options - CapabilitiesClientDeleteOptions contains the optional parameters for the CapabilitiesClient.Delete method. @@ -165,7 +162,7 @@ func (client *CapabilitiesClient) Delete(ctx context.Context, resourceGroupName } // deleteCreateRequest creates the Delete request. -func (client *CapabilitiesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, capabilityName string, options *CapabilitiesClientDeleteOptions) (*policy.Request, error) { +func (client *CapabilitiesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, capabilityName string, _ *CapabilitiesClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -200,7 +197,7 @@ func (client *CapabilitiesClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -209,11 +206,11 @@ func (client *CapabilitiesClient) deleteCreateRequest(ctx context.Context, resou // Get - Get a Capability resource that extends a Target resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. -// - parentProviderNamespace - String that represents a resource provider namespace. -// - parentResourceType - String that represents a resource type. -// - parentResourceName - String that represents a resource name. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - parentProviderNamespace - The parent resource provider namespace. +// - parentResourceType - The parent resource type. +// - parentResourceName - The parent resource name. // - targetName - String that represents a Target resource name. // - capabilityName - String that represents a Capability resource name. // - options - CapabilitiesClientGetOptions contains the optional parameters for the CapabilitiesClient.Get method. @@ -240,7 +237,7 @@ func (client *CapabilitiesClient) Get(ctx context.Context, resourceGroupName str } // getCreateRequest creates the Get request. -func (client *CapabilitiesClient) getCreateRequest(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, capabilityName string, options *CapabilitiesClientGetOptions) (*policy.Request, error) { +func (client *CapabilitiesClient) getCreateRequest(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, capabilityName string, _ *CapabilitiesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -275,7 +272,7 @@ func (client *CapabilitiesClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -290,13 +287,13 @@ func (client *CapabilitiesClient) getHandleResponse(resp *http.Response) (Capabi return result, nil } -// NewListPager - Get a list of Capability resources that extend a Target resource.. +// NewListPager - Get a list of Capability resources that extend a Target resource. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. -// - parentProviderNamespace - String that represents a resource provider namespace. -// - parentResourceType - String that represents a resource type. -// - parentResourceName - String that represents a resource name. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - parentProviderNamespace - The parent resource provider namespace. +// - parentResourceType - The parent resource type. +// - parentResourceName - The parent resource name. // - targetName - String that represents a Target resource name. // - options - CapabilitiesClientListOptions contains the optional parameters for the CapabilitiesClient.NewListPager method. func (client *CapabilitiesClient) NewListPager(resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, options *CapabilitiesClientListOptions) *runtime.Pager[CapabilitiesClientListResponse] { @@ -354,7 +351,7 @@ func (client *CapabilitiesClient) listCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") if options != nil && options.ContinuationToken != nil { reqQP.Set("continuationToken", *options.ContinuationToken) } diff --git a/sdk/resourcemanager/chaos/armchaos/capabilities_client_example_test.go b/sdk/resourcemanager/chaos/armchaos/capabilities_client_example_test.go deleted file mode 100644 index b4d2220e83e1..000000000000 --- a/sdk/resourcemanager/chaos/armchaos/capabilities_client_example_test.go +++ /dev/null @@ -1,153 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armchaos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListCapabilities.json -func ExampleCapabilitiesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCapabilitiesClient().NewListPager("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-VirtualMachine", &armchaos.CapabilitiesClientListOptions{ContinuationToken: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CapabilityListResult = armchaos.CapabilityListResult{ - // Value: []*armchaos.Capability{ - // { - // Name: to.Ptr("Shutdown-1.0"), - // Type: to.Ptr("Microsoft.Chaos/targets/capabilities"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0"), - // Properties: &armchaos.CapabilityProperties{ - // Description: to.Ptr("Shutdown an Azure Virtual Machine for a defined period of time."), - // ParametersSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json"), - // Publisher: to.Ptr("Microsoft"), - // TargetType: to.Ptr("VirtualMachine"), - // Urn: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"), - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-14T05:08:38.466Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-14T05:08:38.466Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetCapability.json -func ExampleCapabilitiesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCapabilitiesClient().Get(ctx, "exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-VirtualMachine", "Shutdown-1.0", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Capability = armchaos.Capability{ - // Name: to.Ptr("Shutdown-1.0"), - // Type: to.Ptr("Microsoft.Chaos/targets/capabilities"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0"), - // Properties: &armchaos.CapabilityProperties{ - // Description: to.Ptr("Shutdown an Azure Virtual Machine for a defined period of time."), - // ParametersSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json"), - // Publisher: to.Ptr("Microsoft"), - // TargetType: to.Ptr("VirtualMachine"), - // Urn: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"), - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-14T05:08:38.466Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-14T05:08:38.466Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DeleteCapability.json -func ExampleCapabilitiesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewCapabilitiesClient().Delete(ctx, "exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-VirtualMachine", "Shutdown-1.0", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/CreateUpdateCapability.json -func ExampleCapabilitiesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCapabilitiesClient().CreateOrUpdate(ctx, "exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-VirtualMachine", "Shutdown-1.0", armchaos.Capability{ - Properties: &armchaos.CapabilityProperties{}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Capability = armchaos.Capability{ - // Name: to.Ptr("Shutdown-1.0"), - // Type: to.Ptr("Microsoft.Chaos/targets/capabilities"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0"), - // Properties: &armchaos.CapabilityProperties{ - // Description: to.Ptr("Shutdown an Azure Virtual Machine for a defined period of time."), - // ParametersSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json"), - // Publisher: to.Ptr("Microsoft"), - // TargetType: to.Ptr("VirtualMachine"), - // Urn: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"), - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-14T05:08:38.466Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-14T05:08:38.466Z"); return t}()), - // }, - // } -} diff --git a/sdk/resourcemanager/chaos/armchaos/capabilities_live_test.go b/sdk/resourcemanager/chaos/armchaos/capabilities_live_test.go index a81b322e53d5..d29576907918 100644 --- a/sdk/resourcemanager/chaos/armchaos/capabilities_live_test.go +++ b/sdk/resourcemanager/chaos/armchaos/capabilities_live_test.go @@ -15,7 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3/testutil" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" "github.com/stretchr/testify/suite" diff --git a/sdk/resourcemanager/chaos/armchaos/capabilitytypes_client.go b/sdk/resourcemanager/chaos/armchaos/capabilitytypes_client.go index e5573ac5209b..75ea3f43c500 100644 --- a/sdk/resourcemanager/chaos/armchaos/capabilitytypes_client.go +++ b/sdk/resourcemanager/chaos/armchaos/capabilitytypes_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 CapabilityTypesClient struct { } // NewCapabilityTypesClient creates a new instance of CapabilityTypesClient with the specified values. -// - subscriptionID - GUID that represents an Azure subscription ID. +// - 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 NewCapabilityTypesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CapabilityTypesClient, error) { @@ -46,18 +43,18 @@ func NewCapabilityTypesClient(subscriptionID string, credential azcore.TokenCred // Get - Get a Capability Type resource for given Target Type and location. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - locationName - String that represents a Location resource name. +// Generated from API version 2025-01-01 +// - location - The name of the Azure region. // - targetTypeName - String that represents a Target Type resource name. // - capabilityTypeName - String that represents a Capability Type resource name. // - options - CapabilityTypesClientGetOptions contains the optional parameters for the CapabilityTypesClient.Get method. -func (client *CapabilityTypesClient) Get(ctx context.Context, locationName string, targetTypeName string, capabilityTypeName string, options *CapabilityTypesClientGetOptions) (CapabilityTypesClientGetResponse, error) { +func (client *CapabilityTypesClient) Get(ctx context.Context, location string, targetTypeName string, capabilityTypeName string, options *CapabilityTypesClientGetOptions) (CapabilityTypesClientGetResponse, error) { var err error const operationName = "CapabilityTypesClient.Get" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, locationName, targetTypeName, capabilityTypeName, options) + req, err := client.getCreateRequest(ctx, location, targetTypeName, capabilityTypeName, options) if err != nil { return CapabilityTypesClientGetResponse{}, err } @@ -74,16 +71,16 @@ func (client *CapabilityTypesClient) Get(ctx context.Context, locationName strin } // getCreateRequest creates the Get request. -func (client *CapabilityTypesClient) getCreateRequest(ctx context.Context, locationName string, targetTypeName string, capabilityTypeName string, options *CapabilityTypesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}/capabilityTypes/{capabilityTypeName}" +func (client *CapabilityTypesClient) getCreateRequest(ctx context.Context, location string, targetTypeName string, capabilityTypeName string, _ *CapabilityTypesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{location}/targetTypes/{targetTypeName}/capabilityTypes/{capabilityTypeName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if locationName == "" { - return nil, errors.New("parameter locationName cannot be empty") + if location == "" { + return nil, errors.New("parameter location cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) if targetTypeName == "" { return nil, errors.New("parameter targetTypeName cannot be empty") } @@ -97,7 +94,7 @@ func (client *CapabilityTypesClient) getCreateRequest(ctx context.Context, locat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -114,12 +111,12 @@ func (client *CapabilityTypesClient) getHandleResponse(resp *http.Response) (Cap // NewListPager - Get a list of Capability Type resources for given Target Type and location. // -// Generated from API version 2024-01-01 -// - locationName - String that represents a Location resource name. +// Generated from API version 2025-01-01 +// - location - The name of the Azure region. // - targetTypeName - String that represents a Target Type resource name. // - options - CapabilityTypesClientListOptions contains the optional parameters for the CapabilityTypesClient.NewListPager // method. -func (client *CapabilityTypesClient) NewListPager(locationName string, targetTypeName string, options *CapabilityTypesClientListOptions) *runtime.Pager[CapabilityTypesClientListResponse] { +func (client *CapabilityTypesClient) NewListPager(location string, targetTypeName string, options *CapabilityTypesClientListOptions) *runtime.Pager[CapabilityTypesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[CapabilityTypesClientListResponse]{ More: func(page CapabilityTypesClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -131,7 +128,7 @@ func (client *CapabilityTypesClient) NewListPager(locationName string, targetTyp nextLink = *page.NextLink } resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, locationName, targetTypeName, options) + return client.listCreateRequest(ctx, location, targetTypeName, options) }, nil) if err != nil { return CapabilityTypesClientListResponse{}, err @@ -143,16 +140,16 @@ func (client *CapabilityTypesClient) NewListPager(locationName string, targetTyp } // listCreateRequest creates the List request. -func (client *CapabilityTypesClient) listCreateRequest(ctx context.Context, locationName string, targetTypeName string, options *CapabilityTypesClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}/capabilityTypes" +func (client *CapabilityTypesClient) listCreateRequest(ctx context.Context, location string, targetTypeName string, options *CapabilityTypesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{location}/targetTypes/{targetTypeName}/capabilityTypes" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if locationName == "" { - return nil, errors.New("parameter locationName cannot be empty") + if location == "" { + return nil, errors.New("parameter location cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) if targetTypeName == "" { return nil, errors.New("parameter targetTypeName cannot be empty") } @@ -162,7 +159,7 @@ func (client *CapabilityTypesClient) listCreateRequest(ctx context.Context, loca return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") if options != nil && options.ContinuationToken != nil { reqQP.Set("continuationToken", *options.ContinuationToken) } diff --git a/sdk/resourcemanager/chaos/armchaos/capabilitytypes_client_example_test.go b/sdk/resourcemanager/chaos/armchaos/capabilitytypes_client_example_test.go deleted file mode 100644 index 8c3ecedd0c1a..000000000000 --- a/sdk/resourcemanager/chaos/armchaos/capabilitytypes_client_example_test.go +++ /dev/null @@ -1,100 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armchaos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListCapabilityTypes.json -func ExampleCapabilityTypesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCapabilityTypesClient().NewListPager("westus2", "Microsoft-VirtualMachine", &armchaos.CapabilityTypesClientListOptions{ContinuationToken: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CapabilityTypeListResult = armchaos.CapabilityTypeListResult{ - // Value: []*armchaos.CapabilityType{ - // { - // Name: to.Ptr("Shutdown-1.0"), - // Type: to.Ptr("Microsoft.Chaos/locations/targetTypes/capabilityTypes"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/providers/Microsoft.Chaos/locations/westus2/targetTypes/Microsoft-VirtualMachine/capabilityTypes/Shutdown-1.0"), - // Properties: &armchaos.CapabilityTypeProperties{ - // Description: to.Ptr("Shutdown an Azure Virtual Machine for a defined period of time."), - // DisplayName: to.Ptr("Shutdown VM"), - // Kind: to.Ptr("fault"), - // ParametersSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json"), - // Publisher: to.Ptr("Microsoft"), - // RuntimeProperties: &armchaos.CapabilityTypePropertiesRuntimeProperties{ - // Kind: to.Ptr("continuous"), - // }, - // TargetType: to.Ptr("VirtualMachine"), - // Urn: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetCapabilityType.json -func ExampleCapabilityTypesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCapabilityTypesClient().Get(ctx, "westus2", "Microsoft-VirtualMachine", "Shutdown-1.0", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CapabilityType = armchaos.CapabilityType{ - // Name: to.Ptr("Shutdown-1.0"), - // Type: to.Ptr("Microsoft.Chaos/locations/targetTypes/capabilityTypes"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/Microsoft.Chaos/locations/westus2/targetTypes/Microsoft-VirtualMachine/capabilityTypes/Shutdown-1.0"), - // Properties: &armchaos.CapabilityTypeProperties{ - // Description: to.Ptr("Shutdown an Azure Virtual Machine for a defined period of time."), - // DisplayName: to.Ptr("Shutdown VM"), - // Kind: to.Ptr("fault"), - // ParametersSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json"), - // Publisher: to.Ptr("Microsoft"), - // RuntimeProperties: &armchaos.CapabilityTypePropertiesRuntimeProperties{ - // Kind: to.Ptr("continuous"), - // }, - // TargetType: to.Ptr("VirtualMachine"), - // Urn: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"), - // }, - // } -} diff --git a/sdk/resourcemanager/chaos/armchaos/capabilitytypes_live_test.go b/sdk/resourcemanager/chaos/armchaos/capabilitytypes_live_test.go index 645111fd6af6..8f9d703db531 100644 --- a/sdk/resourcemanager/chaos/armchaos/capabilitytypes_live_test.go +++ b/sdk/resourcemanager/chaos/armchaos/capabilitytypes_live_test.go @@ -14,7 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3/testutil" "github.com/stretchr/testify/suite" ) diff --git a/sdk/resourcemanager/chaos/armchaos/client_factory.go b/sdk/resourcemanager/chaos/armchaos/client_factory.go index 6f27987f337c..ab00e9d9484f 100644 --- a/sdk/resourcemanager/chaos/armchaos/client_factory.go +++ b/sdk/resourcemanager/chaos/armchaos/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. @@ -22,7 +19,7 @@ type ClientFactory struct { // NewClientFactory creates a new instance of ClientFactory with the specified values. // The parameter values will be propagated to any client created from this factory. -// - subscriptionID - GUID that represents an Azure subscription ID. +// - 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) { diff --git a/sdk/resourcemanager/chaos/armchaos/constants.go b/sdk/resourcemanager/chaos/armchaos/constants.go index c3bb6f1fd184..8d82e7dd26ec 100644 --- a/sdk/resourcemanager/chaos/armchaos/constants.go +++ b/sdk/resourcemanager/chaos/armchaos/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 armchaos const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" - moduleVersion = "v1.1.0" + moduleVersion = "v2.0.0" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -47,10 +44,29 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } +// ExperimentActionType - Enum union of Chaos experiment action types. +type ExperimentActionType string + +const ( + ExperimentActionTypeContinuous ExperimentActionType = "continuous" + ExperimentActionTypeDelay ExperimentActionType = "delay" + ExperimentActionTypeDiscrete ExperimentActionType = "discrete" +) + +// PossibleExperimentActionTypeValues returns the possible values for the ExperimentActionType const type. +func PossibleExperimentActionTypeValues() []ExperimentActionType { + return []ExperimentActionType{ + ExperimentActionTypeContinuous, + ExperimentActionTypeDelay, + ExperimentActionTypeDiscrete, + } +} + // FilterType - Enum that discriminates between filter types. Currently only Simple type is supported. type FilterType string const ( + // FilterTypeSimple - Simple filter type. FilterTypeSimple FilterType = "Simple" ) @@ -61,6 +77,26 @@ func PossibleFilterTypeValues() []FilterType { } } +// ManagedServiceIdentityType - Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). +type ManagedServiceIdentityType string + +const ( + ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" + ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" + ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" +) + +// PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type. +func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { + return []ManagedServiceIdentityType{ + ManagedServiceIdentityTypeNone, + ManagedServiceIdentityTypeSystemAssigned, + ManagedServiceIdentityTypeSystemAssignedUserAssigned, + ManagedServiceIdentityTypeUserAssigned, + } +} + // Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default // value is "user,system" type Origin string @@ -84,12 +120,18 @@ func PossibleOriginValues() []Origin { type ProvisioningState string const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" - ProvisioningStateDeleting ProvisioningState = "Deleting" - ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateCanceled - Resource creation was canceled. + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateCreating - Initial creation in progress. + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleting - Deletion in progress. + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed - Resource creation failed. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateSucceeded - Resource has been created. ProvisioningStateSucceeded ProvisioningState = "Succeeded" - ProvisioningStateUpdating ProvisioningState = "Updating" + // ProvisioningStateUpdating - Update in progress. + ProvisioningStateUpdating ProvisioningState = "Updating" ) // PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. @@ -104,29 +146,13 @@ func PossibleProvisioningStateValues() []ProvisioningState { } } -// ResourceIdentityType - String of the resource identity type. -type ResourceIdentityType string - -const ( - ResourceIdentityTypeNone ResourceIdentityType = "None" - ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" - ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" -) - -// PossibleResourceIdentityTypeValues returns the possible values for the ResourceIdentityType const type. -func PossibleResourceIdentityTypeValues() []ResourceIdentityType { - return []ResourceIdentityType{ - ResourceIdentityTypeNone, - ResourceIdentityTypeSystemAssigned, - ResourceIdentityTypeUserAssigned, - } -} - // SelectorType - Enum of the selector type. type SelectorType string const ( - SelectorTypeList SelectorType = "List" + // SelectorTypeList - List selector type. + SelectorTypeList SelectorType = "List" + // SelectorTypeQuery - Query selector type. SelectorTypeQuery SelectorType = "Query" ) @@ -142,6 +168,7 @@ func PossibleSelectorTypeValues() []SelectorType { type TargetReferenceType string const ( + // TargetReferenceTypeChaosTarget - Chaos target reference type. TargetReferenceTypeChaosTarget TargetReferenceType = "ChaosTarget" ) diff --git a/sdk/resourcemanager/chaos/armchaos/experiments_client.go b/sdk/resourcemanager/chaos/armchaos/experiments_client.go index 404257553384..7857299c2931 100644 --- a/sdk/resourcemanager/chaos/armchaos/experiments_client.go +++ b/sdk/resourcemanager/chaos/armchaos/experiments_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. @@ -29,7 +26,7 @@ type ExperimentsClient struct { } // NewExperimentsClient creates a new instance of ExperimentsClient with the specified values. -// - subscriptionID - GUID that represents an Azure subscription ID. +// - 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 NewExperimentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExperimentsClient, error) { @@ -47,8 +44,8 @@ func NewExperimentsClient(subscriptionID string, credential azcore.TokenCredenti // BeginCancel - Cancel a running Experiment resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - experimentName - String that represents a Experiment resource name. // - options - ExperimentsClientBeginCancelOptions contains the optional parameters for the ExperimentsClient.BeginCancel method. func (client *ExperimentsClient) BeginCancel(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientBeginCancelOptions) (*runtime.Poller[ExperimentsClientCancelResponse], error) { @@ -72,7 +69,7 @@ func (client *ExperimentsClient) BeginCancel(ctx context.Context, resourceGroupN // Cancel - Cancel a running Experiment resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 +// Generated from API version 2025-01-01 func (client *ExperimentsClient) cancel(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientBeginCancelOptions) (*http.Response, error) { var err error const operationName = "ExperimentsClient.BeginCancel" @@ -95,7 +92,7 @@ func (client *ExperimentsClient) cancel(ctx context.Context, resourceGroupName s } // cancelCreateRequest creates the Cancel request. -func (client *ExperimentsClient) cancelCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientBeginCancelOptions) (*policy.Request, error) { +func (client *ExperimentsClient) cancelCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, _ *ExperimentsClientBeginCancelOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/cancel" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -114,7 +111,7 @@ func (client *ExperimentsClient) cancelCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -123,15 +120,15 @@ func (client *ExperimentsClient) cancelCreateRequest(ctx context.Context, resour // BeginCreateOrUpdate - Create or update a Experiment resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - experimentName - String that represents a Experiment resource name. -// - experiment - Experiment resource to be created or updated. +// - resource - Experiment resource to be created or updated. // - options - ExperimentsClientBeginCreateOrUpdateOptions contains the optional parameters for the ExperimentsClient.BeginCreateOrUpdate // method. -func (client *ExperimentsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, experimentName string, experiment Experiment, options *ExperimentsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ExperimentsClientCreateOrUpdateResponse], error) { +func (client *ExperimentsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, experimentName string, resource Experiment, options *ExperimentsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ExperimentsClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, experimentName, experiment, options) + resp, err := client.createOrUpdate(ctx, resourceGroupName, experimentName, resource, options) if err != nil { return nil, err } @@ -150,14 +147,14 @@ func (client *ExperimentsClient) BeginCreateOrUpdate(ctx context.Context, resour // CreateOrUpdate - Create or update a Experiment resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -func (client *ExperimentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, experimentName string, experiment Experiment, options *ExperimentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { +// Generated from API version 2025-01-01 +func (client *ExperimentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, experimentName string, resource Experiment, options *ExperimentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "ExperimentsClient.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, experimentName, experiment, options) + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, experimentName, resource, options) if err != nil { return nil, err } @@ -173,7 +170,7 @@ func (client *ExperimentsClient) createOrUpdate(ctx context.Context, resourceGro } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ExperimentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, experiment Experiment, options *ExperimentsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ExperimentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, resource Experiment, _ *ExperimentsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -192,10 +189,10 @@ func (client *ExperimentsClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, experiment); err != nil { + if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } return req, nil @@ -204,8 +201,8 @@ func (client *ExperimentsClient) createOrUpdateCreateRequest(ctx context.Context // BeginDelete - Delete a Experiment resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - experimentName - String that represents a Experiment resource name. // - options - ExperimentsClientBeginDeleteOptions contains the optional parameters for the ExperimentsClient.BeginDelete method. func (client *ExperimentsClient) BeginDelete(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientBeginDeleteOptions) (*runtime.Poller[ExperimentsClientDeleteResponse], error) { @@ -229,7 +226,7 @@ func (client *ExperimentsClient) BeginDelete(ctx context.Context, resourceGroupN // Delete - Delete a Experiment resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 +// Generated from API version 2025-01-01 func (client *ExperimentsClient) deleteOperation(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ExperimentsClient.BeginDelete" @@ -244,7 +241,7 @@ func (client *ExperimentsClient) deleteOperation(ctx context.Context, resourceGr if err != nil { return nil, err } - if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { err = runtime.NewResponseError(httpResp) return nil, err } @@ -252,7 +249,7 @@ func (client *ExperimentsClient) deleteOperation(ctx context.Context, resourceGr } // deleteCreateRequest creates the Delete request. -func (client *ExperimentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ExperimentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, _ *ExperimentsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -271,7 +268,7 @@ func (client *ExperimentsClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -280,8 +277,8 @@ func (client *ExperimentsClient) deleteCreateRequest(ctx context.Context, resour // ExecutionDetails - Execution details of an experiment resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - experimentName - String that represents a Experiment resource name. // - executionID - GUID that represents a Experiment execution detail. // - options - ExperimentsClientExecutionDetailsOptions contains the optional parameters for the ExperimentsClient.ExecutionDetails @@ -309,7 +306,7 @@ func (client *ExperimentsClient) ExecutionDetails(ctx context.Context, resourceG } // executionDetailsCreateRequest creates the ExecutionDetails request. -func (client *ExperimentsClient) executionDetailsCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, executionID string, options *ExperimentsClientExecutionDetailsOptions) (*policy.Request, error) { +func (client *ExperimentsClient) executionDetailsCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, executionID string, _ *ExperimentsClientExecutionDetailsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions/{executionId}/getExecutionDetails" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -332,7 +329,7 @@ func (client *ExperimentsClient) executionDetailsCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -350,8 +347,8 @@ func (client *ExperimentsClient) executionDetailsHandleResponse(resp *http.Respo // Get - Get a Experiment resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - experimentName - String that represents a Experiment resource name. // - options - ExperimentsClientGetOptions contains the optional parameters for the ExperimentsClient.Get method. func (client *ExperimentsClient) Get(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientGetOptions) (ExperimentsClientGetResponse, error) { @@ -377,7 +374,7 @@ func (client *ExperimentsClient) Get(ctx context.Context, resourceGroupName stri } // getCreateRequest creates the Get request. -func (client *ExperimentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientGetOptions) (*policy.Request, error) { +func (client *ExperimentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, _ *ExperimentsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -396,7 +393,7 @@ func (client *ExperimentsClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -414,8 +411,8 @@ func (client *ExperimentsClient) getHandleResponse(resp *http.Response) (Experim // GetExecution - Get an execution of an Experiment resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - experimentName - String that represents a Experiment resource name. // - executionID - GUID that represents a Experiment execution detail. // - options - ExperimentsClientGetExecutionOptions contains the optional parameters for the ExperimentsClient.GetExecution @@ -443,7 +440,7 @@ func (client *ExperimentsClient) GetExecution(ctx context.Context, resourceGroup } // getExecutionCreateRequest creates the GetExecution request. -func (client *ExperimentsClient) getExecutionCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, executionID string, options *ExperimentsClientGetExecutionOptions) (*policy.Request, error) { +func (client *ExperimentsClient) getExecutionCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, executionID string, _ *ExperimentsClientGetExecutionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions/{executionId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -466,7 +463,7 @@ func (client *ExperimentsClient) getExecutionCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -483,8 +480,8 @@ func (client *ExperimentsClient) getExecutionHandleResponse(resp *http.Response) // NewListPager - Get a list of Experiment resources in a resource group. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ExperimentsClientListOptions contains the optional parameters for the ExperimentsClient.NewListPager method. func (client *ExperimentsClient) NewListPager(resourceGroupName string, options *ExperimentsClientListOptions) *runtime.Pager[ExperimentsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ExperimentsClientListResponse]{ @@ -525,7 +522,7 @@ func (client *ExperimentsClient) listCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") if options != nil && options.ContinuationToken != nil { reqQP.Set("continuationToken", *options.ContinuationToken) } @@ -548,7 +545,7 @@ func (client *ExperimentsClient) listHandleResponse(resp *http.Response) (Experi // NewListAllPager - Get a list of Experiment resources in a subscription. // -// Generated from API version 2024-01-01 +// Generated from API version 2025-01-01 // - options - ExperimentsClientListAllOptions contains the optional parameters for the ExperimentsClient.NewListAllPager method. func (client *ExperimentsClient) NewListAllPager(options *ExperimentsClientListAllOptions) *runtime.Pager[ExperimentsClientListAllResponse] { return runtime.NewPager(runtime.PagingHandler[ExperimentsClientListAllResponse]{ @@ -585,7 +582,7 @@ func (client *ExperimentsClient) listAllCreateRequest(ctx context.Context, optio return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") if options != nil && options.ContinuationToken != nil { reqQP.Set("continuationToken", *options.ContinuationToken) } @@ -608,8 +605,8 @@ func (client *ExperimentsClient) listAllHandleResponse(resp *http.Response) (Exp // NewListAllExecutionsPager - Get a list of executions of an Experiment resource. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - experimentName - String that represents a Experiment resource name. // - options - ExperimentsClientListAllExecutionsOptions contains the optional parameters for the ExperimentsClient.NewListAllExecutionsPager // method. @@ -637,7 +634,7 @@ func (client *ExperimentsClient) NewListAllExecutionsPager(resourceGroupName str } // listAllExecutionsCreateRequest creates the ListAllExecutions request. -func (client *ExperimentsClient) listAllExecutionsCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientListAllExecutionsOptions) (*policy.Request, error) { +func (client *ExperimentsClient) listAllExecutionsCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, _ *ExperimentsClientListAllExecutionsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -656,7 +653,7 @@ func (client *ExperimentsClient) listAllExecutionsCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -674,8 +671,8 @@ func (client *ExperimentsClient) listAllExecutionsHandleResponse(resp *http.Resp // BeginStart - Start a Experiment resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - experimentName - String that represents a Experiment resource name. // - options - ExperimentsClientBeginStartOptions contains the optional parameters for the ExperimentsClient.BeginStart method. func (client *ExperimentsClient) BeginStart(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientBeginStartOptions) (*runtime.Poller[ExperimentsClientStartResponse], error) { @@ -699,7 +696,7 @@ func (client *ExperimentsClient) BeginStart(ctx context.Context, resourceGroupNa // Start - Start a Experiment resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 +// Generated from API version 2025-01-01 func (client *ExperimentsClient) start(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientBeginStartOptions) (*http.Response, error) { var err error const operationName = "ExperimentsClient.BeginStart" @@ -722,7 +719,7 @@ func (client *ExperimentsClient) start(ctx context.Context, resourceGroupName st } // startCreateRequest creates the Start request. -func (client *ExperimentsClient) startCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientBeginStartOptions) (*policy.Request, error) { +func (client *ExperimentsClient) startCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, _ *ExperimentsClientBeginStartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/start" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -741,7 +738,7 @@ func (client *ExperimentsClient) startCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -750,14 +747,14 @@ func (client *ExperimentsClient) startCreateRequest(ctx context.Context, resourc // BeginUpdate - The operation to update an experiment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - experimentName - String that represents a Experiment resource name. -// - experiment - Parameters supplied to the Update experiment operation. +// - properties - Parameters supplied to the Update experiment operation. // - options - ExperimentsClientBeginUpdateOptions contains the optional parameters for the ExperimentsClient.BeginUpdate method. -func (client *ExperimentsClient) BeginUpdate(ctx context.Context, resourceGroupName string, experimentName string, experiment ExperimentUpdate, options *ExperimentsClientBeginUpdateOptions) (*runtime.Poller[ExperimentsClientUpdateResponse], error) { +func (client *ExperimentsClient) BeginUpdate(ctx context.Context, resourceGroupName string, experimentName string, properties ExperimentUpdate, options *ExperimentsClientBeginUpdateOptions) (*runtime.Poller[ExperimentsClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, experimentName, experiment, options) + resp, err := client.update(ctx, resourceGroupName, experimentName, properties, options) if err != nil { return nil, err } @@ -776,14 +773,14 @@ func (client *ExperimentsClient) BeginUpdate(ctx context.Context, resourceGroupN // Update - The operation to update an experiment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -func (client *ExperimentsClient) update(ctx context.Context, resourceGroupName string, experimentName string, experiment ExperimentUpdate, options *ExperimentsClientBeginUpdateOptions) (*http.Response, error) { +// Generated from API version 2025-01-01 +func (client *ExperimentsClient) update(ctx context.Context, resourceGroupName string, experimentName string, properties ExperimentUpdate, options *ExperimentsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "ExperimentsClient.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, experimentName, experiment, options) + req, err := client.updateCreateRequest(ctx, resourceGroupName, experimentName, properties, options) if err != nil { return nil, err } @@ -791,7 +788,7 @@ func (client *ExperimentsClient) update(ctx context.Context, resourceGroupName s if err != nil { return nil, err } - if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { err = runtime.NewResponseError(httpResp) return nil, err } @@ -799,7 +796,7 @@ func (client *ExperimentsClient) update(ctx context.Context, resourceGroupName s } // updateCreateRequest creates the Update request. -func (client *ExperimentsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, experiment ExperimentUpdate, options *ExperimentsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *ExperimentsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, properties ExperimentUpdate, _ *ExperimentsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -818,10 +815,10 @@ func (client *ExperimentsClient) updateCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, experiment); err != nil { + if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } return req, nil diff --git a/sdk/resourcemanager/chaos/armchaos/experiments_client_example_test.go b/sdk/resourcemanager/chaos/armchaos/experiments_client_example_test.go deleted file mode 100644 index fb537dbc74ef..000000000000 --- a/sdk/resourcemanager/chaos/armchaos/experiments_client_example_test.go +++ /dev/null @@ -1,605 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armchaos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListExperimentsInASubscription.json -func ExampleExperimentsClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExperimentsClient().NewListAllPager(&armchaos.ExperimentsClientListAllOptions{Running: nil, - ContinuationToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ExperimentListResult = armchaos.ExperimentListResult{ - // Value: []*armchaos.Experiment{ - // { - // Name: to.Ptr("exampleExperiment"), - // Type: to.Ptr("Microsoft.Chaos/experiments"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment"), - // Location: to.Ptr("centraluseuap"), - // Identity: &armchaos.ResourceIdentity{ - // Type: to.Ptr(armchaos.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("d04ab567-2c07-43ef-a7f4-4527626b7f56"), - // TenantID: to.Ptr("8c3e2fb2-fe7a-4bf1-b779-d73990782fe6"), - // }, - // Properties: &armchaos.ExperimentProperties{ - // Selectors: []armchaos.TargetSelectorClassification{ - // &armchaos.TargetListSelector{ - // Type: to.Ptr(armchaos.SelectorTypeList), - // ID: to.Ptr("selector1"), - // Targets: []*armchaos.TargetReference{ - // { - // Type: to.Ptr(armchaos.TargetReferenceTypeChaosTarget), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"), - // }}, - // }}, - // Steps: []*armchaos.ExperimentStep{ - // { - // Name: to.Ptr("step1"), - // Branches: []*armchaos.ExperimentBranch{ - // { - // Name: to.Ptr("branch1"), - // Actions: []armchaos.ExperimentActionClassification{ - // &armchaos.ContinuousAction{ - // Name: to.Ptr("urn:csci:provider:providername:Shutdown/1.0"), - // Type: to.Ptr("continuous"), - // Duration: to.Ptr("PT10M"), - // Parameters: []*armchaos.KeyValuePair{ - // { - // Key: to.Ptr("abruptShutdown"), - // Value: to.Ptr("false"), - // }}, - // SelectorID: to.Ptr("selector1"), - // }}, - // }}, - // }}, - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()), - // CreatedBy: to.Ptr("User"), - // CreatedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()), - // LastModifiedBy: to.Ptr("User"), - // LastModifiedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListExperimentsInAResourceGroup.json -func ExampleExperimentsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExperimentsClient().NewListPager("exampleRG", &armchaos.ExperimentsClientListOptions{Running: nil, - ContinuationToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ExperimentListResult = armchaos.ExperimentListResult{ - // Value: []*armchaos.Experiment{ - // { - // Name: to.Ptr("exampleExperiment"), - // Type: to.Ptr("Microsoft.Chaos/experiments"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment"), - // Location: to.Ptr("centraluseuap"), - // Identity: &armchaos.ResourceIdentity{ - // Type: to.Ptr(armchaos.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("d04ab567-2c07-43ef-a7f4-4527626b7f56"), - // TenantID: to.Ptr("8c3e2fb2-fe7a-4bf1-b779-d73990782fe6"), - // }, - // Properties: &armchaos.ExperimentProperties{ - // Selectors: []armchaos.TargetSelectorClassification{ - // &armchaos.TargetListSelector{ - // Type: to.Ptr(armchaos.SelectorTypeList), - // ID: to.Ptr("selector1"), - // Targets: []*armchaos.TargetReference{ - // { - // Type: to.Ptr(armchaos.TargetReferenceTypeChaosTarget), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"), - // }}, - // }}, - // Steps: []*armchaos.ExperimentStep{ - // { - // Name: to.Ptr("step1"), - // Branches: []*armchaos.ExperimentBranch{ - // { - // Name: to.Ptr("branch1"), - // Actions: []armchaos.ExperimentActionClassification{ - // &armchaos.ContinuousAction{ - // Name: to.Ptr("urn:csci:provider:providername:Shutdown/1.0"), - // Type: to.Ptr("continuous"), - // Duration: to.Ptr("PT10M"), - // Parameters: []*armchaos.KeyValuePair{ - // { - // Key: to.Ptr("abruptShutdown"), - // Value: to.Ptr("false"), - // }}, - // SelectorID: to.Ptr("selector1"), - // }}, - // }}, - // }}, - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()), - // CreatedBy: to.Ptr("User"), - // CreatedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()), - // LastModifiedBy: to.Ptr("User"), - // LastModifiedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DeleteExperiment.json -func ExampleExperimentsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExperimentsClient().BeginDelete(ctx, "exampleRG", "exampleExperiment", 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/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetExperiment.json -func ExampleExperimentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExperimentsClient().Get(ctx, "exampleRG", "exampleExperiment", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Experiment = armchaos.Experiment{ - // Name: to.Ptr("exampleExperiment"), - // Type: to.Ptr("Microsoft.Chaos/experiments"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment"), - // Location: to.Ptr("centraluseuap"), - // Identity: &armchaos.ResourceIdentity{ - // Type: to.Ptr(armchaos.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("d04ab567-2c07-43ef-a7f4-4527626b7f56"), - // TenantID: to.Ptr("8c3e2fb2-fe7a-4bf1-b779-d73990782fe6"), - // }, - // Properties: &armchaos.ExperimentProperties{ - // Selectors: []armchaos.TargetSelectorClassification{ - // &armchaos.TargetListSelector{ - // Type: to.Ptr(armchaos.SelectorTypeList), - // ID: to.Ptr("selector1"), - // Targets: []*armchaos.TargetReference{ - // { - // Type: to.Ptr(armchaos.TargetReferenceTypeChaosTarget), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"), - // }}, - // }}, - // Steps: []*armchaos.ExperimentStep{ - // { - // Name: to.Ptr("step1"), - // Branches: []*armchaos.ExperimentBranch{ - // { - // Name: to.Ptr("branch1"), - // Actions: []armchaos.ExperimentActionClassification{ - // &armchaos.ContinuousAction{ - // Name: to.Ptr("urn:csci:provider:providername:Shutdown/1.0"), - // Type: to.Ptr("continuous"), - // Duration: to.Ptr("PT10M"), - // Parameters: []*armchaos.KeyValuePair{ - // { - // Key: to.Ptr("abruptShutdown"), - // Value: to.Ptr("false"), - // }}, - // SelectorID: to.Ptr("selector1"), - // }}, - // }}, - // }}, - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()), - // CreatedBy: to.Ptr("User"), - // CreatedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()), - // LastModifiedBy: to.Ptr("User"), - // LastModifiedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/CreateUpdateExperiment.json -func ExampleExperimentsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExperimentsClient().BeginCreateOrUpdate(ctx, "exampleRG", "exampleExperiment", armchaos.Experiment{ - Location: to.Ptr("eastus2euap"), - Identity: &armchaos.ResourceIdentity{ - Type: to.Ptr(armchaos.ResourceIdentityTypeSystemAssigned), - }, - Properties: &armchaos.ExperimentProperties{ - Selectors: []armchaos.TargetSelectorClassification{ - &armchaos.TargetListSelector{ - Type: to.Ptr(armchaos.SelectorTypeList), - ID: to.Ptr("selector1"), - Targets: []*armchaos.TargetReference{ - { - Type: to.Ptr(armchaos.TargetReferenceTypeChaosTarget), - ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"), - }}, - }}, - Steps: []*armchaos.ExperimentStep{ - { - Name: to.Ptr("step1"), - Branches: []*armchaos.ExperimentBranch{ - { - Name: to.Ptr("branch1"), - Actions: []armchaos.ExperimentActionClassification{ - &armchaos.ContinuousAction{ - Name: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"), - Type: to.Ptr("continuous"), - Duration: to.Ptr("PT10M"), - Parameters: []*armchaos.KeyValuePair{ - { - Key: to.Ptr("abruptShutdown"), - Value: to.Ptr("false"), - }}, - SelectorID: to.Ptr("selector1"), - }}, - }}, - }}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - 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.Experiment = armchaos.Experiment{ - // Name: to.Ptr("exampleExperiment"), - // Type: to.Ptr("Microsoft.Chaos/experiments"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment"), - // Location: to.Ptr("eastus2euap"), - // Identity: &armchaos.ResourceIdentity{ - // Type: to.Ptr(armchaos.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("d04ab567-2c07-43ef-a7f4-4527626b7f56"), - // TenantID: to.Ptr("8c3e2fb2-fe7a-4bf1-b779-d73990782fe6"), - // }, - // Properties: &armchaos.ExperimentProperties{ - // ProvisioningState: to.Ptr(armchaos.ProvisioningStateSucceeded), - // Selectors: []armchaos.TargetSelectorClassification{ - // &armchaos.TargetListSelector{ - // Type: to.Ptr(armchaos.SelectorTypeList), - // ID: to.Ptr("selector1"), - // Targets: []*armchaos.TargetReference{ - // { - // Type: to.Ptr(armchaos.TargetReferenceTypeChaosTarget), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"), - // }}, - // }}, - // Steps: []*armchaos.ExperimentStep{ - // { - // Name: to.Ptr("step1"), - // Branches: []*armchaos.ExperimentBranch{ - // { - // Name: to.Ptr("branch1"), - // Actions: []armchaos.ExperimentActionClassification{ - // &armchaos.ContinuousAction{ - // Name: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"), - // Type: to.Ptr("continuous"), - // Duration: to.Ptr("PT10M"), - // Parameters: []*armchaos.KeyValuePair{ - // { - // Key: to.Ptr("abruptShutdown"), - // Value: to.Ptr("false"), - // }}, - // SelectorID: to.Ptr("selector1"), - // }}, - // }}, - // }}, - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()), - // CreatedBy: to.Ptr("User"), - // CreatedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()), - // LastModifiedBy: to.Ptr("User"), - // LastModifiedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/UpdateExperiment.json -func ExampleExperimentsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExperimentsClient().BeginUpdate(ctx, "exampleRG", "exampleExperiment", armchaos.ExperimentUpdate{ - Identity: &armchaos.ResourceIdentity{ - Type: to.Ptr(armchaos.ResourceIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armchaos.UserAssignedIdentity{ - "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.ManagedIdentity/userAssignedIdentity/exampleUMI": {}, - }, - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, 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/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/CancelExperiment.json -func ExampleExperimentsClient_BeginCancel() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExperimentsClient().BeginCancel(ctx, "exampleRG", "exampleExperiment", 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/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/StartExperiment.json -func ExampleExperimentsClient_BeginStart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewExperimentsClient().BeginStart(ctx, "exampleRG", "exampleExperiment", 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/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListExperimentExecutions.json -func ExampleExperimentsClient_NewListAllExecutionsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExperimentsClient().NewListAllExecutionsPager("exampleRG", "exampleExperiment", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ExperimentExecutionListResult = armchaos.ExperimentExecutionListResult{ - // Value: []*armchaos.ExperimentExecution{ - // { - // Name: to.Ptr("f24500ad-744e-4a26-864b-b76199eac333"), - // Type: to.Ptr("Microsoft.Chaos/experiments/executions"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment/executions/"), - // Properties: &armchaos.ExperimentExecutionProperties{ - // StartedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:52.255Z"); return t}()), - // Status: to.Ptr("failed"), - // StoppedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:56:18.928Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("14d98367-52ef-4596-be4f-53fc81bbfc33"), - // Type: to.Ptr("Microsoft.Chaos/experiments/executions"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment/executionDetails/14d98367-52ef-4596-be4f-53fc81bbfc33"), - // Properties: &armchaos.ExperimentExecutionProperties{ - // StartedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:52.255Z"); return t}()), - // Status: to.Ptr("success"), - // StoppedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:56:18.928Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetExperimentExecution.json -func ExampleExperimentsClient_GetExecution() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExperimentsClient().GetExecution(ctx, "exampleRG", "exampleExperiment", "f24500ad-744e-4a26-864b-b76199eac333", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExperimentExecution = armchaos.ExperimentExecution{ - // Name: to.Ptr("f24500ad-744e-4a26-864b-b76199eac333"), - // Type: to.Ptr("Microsoft.Chaos/experiments/executions"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment/executions/f24500ad-744e-4a26-864b-b76199eac333"), - // Properties: &armchaos.ExperimentExecutionProperties{ - // StartedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:52.255Z"); return t}()), - // Status: to.Ptr("failed"), - // StoppedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:56:18.928Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DetailsExperiment.json -func ExampleExperimentsClient_ExecutionDetails() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExperimentsClient().ExecutionDetails(ctx, "exampleRG", "exampleExperiment", "f24500ad-744e-4a26-864b-b76199eac333", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ExperimentExecutionDetails = armchaos.ExperimentExecutionDetails{ - // Name: to.Ptr("f24500ad-744e-4a26-864b-b76199eac333"), - // Type: to.Ptr("Microsoft.Chaos/experiments/executions/getExecutionDetails"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment/executions/f24500ad-744e-4a26-864b-b76199eac333/getExecutionDetails"), - // Properties: &armchaos.ExperimentExecutionDetailsProperties{ - // StartedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:52.255Z"); return t}()), - // Status: to.Ptr("failed"), - // StoppedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:56:18.928Z"); return t}()), - // FailureReason: to.Ptr("Dependency failure"), - // LastActionAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:52.255Z"); return t}()), - // RunInformation: &armchaos.ExperimentExecutionDetailsPropertiesRunInformation{ - // Steps: []*armchaos.StepStatus{ - // { - // Branches: []*armchaos.BranchStatus{ - // { - // Actions: []*armchaos.ActionStatus{ - // { - // ActionID: to.Ptr("59499d33-6751-4b6e-a1f6-58f4d56a040a"), - // ActionName: to.Ptr("urn:provider:agent-v2:Microsoft.Azure.Chaos.Fault.CPUPressureAllProcessors"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:56:13.627Z"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:56:13.627Z"); return t}()), - // Status: to.Ptr("failed"), - // Targets: []*armchaos.ExperimentExecutionActionTargetDetailsProperties{ - // { - // Status: to.Ptr("succeeded"), - // Target: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/VM1"), - // TargetCompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T17:30:55.000Z"); return t}()), - // TargetFailedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T16:30:55.000Z"); return t}()), - // }, - // { - // Status: to.Ptr("failed"), - // Target: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/VM1"), - // TargetCompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T17:30:55.000Z"); return t}()), - // TargetFailedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T16:30:55.000Z"); return t}()), - // }}, - // }}, - // BranchID: to.Ptr("FirstBranch"), - // BranchName: to.Ptr("FirstBranch"), - // Status: to.Ptr("failed"), - // }}, - // Status: to.Ptr("failed"), - // StepID: to.Ptr("FirstStep"), - // StepName: to.Ptr("FirstStep"), - // }}, - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/chaos/armchaos/experiments_live_test.go b/sdk/resourcemanager/chaos/armchaos/experiments_live_test.go index 8d7d1dd2ff2c..365482e238c0 100644 --- a/sdk/resourcemanager/chaos/armchaos/experiments_live_test.go +++ b/sdk/resourcemanager/chaos/armchaos/experiments_live_test.go @@ -15,7 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3/testutil" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" "github.com/stretchr/testify/suite" diff --git a/sdk/resourcemanager/chaos/armchaos/fake/capabilities_server.go b/sdk/resourcemanager/chaos/armchaos/fake/capabilities_server.go index 859cfec668df..2126e6c7e90b 100644 --- a/sdk/resourcemanager/chaos/armchaos/fake/capabilities_server.go +++ b/sdk/resourcemanager/chaos/armchaos/fake/capabilities_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/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" "net/http" "net/url" "regexp" @@ -25,8 +22,8 @@ import ( // CapabilitiesServer is a fake server for instances of the armchaos.CapabilitiesClient type. type CapabilitiesServer struct { // CreateOrUpdate is the fake for method CapabilitiesClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK - CreateOrUpdate func(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, capabilityName string, capability armchaos.Capability, options *armchaos.CapabilitiesClientCreateOrUpdateOptions) (resp azfake.Responder[armchaos.CapabilitiesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, capabilityName string, resource armchaos.Capability, options *armchaos.CapabilitiesClientCreateOrUpdateOptions) (resp azfake.Responder[armchaos.CapabilitiesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // Delete is the fake for method CapabilitiesClient.Delete // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent @@ -66,27 +63,46 @@ func (c *CapabilitiesServerTransport) Do(req *http.Request) (*http.Response, err return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return c.dispatchToMethodFake(req, method) +} - switch method { - case "CapabilitiesClient.CreateOrUpdate": - resp, err = c.dispatchCreateOrUpdate(req) - case "CapabilitiesClient.Delete": - resp, err = c.dispatchDelete(req) - case "CapabilitiesClient.Get": - resp, err = c.dispatchGet(req) - case "CapabilitiesClient.NewListPager": - resp, err = c.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (c *CapabilitiesServerTransport) 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 capabilitiesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = capabilitiesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CapabilitiesClient.CreateOrUpdate": + res.resp, res.err = c.dispatchCreateOrUpdate(req) + case "CapabilitiesClient.Delete": + res.resp, res.err = c.dispatchDelete(req) + case "CapabilitiesClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "CapabilitiesClient.NewListPager": + res.resp, res.err = c.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 (c *CapabilitiesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -132,8 +148,8 @@ func (c *CapabilitiesServerTransport) dispatchCreateOrUpdate(req *http.Request) return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Capability, req) if err != nil { @@ -269,15 +285,15 @@ func (c *CapabilitiesServerTransport) dispatchNewListPager(req *http.Request) (* if err != nil { return nil, err } - targetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("targetName")]) + continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) if err != nil { return nil, err } - continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) + continuationTokenParam := getOptional(continuationTokenUnescaped) + targetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("targetName")]) if err != nil { return nil, err } - continuationTokenParam := getOptional(continuationTokenUnescaped) var options *armchaos.CapabilitiesClientListOptions if continuationTokenParam != nil { options = &armchaos.CapabilitiesClientListOptions{ @@ -304,3 +320,9 @@ func (c *CapabilitiesServerTransport) dispatchNewListPager(req *http.Request) (* } return resp, nil } + +// set this to conditionally intercept incoming requests to CapabilitiesServerTransport +var capabilitiesServerTransportInterceptor 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/chaos/armchaos/fake/capabilitytypes_server.go b/sdk/resourcemanager/chaos/armchaos/fake/capabilitytypes_server.go index 4ab582c9e43f..42a78a076f2a 100644 --- a/sdk/resourcemanager/chaos/armchaos/fake/capabilitytypes_server.go +++ b/sdk/resourcemanager/chaos/armchaos/fake/capabilitytypes_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/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" "net/http" "net/url" "regexp" @@ -26,11 +23,11 @@ import ( type CapabilityTypesServer struct { // Get is the fake for method CapabilityTypesClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, locationName string, targetTypeName string, capabilityTypeName string, options *armchaos.CapabilityTypesClientGetOptions) (resp azfake.Responder[armchaos.CapabilityTypesClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, location string, targetTypeName string, capabilityTypeName string, options *armchaos.CapabilityTypesClientGetOptions) (resp azfake.Responder[armchaos.CapabilityTypesClientGetResponse], errResp azfake.ErrorResponder) // NewListPager is the fake for method CapabilityTypesClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - NewListPager func(locationName string, targetTypeName string, options *armchaos.CapabilityTypesClientListOptions) (resp azfake.PagerResponder[armchaos.CapabilityTypesClientListResponse]) + NewListPager func(location string, targetTypeName string, options *armchaos.CapabilityTypesClientListOptions) (resp azfake.PagerResponder[armchaos.CapabilityTypesClientListResponse]) } // NewCapabilityTypesServerTransport creates a new instance of CapabilityTypesServerTransport with the provided implementation. @@ -58,36 +55,55 @@ func (c *CapabilityTypesServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return c.dispatchToMethodFake(req, method) +} - switch method { - case "CapabilityTypesClient.Get": - resp, err = c.dispatchGet(req) - case "CapabilityTypesClient.NewListPager": - resp, err = c.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (c *CapabilityTypesServerTransport) 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 capabilityTypesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = capabilityTypesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CapabilityTypesClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "CapabilityTypesClient.NewListPager": + res.resp, res.err = c.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 (c *CapabilityTypesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { if c.srv.Get == nil { return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/targetTypes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/capabilityTypes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/targetTypes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/capabilityTypes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - locationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("locationName")]) + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) if err != nil { return nil, err } @@ -99,7 +115,7 @@ func (c *CapabilityTypesServerTransport) dispatchGet(req *http.Request) (*http.R if err != nil { return nil, err } - respr, errRespr := c.srv.Get(req.Context(), locationNameParam, targetTypeNameParam, capabilityTypeNameParam, nil) + respr, errRespr := c.srv.Get(req.Context(), locationParam, targetTypeNameParam, capabilityTypeNameParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -120,14 +136,14 @@ func (c *CapabilityTypesServerTransport) dispatchNewListPager(req *http.Request) } newListPager := c.newListPager.get(req) if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/targetTypes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/capabilityTypes` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/targetTypes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/capabilityTypes` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() - locationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("locationName")]) + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) if err != nil { return nil, err } @@ -146,7 +162,7 @@ func (c *CapabilityTypesServerTransport) dispatchNewListPager(req *http.Request) ContinuationToken: continuationTokenParam, } } - resp := c.srv.NewListPager(locationNameParam, targetTypeNameParam, options) + resp := c.srv.NewListPager(locationParam, targetTypeNameParam, options) newListPager = &resp c.newListPager.add(req, newListPager) server.PagerResponderInjectNextLinks(newListPager, req, func(page *armchaos.CapabilityTypesClientListResponse, createLink func() string) { @@ -166,3 +182,9 @@ func (c *CapabilityTypesServerTransport) dispatchNewListPager(req *http.Request) } return resp, nil } + +// set this to conditionally intercept incoming requests to CapabilityTypesServerTransport +var capabilityTypesServerTransportInterceptor 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/chaos/armchaos/fake/experiments_server.go b/sdk/resourcemanager/chaos/armchaos/fake/experiments_server.go index 110967111c7d..ae7169542778 100644 --- a/sdk/resourcemanager/chaos/armchaos/fake/experiments_server.go +++ b/sdk/resourcemanager/chaos/armchaos/fake/experiments_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/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" "net/http" "net/url" "regexp" @@ -26,15 +23,15 @@ import ( // ExperimentsServer is a fake server for instances of the armchaos.ExperimentsClient type. type ExperimentsServer struct { // BeginCancel is the fake for method ExperimentsClient.BeginCancel - // HTTP status codes to indicate success: http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginCancel func(ctx context.Context, resourceGroupName string, experimentName string, options *armchaos.ExperimentsClientBeginCancelOptions) (resp azfake.PollerResponder[armchaos.ExperimentsClientCancelResponse], errResp azfake.ErrorResponder) // BeginCreateOrUpdate is the fake for method ExperimentsClient.BeginCreateOrUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, experimentName string, experiment armchaos.Experiment, options *armchaos.ExperimentsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armchaos.ExperimentsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, experimentName string, resource armchaos.Experiment, options *armchaos.ExperimentsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armchaos.ExperimentsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method ExperimentsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, experimentName string, options *armchaos.ExperimentsClientBeginDeleteOptions) (resp azfake.PollerResponder[armchaos.ExperimentsClientDeleteResponse], errResp azfake.ErrorResponder) // ExecutionDetails is the fake for method ExperimentsClient.ExecutionDetails @@ -62,12 +59,12 @@ type ExperimentsServer struct { NewListAllExecutionsPager func(resourceGroupName string, experimentName string, options *armchaos.ExperimentsClientListAllExecutionsOptions) (resp azfake.PagerResponder[armchaos.ExperimentsClientListAllExecutionsResponse]) // BeginStart is the fake for method ExperimentsClient.BeginStart - // HTTP status codes to indicate success: http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginStart func(ctx context.Context, resourceGroupName string, experimentName string, options *armchaos.ExperimentsClientBeginStartOptions) (resp azfake.PollerResponder[armchaos.ExperimentsClientStartResponse], errResp azfake.ErrorResponder) // BeginUpdate is the fake for method ExperimentsClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, experimentName string, experiment armchaos.ExperimentUpdate, options *armchaos.ExperimentsClientBeginUpdateOptions) (resp azfake.PollerResponder[armchaos.ExperimentsClientUpdateResponse], errResp azfake.ErrorResponder) + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, experimentName string, properties armchaos.ExperimentUpdate, options *armchaos.ExperimentsClientBeginUpdateOptions) (resp azfake.PollerResponder[armchaos.ExperimentsClientUpdateResponse], errResp azfake.ErrorResponder) } // NewExperimentsServerTransport creates a new instance of ExperimentsServerTransport with the provided implementation. @@ -109,41 +106,60 @@ func (e *ExperimentsServerTransport) Do(req *http.Request) (*http.Response, erro return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "ExperimentsClient.BeginCancel": - resp, err = e.dispatchBeginCancel(req) - case "ExperimentsClient.BeginCreateOrUpdate": - resp, err = e.dispatchBeginCreateOrUpdate(req) - case "ExperimentsClient.BeginDelete": - resp, err = e.dispatchBeginDelete(req) - case "ExperimentsClient.ExecutionDetails": - resp, err = e.dispatchExecutionDetails(req) - case "ExperimentsClient.Get": - resp, err = e.dispatchGet(req) - case "ExperimentsClient.GetExecution": - resp, err = e.dispatchGetExecution(req) - case "ExperimentsClient.NewListPager": - resp, err = e.dispatchNewListPager(req) - case "ExperimentsClient.NewListAllPager": - resp, err = e.dispatchNewListAllPager(req) - case "ExperimentsClient.NewListAllExecutionsPager": - resp, err = e.dispatchNewListAllExecutionsPager(req) - case "ExperimentsClient.BeginStart": - resp, err = e.dispatchBeginStart(req) - case "ExperimentsClient.BeginUpdate": - resp, err = e.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return e.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (e *ExperimentsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if experimentsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = experimentsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ExperimentsClient.BeginCancel": + res.resp, res.err = e.dispatchBeginCancel(req) + case "ExperimentsClient.BeginCreateOrUpdate": + res.resp, res.err = e.dispatchBeginCreateOrUpdate(req) + case "ExperimentsClient.BeginDelete": + res.resp, res.err = e.dispatchBeginDelete(req) + case "ExperimentsClient.ExecutionDetails": + res.resp, res.err = e.dispatchExecutionDetails(req) + case "ExperimentsClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "ExperimentsClient.GetExecution": + res.resp, res.err = e.dispatchGetExecution(req) + case "ExperimentsClient.NewListPager": + res.resp, res.err = e.dispatchNewListPager(req) + case "ExperimentsClient.NewListAllPager": + res.resp, res.err = e.dispatchNewListAllPager(req) + case "ExperimentsClient.NewListAllExecutionsPager": + res.resp, res.err = e.dispatchNewListAllExecutionsPager(req) + case "ExperimentsClient.BeginStart": + res.resp, res.err = e.dispatchBeginStart(req) + case "ExperimentsClient.BeginUpdate": + res.resp, res.err = e.dispatchBeginUpdate(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 (e *ExperimentsServerTransport) dispatchBeginCancel(req *http.Request) (*http.Response, error) { @@ -179,9 +195,9 @@ func (e *ExperimentsServerTransport) dispatchBeginCancel(req *http.Request) (*ht return nil, err } - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { e.beginCancel.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginCancel) { e.beginCancel.remove(req) @@ -271,9 +287,9 @@ func (e *ExperimentsServerTransport) dispatchBeginDelete(req *http.Request) (*ht return nil, err } - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { e.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { e.beginDelete.remove(req) @@ -575,9 +591,9 @@ func (e *ExperimentsServerTransport) dispatchBeginStart(req *http.Request) (*htt return nil, err } - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { e.beginStart.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginStart) { e.beginStart.remove(req) @@ -623,9 +639,9 @@ func (e *ExperimentsServerTransport) dispatchBeginUpdate(req *http.Request) (*ht return nil, err } - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { e.beginUpdate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } if !server.PollerResponderMore(beginUpdate) { e.beginUpdate.remove(req) @@ -633,3 +649,9 @@ func (e *ExperimentsServerTransport) dispatchBeginUpdate(req *http.Request) (*ht return resp, nil } + +// set this to conditionally intercept incoming requests to ExperimentsServerTransport +var experimentsServerTransportInterceptor 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/chaos/armchaos/fake/internal.go b/sdk/resourcemanager/chaos/armchaos/fake/internal.go index 7d2f89ba4bb2..c614f8d5643a 100644 --- a/sdk/resourcemanager/chaos/armchaos/fake/internal.go +++ b/sdk/resourcemanager/chaos/armchaos/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. @@ -15,6 +12,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/chaos/armchaos/fake/operations_server.go b/sdk/resourcemanager/chaos/armchaos/fake/operations_server.go index fa65ac87d409..4207c62375d5 100644 --- a/sdk/resourcemanager/chaos/armchaos/fake/operations_server.go +++ b/sdk/resourcemanager/chaos/armchaos/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/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/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.NewListAllPager": - resp, err = o.dispatchNewListAllPager(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.NewListAllPager": + res.resp, res.err = o.dispatchNewListAllPager(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) dispatchNewListAllPager(req *http.Request) (*http.Response, error) { @@ -94,3 +110,9 @@ func (o *OperationsServerTransport) dispatchNewListAllPager(req *http.Request) ( } 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/chaos/armchaos/fake/operationstatuses_server.go b/sdk/resourcemanager/chaos/armchaos/fake/operationstatuses_server.go index 86d938265b0b..658208138226 100644 --- a/sdk/resourcemanager/chaos/armchaos/fake/operationstatuses_server.go +++ b/sdk/resourcemanager/chaos/armchaos/fake/operationstatuses_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 ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" "net/http" "net/url" "regexp" @@ -25,7 +22,7 @@ import ( type OperationStatusesServer struct { // Get is the fake for method OperationStatusesClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, location string, asyncOperationID string, options *armchaos.OperationStatusesClientGetOptions) (resp azfake.Responder[armchaos.OperationStatusesClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, location string, operationID string, options *armchaos.OperationStatusesClientGetOptions) (resp azfake.Responder[armchaos.OperationStatusesClientGetResponse], errResp azfake.ErrorResponder) } // NewOperationStatusesServerTransport creates a new instance of OperationStatusesServerTransport with the provided implementation. @@ -49,28 +46,47 @@ func (o *OperationStatusesServerTransport) Do(req *http.Request) (*http.Response 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 "OperationStatusesClient.Get": - resp, err = o.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (o *OperationStatusesServerTransport) 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 operationStatusesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationStatusesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationStatusesClient.Get": + res.resp, res.err = o.dispatchGet(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 *OperationStatusesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { if o.srv.Get == nil { return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operationStatuses/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operationStatuses/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 3 { @@ -80,11 +96,11 @@ func (o *OperationStatusesServerTransport) dispatchGet(req *http.Request) (*http if err != nil { return nil, err } - asyncOperationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("asyncOperationId")]) + operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) if err != nil { return nil, err } - respr, errRespr := o.srv.Get(req.Context(), locationParam, asyncOperationIDParam, nil) + respr, errRespr := o.srv.Get(req.Context(), locationParam, operationIDParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -92,9 +108,15 @@ func (o *OperationStatusesServerTransport) dispatchGet(req *http.Request) (*http if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatusResult, req) if err != nil { return nil, err } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationStatusesServerTransport +var operationStatusesServerTransportInterceptor 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/chaos/armchaos/fake/server_factory.go b/sdk/resourcemanager/chaos/armchaos/fake/server_factory.go index b2c30adf1bb3..8bdc06f4fe36 100644 --- a/sdk/resourcemanager/chaos/armchaos/fake/server_factory.go +++ b/sdk/resourcemanager/chaos/armchaos/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,13 +16,26 @@ import ( // ServerFactory is a fake server for instances of the armchaos.ClientFactory type. type ServerFactory struct { - CapabilitiesServer CapabilitiesServer - CapabilityTypesServer CapabilityTypesServer - ExperimentsServer ExperimentsServer + // CapabilitiesServer contains the fakes for client CapabilitiesClient + CapabilitiesServer CapabilitiesServer + + // CapabilityTypesServer contains the fakes for client CapabilityTypesClient + CapabilityTypesServer CapabilityTypesServer + + // ExperimentsServer contains the fakes for client ExperimentsClient + ExperimentsServer ExperimentsServer + + // OperationStatusesServer contains the fakes for client OperationStatusesClient OperationStatusesServer OperationStatusesServer - OperationsServer OperationsServer - TargetTypesServer TargetTypesServer - TargetsServer TargetsServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // TargetTypesServer contains the fakes for client TargetTypesClient + TargetTypesServer TargetTypesServer + + // TargetsServer contains the fakes for client TargetsClient + TargetsServer TargetsServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. diff --git a/sdk/resourcemanager/chaos/armchaos/fake/targets_server.go b/sdk/resourcemanager/chaos/armchaos/fake/targets_server.go index d2045d013f23..142f0ae4ee26 100644 --- a/sdk/resourcemanager/chaos/armchaos/fake/targets_server.go +++ b/sdk/resourcemanager/chaos/armchaos/fake/targets_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/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" "net/http" "net/url" "regexp" @@ -25,8 +22,8 @@ import ( // TargetsServer is a fake server for instances of the armchaos.TargetsClient type. type TargetsServer struct { // CreateOrUpdate is the fake for method TargetsClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK - CreateOrUpdate func(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, target armchaos.Target, options *armchaos.TargetsClientCreateOrUpdateOptions) (resp azfake.Responder[armchaos.TargetsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, resource armchaos.Target, options *armchaos.TargetsClientCreateOrUpdateOptions) (resp azfake.Responder[armchaos.TargetsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // Delete is the fake for method TargetsClient.Delete // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent @@ -66,27 +63,46 @@ func (t *TargetsServerTransport) 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 t.dispatchToMethodFake(req, method) +} - switch method { - case "TargetsClient.CreateOrUpdate": - resp, err = t.dispatchCreateOrUpdate(req) - case "TargetsClient.Delete": - resp, err = t.dispatchDelete(req) - case "TargetsClient.Get": - resp, err = t.dispatchGet(req) - case "TargetsClient.NewListPager": - resp, err = t.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (t *TargetsServerTransport) 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 targetsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = targetsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "TargetsClient.CreateOrUpdate": + res.resp, res.err = t.dispatchCreateOrUpdate(req) + case "TargetsClient.Delete": + res.resp, res.err = t.dispatchDelete(req) + case "TargetsClient.Get": + res.resp, res.err = t.dispatchGet(req) + case "TargetsClient.NewListPager": + res.resp, res.err = t.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 (t *TargetsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -128,8 +144,8 @@ func (t *TargetsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*htt return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Target, req) if err != nil { @@ -288,3 +304,9 @@ func (t *TargetsServerTransport) dispatchNewListPager(req *http.Request) (*http. } return resp, nil } + +// set this to conditionally intercept incoming requests to TargetsServerTransport +var targetsServerTransportInterceptor 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/chaos/armchaos/fake/targettypes_server.go b/sdk/resourcemanager/chaos/armchaos/fake/targettypes_server.go index d3a7428a0477..c2e56bf95b45 100644 --- a/sdk/resourcemanager/chaos/armchaos/fake/targettypes_server.go +++ b/sdk/resourcemanager/chaos/armchaos/fake/targettypes_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/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" "net/http" "net/url" "regexp" @@ -26,11 +23,11 @@ import ( type TargetTypesServer struct { // Get is the fake for method TargetTypesClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, locationName string, targetTypeName string, options *armchaos.TargetTypesClientGetOptions) (resp azfake.Responder[armchaos.TargetTypesClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, location string, targetTypeName string, options *armchaos.TargetTypesClientGetOptions) (resp azfake.Responder[armchaos.TargetTypesClientGetResponse], errResp azfake.ErrorResponder) // NewListPager is the fake for method TargetTypesClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - NewListPager func(locationName string, options *armchaos.TargetTypesClientListOptions) (resp azfake.PagerResponder[armchaos.TargetTypesClientListResponse]) + NewListPager func(location string, options *armchaos.TargetTypesClientListOptions) (resp azfake.PagerResponder[armchaos.TargetTypesClientListResponse]) } // NewTargetTypesServerTransport creates a new instance of TargetTypesServerTransport with the provided implementation. @@ -58,36 +55,55 @@ func (t *TargetTypesServerTransport) Do(req *http.Request) (*http.Response, erro return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return t.dispatchToMethodFake(req, method) +} - switch method { - case "TargetTypesClient.Get": - resp, err = t.dispatchGet(req) - case "TargetTypesClient.NewListPager": - resp, err = t.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (t *TargetTypesServerTransport) 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 targetTypesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = targetTypesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "TargetTypesClient.Get": + res.resp, res.err = t.dispatchGet(req) + case "TargetTypesClient.NewListPager": + res.resp, res.err = t.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 (t *TargetTypesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { if t.srv.Get == nil { return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/targetTypes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/targetTypes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - locationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("locationName")]) + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) if err != nil { return nil, err } @@ -95,7 +111,7 @@ func (t *TargetTypesServerTransport) dispatchGet(req *http.Request) (*http.Respo if err != nil { return nil, err } - respr, errRespr := t.srv.Get(req.Context(), locationNameParam, targetTypeNameParam, nil) + respr, errRespr := t.srv.Get(req.Context(), locationParam, targetTypeNameParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -116,14 +132,14 @@ func (t *TargetTypesServerTransport) dispatchNewListPager(req *http.Request) (*h } newListPager := t.newListPager.get(req) if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/targetTypes` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/targetTypes` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) if matches == nil || len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() - locationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("locationName")]) + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) if err != nil { return nil, err } @@ -138,7 +154,7 @@ func (t *TargetTypesServerTransport) dispatchNewListPager(req *http.Request) (*h ContinuationToken: continuationTokenParam, } } - resp := t.srv.NewListPager(locationNameParam, options) + resp := t.srv.NewListPager(locationParam, options) newListPager = &resp t.newListPager.add(req, newListPager) server.PagerResponderInjectNextLinks(newListPager, req, func(page *armchaos.TargetTypesClientListResponse, createLink func() string) { @@ -158,3 +174,9 @@ func (t *TargetTypesServerTransport) dispatchNewListPager(req *http.Request) (*h } return resp, nil } + +// set this to conditionally intercept incoming requests to TargetTypesServerTransport +var targetTypesServerTransportInterceptor 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/chaos/armchaos/fake/time_rfc3339.go b/sdk/resourcemanager/chaos/armchaos/fake/time_rfc3339.go deleted file mode 100644 index 81f308b0d343..000000000000 --- a/sdk/resourcemanager/chaos/armchaos/fake/time_rfc3339.go +++ /dev/null @@ -1,110 +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 ( - utcDateTime = "2006-01-02T15:04:05.999999999" - utcDateTimeJSON = `"` + utcDateTime + `"` - utcDateTimeNoT = "2006-01-02 15:04:05.999999999" - utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` - dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` - dateTimeJSON = `"` + time.RFC3339Nano + `"` - dateTimeJSONNoT = `"` + dateTimeNoT + `"` -) - -type dateTimeRFC3339 time.Time - -func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalJSON() -} - -func (t dateTimeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalText() -} - -func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = dateTimeJSON - } else if tzOffset { - layout = dateTimeJSONNoT - } else if hasT { - layout = utcDateTimeJSON - } else { - layout = utcDateTimeJSONNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = time.RFC3339Nano - } else if tzOffset { - layout = dateTimeNoT - } else if hasT { - layout = utcDateTime - } else { - layout = utcDateTimeNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = dateTimeRFC3339(p) - return err -} - -func (t dateTimeRFC3339) String() string { - return time.Time(t).Format(time.RFC3339Nano) -} - -func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*dateTimeRFC3339)(t) -} - -func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || string(data) == "null" { - return nil - } - var aux dateTimeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/chaos/armchaos/go.mod b/sdk/resourcemanager/chaos/armchaos/go.mod index 33ee3f5921ed..7fc65c35b016 100644 --- a/sdk/resourcemanager/chaos/armchaos/go.mod +++ b/sdk/resourcemanager/chaos/armchaos/go.mod @@ -1,10 +1,9 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/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/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 @@ -12,6 +11,7 @@ require ( ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/golang-jwt/jwt/v5 v5.2.2 // indirect diff --git a/sdk/resourcemanager/chaos/armchaos/interfaces.go b/sdk/resourcemanager/chaos/armchaos/interfaces.go index e75b88834683..d0536eadd762 100644 --- a/sdk/resourcemanager/chaos/armchaos/interfaces.go +++ b/sdk/resourcemanager/chaos/armchaos/interfaces.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. diff --git a/sdk/resourcemanager/chaos/armchaos/models.go b/sdk/resourcemanager/chaos/armchaos/models.go index 20da634461d9..86013db1e4cc 100644 --- a/sdk/resourcemanager/chaos/armchaos/models.go +++ b/sdk/resourcemanager/chaos/armchaos/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. @@ -48,16 +45,16 @@ type BranchStatus struct { // Capability - Model that represents a Capability resource. type Capability struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // The properties of a capability resource. + Properties *CapabilityProperties + + // 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 Name *string - // READ-ONLY; The properties of a capability resource. - Properties *CapabilityProperties - - // READ-ONLY; The standard system metadata of a resource type. + // 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" @@ -66,11 +63,11 @@ type Capability struct { // CapabilityListResult - Model that represents a list of Capability resources and a link for pagination. type CapabilityListResult struct { - // READ-ONLY; URL to retrieve the next page of Capability resources. - NextLink *string - - // READ-ONLY; List of Capability resources. + // REQUIRED; The Capability items on this page Value []*Capability + + // The link to the next page of items + NextLink *string } // CapabilityProperties - Model that represents the Capability properties model. @@ -93,19 +90,16 @@ type CapabilityProperties struct { // CapabilityType - Model that represents a Capability Type resource. type CapabilityType struct { - // Location of the Capability Type resource. - Location *string + // The properties of the capability type resource. + Properties *CapabilityTypeProperties - // 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 Name *string - // READ-ONLY; The properties of the capability type resource. - Properties *CapabilityTypeProperties - - // READ-ONLY; The system metadata properties of the capability type resource. + // 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" @@ -114,24 +108,21 @@ type CapabilityType struct { // CapabilityTypeListResult - Model that represents a list of Capability Type resources and a link for pagination. type CapabilityTypeListResult struct { - // READ-ONLY; URL to retrieve the next page of Capability Type resources. - NextLink *string - - // READ-ONLY; List of Capability Type resources. + // REQUIRED; The CapabilityType items on this page Value []*CapabilityType + + // The link to the next page of items + NextLink *string } // CapabilityTypeProperties - Model that represents the Capability Type properties model. type CapabilityTypeProperties struct { - // Control plane actions necessary to execute capability type. + // READ-ONLY; Control plane actions necessary to execute capability type. AzureRbacActions []*string - // Data plane actions necessary to execute capability type. + // READ-ONLY; Data plane actions necessary to execute capability type. AzureRbacDataActions []*string - // Runtime properties of this Capability Type. - RuntimeProperties *CapabilityTypePropertiesRuntimeProperties - // READ-ONLY; Localized string of the description. Description *string @@ -147,6 +138,12 @@ type CapabilityTypeProperties struct { // READ-ONLY; String of the Publisher that this Capability Type extends. Publisher *string + // READ-ONLY; Required Azure Role Definition Ids to execute capability type. + RequiredAzureRoleDefinitionIDs []*string + + // READ-ONLY; Runtime properties of this Capability Type. + RuntimeProperties *CapabilityTypePropertiesRuntimeProperties + // READ-ONLY; String of the Target Type that this Capability Type extends. TargetType *string @@ -174,8 +171,8 @@ type ContinuousAction struct { // REQUIRED; String that represents a selector. SelectorID *string - // REQUIRED; Enum that discriminates between action models. - Type *string + // REQUIRED; Chaos experiment action discriminator type + Type *ExperimentActionType } // GetExperimentAction implements the ExperimentActionClassification interface for type ContinuousAction. @@ -194,8 +191,8 @@ type DelayAction struct { // REQUIRED; String that represents a Capability URN. Name *string - // REQUIRED; Enum that discriminates between action models. - Type *string + // REQUIRED; Chaos experiment action discriminator type + Type *ExperimentActionType } // GetExperimentAction implements the ExperimentActionClassification interface for type DelayAction. @@ -217,8 +214,8 @@ type DiscreteAction struct { // REQUIRED; String that represents a selector. SelectorID *string - // REQUIRED; Enum that discriminates between action models. - Type *string + // REQUIRED; Chaos experiment action discriminator type + Type *ExperimentActionType } // GetExperimentAction implements the ExperimentActionClassification interface for type DiscreteAction. @@ -271,19 +268,19 @@ type Experiment struct { // REQUIRED; The properties of the experiment resource. Properties *ExperimentProperties - // The identity of the experiment resource. - Identity *ResourceIdentity + // The managed service identities assigned to this resource. + Identity *ManagedServiceIdentity // 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 Name *string - // READ-ONLY; The system metadata of the experiment resource. + // 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" @@ -295,8 +292,8 @@ type ExperimentAction struct { // REQUIRED; String that represents a Capability URN. Name *string - // REQUIRED; Enum that discriminates between action models. - Type *string + // REQUIRED; Chaos experiment action discriminator type + Type *ExperimentActionType } // GetExperimentAction implements the ExperimentActionClassification interface for type ExperimentAction. @@ -316,13 +313,16 @@ type ExperimentExecution struct { // The properties of experiment execution status. Properties *ExperimentExecutionProperties - // READ-ONLY; String of the fully qualified resource ID. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; String of the resource name. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; String of the resource type. + // 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 } @@ -398,11 +398,11 @@ type ExperimentExecutionDetailsPropertiesRunInformation struct { // ExperimentExecutionListResult - Model that represents a list of Experiment executions and a link for pagination. type ExperimentExecutionListResult struct { - // READ-ONLY; URL to retrieve the next page of Experiment executions. - NextLink *string - - // READ-ONLY; List of Experiment executions. + // REQUIRED; The ExperimentExecution items on this page Value []*ExperimentExecution + + // The link to the next page of items + NextLink *string } // ExperimentExecutionProperties - Model that represents the execution properties of an Experiment. @@ -419,11 +419,11 @@ type ExperimentExecutionProperties struct { // ExperimentListResult - Model that represents a list of Experiment resources and a link for pagination. type ExperimentListResult struct { - // READ-ONLY; URL to retrieve the next page of Experiment resources. - NextLink *string - - // READ-ONLY; List of Experiment resources. + // REQUIRED; The Experiment items on this page Value []*Experiment + + // The link to the next page of items + NextLink *string } // ExperimentProperties - Model that represents the Experiment properties model. @@ -449,10 +449,10 @@ type ExperimentStep struct { // ExperimentUpdate - Describes an experiment update. type ExperimentUpdate struct { - // The identity of the experiment resource. - Identity *ResourceIdentity + // The managed service identities assigned to this resource. + Identity *ManagedServiceIdentity - // The tags of the experiment resource. + // Resource tags. Tags map[string]*string } @@ -465,6 +465,26 @@ type KeyValuePair struct { Value *string } +// ManagedServiceIdentity - Managed service identity (system assigned and/or user assigned identities) +type ManagedServiceIdentity struct { + // REQUIRED; Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + Type *ManagedServiceIdentityType + + // The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM + // resource ids in the form: + // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + // The dictionary values can be empty objects ({}) in + // requests. + UserAssignedIdentities map[string]*UserAssignedIdentity + + // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned + // identity. + PrincipalID *string + + // READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *string +} + // Operation - Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { // Localized display information for this particular operation. @@ -514,54 +534,65 @@ type OperationListResult struct { Value []*Operation } -// OperationStatus - The status of operation. -type OperationStatus struct { +// OperationStatusResult - The current status of an async operation. +type OperationStatusResult struct { + // REQUIRED; Operation status. + Status *string + // The end time of the operation. - EndTime *string + EndTime *time.Time - // The error object. + // If present, details of the operation error. Error *ErrorDetail - // The operation Id. + // Fully qualified ID for the async operation. ID *string - // The operation name. + // Name of the async operation. Name *string + // The operations list. + Operations []*OperationStatusResult + + // Percent of the operation that is complete. + PercentComplete *float32 + // The start time of the operation. - StartTime *string + StartTime *time.Time - // The status of the operation. - Status *string + // READ-ONLY; Fully qualified ID of the resource against which the original async operation was started. + ResourceID *string } -// Resource - Common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a +// location +type ProxyResource struct { + // 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 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 } -// ResourceIdentity - The identity of a resource. -type ResourceIdentity struct { - // REQUIRED; String of the resource identity type. - Type *ResourceIdentityType +// Resource - Common fields that are returned in the response for all Azure Resource Manager resources +type Resource struct { + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string - // The list of user identities associated with the Experiment. The user identity dictionary key references will be ARM resource - // ids in the form: - // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - UserAssignedIdentities map[string]*UserAssignedIdentity + // READ-ONLY; The name of the resource + Name *string - // READ-ONLY; GUID that represents the principal ID of this resource identity. - PrincipalID *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; GUID that represents the tenant ID of this resource identity. - TenantID *string + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } // StepStatus - Model that represents the a list of branches and branch statuses. @@ -605,16 +636,16 @@ type Target struct { // REQUIRED; The properties of the target resource. Properties map[string]any - // Location of the target resource. + // Azure resource location. Location *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 Name *string - // READ-ONLY; The system metadata of the target resource. + // 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" @@ -623,7 +654,7 @@ type Target struct { // TargetFilter - Model that represents available filter types that can be applied to a targets list. type TargetFilter struct { - // REQUIRED; Enum that discriminates between filter types. Currently only Simple type is supported. + // REQUIRED; Chaos target filter discriminator type Type *FilterType } @@ -632,11 +663,11 @@ func (t *TargetFilter) GetTargetFilter() *TargetFilter { return t } // TargetListResult - Model that represents a list of Target resources and a link for pagination. type TargetListResult struct { - // READ-ONLY; URL to retrieve the next page of Target resources. - NextLink *string - - // READ-ONLY; List of Target resources. + // REQUIRED; The Target items on this page Value []*Target + + // The link to the next page of items + NextLink *string } // TargetListSelector - Model that represents a list selector. @@ -647,12 +678,9 @@ type TargetListSelector struct { // REQUIRED; List of Target references. Targets []*TargetReference - // REQUIRED; Enum of the selector type. + // REQUIRED; Chaos target selector discriminator type Type *SelectorType - // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]any - // Model that represents available filter types that can be applied to a targets list. Filter TargetFilterClassification } @@ -660,10 +688,9 @@ type TargetListSelector struct { // GetTargetSelector implements the TargetSelectorClassification interface for type TargetListSelector. func (t *TargetListSelector) GetTargetSelector() *TargetSelector { return &TargetSelector{ - AdditionalProperties: t.AdditionalProperties, - Filter: t.Filter, - ID: t.ID, - Type: t.Type, + Filter: t.Filter, + ID: t.ID, + Type: t.Type, } } @@ -678,12 +705,9 @@ type TargetQuerySelector struct { // REQUIRED; Subscription id list to scope resource query. SubscriptionIDs []*string - // REQUIRED; Enum of the selector type. + // REQUIRED; Chaos target selector discriminator type Type *SelectorType - // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]any - // Model that represents available filter types that can be applied to a targets list. Filter TargetFilterClassification } @@ -691,10 +715,9 @@ type TargetQuerySelector struct { // GetTargetSelector implements the TargetSelectorClassification interface for type TargetQuerySelector. func (t *TargetQuerySelector) GetTargetSelector() *TargetSelector { return &TargetSelector{ - AdditionalProperties: t.AdditionalProperties, - Filter: t.Filter, - ID: t.ID, - Type: t.Type, + Filter: t.Filter, + ID: t.ID, + Type: t.Type, } } @@ -712,12 +735,9 @@ type TargetSelector struct { // REQUIRED; String of the selector ID. ID *string - // REQUIRED; Enum of the selector type. + // REQUIRED; Chaos target selector discriminator type Type *SelectorType - // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]any - // Model that represents available filter types that can be applied to a targets list. Filter TargetFilterClassification } @@ -727,7 +747,7 @@ func (t *TargetSelector) GetTargetSelector() *TargetSelector { return t } // TargetSimpleFilter - Model that represents a simple target filter. type TargetSimpleFilter struct { - // REQUIRED; Enum that discriminates between filter types. Currently only Simple type is supported. + // REQUIRED; Chaos target filter discriminator type Type *FilterType // Model that represents the Simple filter parameters. @@ -752,16 +772,13 @@ type TargetType struct { // REQUIRED; The properties of the target type resource. Properties *TargetTypeProperties - // Location of the Target Type resource. - Location *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 Name *string - // READ-ONLY; The system metadata properties of the target type resource. + // 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" @@ -770,11 +787,11 @@ type TargetType struct { // TargetTypeListResult - Model that represents a list of Target Type resources and a link for pagination. type TargetTypeListResult struct { - // READ-ONLY; URL to retrieve the next page of Target Type resources. - NextLink *string - - // READ-ONLY; List of Target Type resources. + // REQUIRED; The TargetType items on this page Value []*TargetType + + // The link to the next page of items + NextLink *string } // TargetTypeProperties - Model that represents the base Target Type properties model. @@ -801,12 +818,15 @@ type TrackedResource struct { // 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 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 } diff --git a/sdk/resourcemanager/chaos/armchaos/models_serde.go b/sdk/resourcemanager/chaos/armchaos/models_serde.go index 81388afb9ed1..fe3a5632e4e0 100644 --- a/sdk/resourcemanager/chaos/armchaos/models_serde.go +++ b/sdk/resourcemanager/chaos/armchaos/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. @@ -222,7 +219,6 @@ func (c *CapabilityProperties) UnmarshalJSON(data []byte) error { func (c CapabilityType) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", c.ID) - populate(objectMap, "location", c.Location) populate(objectMap, "name", c.Name) populate(objectMap, "properties", c.Properties) populate(objectMap, "systemData", c.SystemData) @@ -242,9 +238,6 @@ func (c *CapabilityType) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &c.ID) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &c.Location) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) @@ -306,6 +299,7 @@ func (c CapabilityTypeProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "kind", c.Kind) populate(objectMap, "parametersSchema", c.ParametersSchema) populate(objectMap, "publisher", c.Publisher) + populate(objectMap, "requiredAzureRoleDefinitionIds", c.RequiredAzureRoleDefinitionIDs) populate(objectMap, "runtimeProperties", c.RuntimeProperties) populate(objectMap, "targetType", c.TargetType) populate(objectMap, "urn", c.Urn) @@ -342,6 +336,9 @@ func (c *CapabilityTypeProperties) UnmarshalJSON(data []byte) error { case "publisher": err = unpopulate(val, "Publisher", &c.Publisher) delete(rawMsg, key) + case "requiredAzureRoleDefinitionIds": + err = unpopulate(val, "RequiredAzureRoleDefinitionIDs", &c.RequiredAzureRoleDefinitionIDs) + delete(rawMsg, key) case "runtimeProperties": err = unpopulate(val, "RuntimeProperties", &c.RuntimeProperties) delete(rawMsg, key) @@ -393,7 +390,7 @@ func (c ContinuousAction) MarshalJSON() ([]byte, error) { populate(objectMap, "name", c.Name) populate(objectMap, "parameters", c.Parameters) populate(objectMap, "selectorId", c.SelectorID) - objectMap["type"] = "continuous" + objectMap["type"] = ExperimentActionTypeContinuous return json.Marshal(objectMap) } @@ -434,7 +431,7 @@ func (d DelayAction) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "duration", d.Duration) populate(objectMap, "name", d.Name) - objectMap["type"] = "delay" + objectMap["type"] = ExperimentActionTypeDelay return json.Marshal(objectMap) } @@ -470,7 +467,7 @@ func (d DiscreteAction) MarshalJSON() ([]byte, error) { populate(objectMap, "name", d.Name) populate(objectMap, "parameters", d.Parameters) populate(objectMap, "selectorId", d.SelectorID) - objectMap["type"] = "discrete" + objectMap["type"] = ExperimentActionTypeDiscrete return json.Marshal(objectMap) } @@ -727,6 +724,7 @@ func (e ExperimentExecution) MarshalJSON() ([]byte, error) { populate(objectMap, "id", e.ID) populate(objectMap, "name", e.Name) populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } @@ -749,6 +747,9 @@ func (e *ExperimentExecution) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &e.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) @@ -1172,6 +1173,45 @@ func (k *KeyValuePair) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. +func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", m.PrincipalID) + populate(objectMap, "tenantId", m.TenantID) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServiceIdentity. +func (m *ManagedServiceIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &m.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Operation. func (o Operation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1285,20 +1325,23 @@ func (o *OperationListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationStatus. -func (o OperationStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationStatusResult. +func (o OperationStatusResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "endTime", o.EndTime) + populateDateTimeRFC3339(objectMap, "endTime", o.EndTime) populate(objectMap, "error", o.Error) populate(objectMap, "id", o.ID) populate(objectMap, "name", o.Name) - populate(objectMap, "startTime", o.StartTime) + populate(objectMap, "operations", o.Operations) + populate(objectMap, "percentComplete", o.PercentComplete) + populate(objectMap, "resourceId", o.ResourceID) + populateDateTimeRFC3339(objectMap, "startTime", o.StartTime) populate(objectMap, "status", o.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatus. -func (o *OperationStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatusResult. +func (o *OperationStatusResult) 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) @@ -1307,7 +1350,7 @@ func (o *OperationStatus) UnmarshalJSON(data []byte) error { var err error switch key { case "endTime": - err = unpopulate(val, "EndTime", &o.EndTime) + err = unpopulateDateTimeRFC3339(val, "EndTime", &o.EndTime) delete(rawMsg, key) case "error": err = unpopulate(val, "Error", &o.Error) @@ -1318,8 +1361,17 @@ func (o *OperationStatus) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &o.Name) delete(rawMsg, key) + case "operations": + err = unpopulate(val, "Operations", &o.Operations) + delete(rawMsg, key) + case "percentComplete": + err = unpopulate(val, "PercentComplete", &o.PercentComplete) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &o.ResourceID) + delete(rawMsg, key) case "startTime": - err = unpopulate(val, "StartTime", &o.StartTime) + err = unpopulateDateTimeRFC3339(val, "StartTime", &o.StartTime) delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &o.Status) @@ -1332,53 +1384,57 @@ func (o *OperationStatus) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Resource. -func (r Resource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProxyResource. +func (p ProxyResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "type", r.Type) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. -func (r *Resource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. +func (p *ProxyResource) 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", r, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &r.ID) + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &r.Name) + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &r.Type) + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceIdentity. -func (r ResourceIdentity) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Resource. +func (r Resource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "tenantId", r.TenantID) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "systemData", r.SystemData) populate(objectMap, "type", r.Type) - populate(objectMap, "userAssignedIdentities", r.UserAssignedIdentities) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceIdentity. -func (r *ResourceIdentity) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) 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", r, err) @@ -1386,18 +1442,18 @@ func (r *ResourceIdentity) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) + case "id": + err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &r.TenantID) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) - case "userAssignedIdentities": - err = unpopulate(val, "UserAssignedIdentities", &r.UserAssignedIdentities) - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -1604,11 +1660,6 @@ func (t TargetListSelector) MarshalJSON() ([]byte, error) { populate(objectMap, "id", t.ID) populate(objectMap, "targets", t.Targets) objectMap["type"] = SelectorTypeList - if t.AdditionalProperties != nil { - for key, val := range t.AdditionalProperties { - objectMap[key] = val - } - } return json.Marshal(objectMap) } @@ -1633,16 +1684,6 @@ func (t *TargetListSelector) UnmarshalJSON(data []byte) error { case "type": err = unpopulate(val, "Type", &t.Type) delete(rawMsg, key) - default: - if t.AdditionalProperties == nil { - t.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - t.AdditionalProperties[key] = aux - } - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -1659,11 +1700,6 @@ func (t TargetQuerySelector) MarshalJSON() ([]byte, error) { populate(objectMap, "queryString", t.QueryString) populate(objectMap, "subscriptionIds", t.SubscriptionIDs) objectMap["type"] = SelectorTypeQuery - if t.AdditionalProperties != nil { - for key, val := range t.AdditionalProperties { - objectMap[key] = val - } - } return json.Marshal(objectMap) } @@ -1691,16 +1727,6 @@ func (t *TargetQuerySelector) UnmarshalJSON(data []byte) error { case "type": err = unpopulate(val, "Type", &t.Type) delete(rawMsg, key) - default: - if t.AdditionalProperties == nil { - t.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - t.AdditionalProperties[key] = aux - } - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -1746,11 +1772,6 @@ func (t TargetSelector) MarshalJSON() ([]byte, error) { populate(objectMap, "filter", t.Filter) populate(objectMap, "id", t.ID) objectMap["type"] = t.Type - if t.AdditionalProperties != nil { - for key, val := range t.AdditionalProperties { - objectMap[key] = val - } - } return json.Marshal(objectMap) } @@ -1772,16 +1793,6 @@ func (t *TargetSelector) UnmarshalJSON(data []byte) error { case "type": err = unpopulate(val, "Type", &t.Type) delete(rawMsg, key) - default: - if t.AdditionalProperties == nil { - t.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - t.AdditionalProperties[key] = aux - } - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -1852,7 +1863,6 @@ func (t *TargetSimpleFilterParameters) UnmarshalJSON(data []byte) error { func (t TargetType) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) populate(objectMap, "name", t.Name) populate(objectMap, "properties", t.Properties) populate(objectMap, "systemData", t.SystemData) @@ -1872,9 +1882,6 @@ func (t *TargetType) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &t.ID) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &t.Location) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &t.Name) delete(rawMsg, key) @@ -1971,6 +1978,7 @@ func (t TrackedResource) MarshalJSON() ([]byte, error) { populate(objectMap, "id", t.ID) populate(objectMap, "location", t.Location) populate(objectMap, "name", t.Name) + populate(objectMap, "systemData", t.SystemData) populate(objectMap, "tags", t.Tags) populate(objectMap, "type", t.Type) return json.Marshal(objectMap) @@ -1994,6 +2002,9 @@ func (t *TrackedResource) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &t.Name) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &t.Tags) delete(rawMsg, key) diff --git a/sdk/resourcemanager/chaos/armchaos/operations_client.go b/sdk/resourcemanager/chaos/armchaos/operations_client.go index 09f52bccdddc..50598e668583 100644 --- a/sdk/resourcemanager/chaos/armchaos/operations_client.go +++ b/sdk/resourcemanager/chaos/armchaos/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,9 +34,9 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO return client, nil } -// NewListAllPager - Get a list all available Operations. +// NewListAllPager - List the operations for the provider // -// Generated from API version 2024-01-01 +// Generated from API version 2025-01-01 // - options - OperationsClientListAllOptions contains the optional parameters for the OperationsClient.NewListAllPager method. func (client *OperationsClient) NewListAllPager(options *OperationsClientListAllOptions) *runtime.Pager[OperationsClientListAllResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListAllResponse]{ @@ -65,14 +62,14 @@ func (client *OperationsClient) NewListAllPager(options *OperationsClientListAll } // listAllCreateRequest creates the ListAll request. -func (client *OperationsClient) listAllCreateRequest(ctx context.Context, options *OperationsClientListAllOptions) (*policy.Request, error) { +func (client *OperationsClient) listAllCreateRequest(ctx context.Context, _ *OperationsClientListAllOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Chaos/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/chaos/armchaos/operations_live_test.go b/sdk/resourcemanager/chaos/armchaos/operations_live_test.go index bfdd647bf766..cc9420d59ea5 100644 --- a/sdk/resourcemanager/chaos/armchaos/operations_live_test.go +++ b/sdk/resourcemanager/chaos/armchaos/operations_live_test.go @@ -14,7 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3/testutil" "github.com/stretchr/testify/suite" ) diff --git a/sdk/resourcemanager/chaos/armchaos/operationstatuses_client.go b/sdk/resourcemanager/chaos/armchaos/operationstatuses_client.go index f5e384736644..da67736994fa 100644 --- a/sdk/resourcemanager/chaos/armchaos/operationstatuses_client.go +++ b/sdk/resourcemanager/chaos/armchaos/operationstatuses_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 OperationStatusesClient struct { } // NewOperationStatusesClient creates a new instance of OperationStatusesClient with the specified values. -// - subscriptionID - GUID that represents an Azure subscription ID. +// - 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 NewOperationStatusesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationStatusesClient, error) { @@ -43,20 +40,20 @@ func NewOperationStatusesClient(subscriptionID string, credential azcore.TokenCr return client, nil } -// Get - Get the status of a long running azure asynchronous operation. +// Get - Returns the current status of an async operation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 +// Generated from API version 2025-01-01 // - location - The name of the Azure region. -// - asyncOperationID - The operation Id. +// - operationID - The ID of an ongoing async operation. // - options - OperationStatusesClientGetOptions contains the optional parameters for the OperationStatusesClient.Get method. -func (client *OperationStatusesClient) Get(ctx context.Context, location string, asyncOperationID string, options *OperationStatusesClientGetOptions) (OperationStatusesClientGetResponse, error) { +func (client *OperationStatusesClient) Get(ctx context.Context, location string, operationID string, options *OperationStatusesClientGetOptions) (OperationStatusesClientGetResponse, error) { var err error const operationName = "OperationStatusesClient.Get" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, location, asyncOperationID, options) + req, err := client.getCreateRequest(ctx, location, operationID, options) if err != nil { return OperationStatusesClientGetResponse{}, err } @@ -73,26 +70,26 @@ func (client *OperationStatusesClient) Get(ctx context.Context, location string, } // getCreateRequest creates the Get request. -func (client *OperationStatusesClient) getCreateRequest(ctx context.Context, location string, asyncOperationID string, options *OperationStatusesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{location}/operationStatuses/{asyncOperationId}" +func (client *OperationStatusesClient) getCreateRequest(ctx context.Context, location string, operationID string, _ *OperationStatusesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{location}/operationStatuses/{operationId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) if location == "" { return nil, errors.New("parameter location cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) - if asyncOperationID == "" { - return nil, errors.New("parameter asyncOperationID cannot be empty") + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{asyncOperationId}", url.PathEscape(asyncOperationID)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -101,7 +98,7 @@ func (client *OperationStatusesClient) getCreateRequest(ctx context.Context, loc // getHandleResponse handles the Get response. func (client *OperationStatusesClient) getHandleResponse(resp *http.Response) (OperationStatusesClientGetResponse, error) { result := OperationStatusesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatusResult); err != nil { return OperationStatusesClientGetResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/chaos/armchaos/operationstatuses_client_example_test.go b/sdk/resourcemanager/chaos/armchaos/operationstatuses_client_example_test.go deleted file mode 100644 index e72b29a01520..000000000000 --- a/sdk/resourcemanager/chaos/armchaos/operationstatuses_client_example_test.go +++ /dev/null @@ -1,45 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armchaos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetOperationStatus.json -func ExampleOperationStatusesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOperationStatusesClient().Get(ctx, "West US", "713192d7-503f-477a-9cfe-4efc3ee2bd11", 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.OperationStatus = armchaos.OperationStatus{ - // Name: to.Ptr("713192d7-503f-477a-9cfe-4efc3ee2bd11"), - // EndTime: to.Ptr("2017-01-01T16:13:13.933Z"), - // ID: to.Ptr("/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/locations/westus/operationStatuses/713192d7-503f-477a-9cfe-4efc3ee2bd11"), - // StartTime: to.Ptr("2017-01-01T13:13:13.933Z"), - // Status: to.Ptr("Succeeded"), - // } -} diff --git a/sdk/resourcemanager/chaos/armchaos/options.go b/sdk/resourcemanager/chaos/armchaos/options.go index 088c8b736b47..5ecba6bf336c 100644 --- a/sdk/resourcemanager/chaos/armchaos/options.go +++ b/sdk/resourcemanager/chaos/armchaos/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. @@ -42,32 +39,32 @@ type CapabilityTypesClientListOptions struct { // ExperimentsClientBeginCancelOptions contains the optional parameters for the ExperimentsClient.BeginCancel method. type ExperimentsClientBeginCancelOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ExperimentsClientBeginCreateOrUpdateOptions contains the optional parameters for the ExperimentsClient.BeginCreateOrUpdate // method. type ExperimentsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ExperimentsClientBeginDeleteOptions contains the optional parameters for the ExperimentsClient.BeginDelete method. type ExperimentsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ExperimentsClientBeginStartOptions contains the optional parameters for the ExperimentsClient.BeginStart method. type ExperimentsClientBeginStartOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ExperimentsClientBeginUpdateOptions contains the optional parameters for the ExperimentsClient.BeginUpdate method. type ExperimentsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } diff --git a/sdk/resourcemanager/chaos/armchaos/polymorphic_helpers.go b/sdk/resourcemanager/chaos/armchaos/polymorphic_helpers.go index ebf835864e47..e7fc1b4df060 100644 --- a/sdk/resourcemanager/chaos/armchaos/polymorphic_helpers.go +++ b/sdk/resourcemanager/chaos/armchaos/polymorphic_helpers.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. @@ -20,11 +17,11 @@ func unmarshalExperimentActionClassification(rawMsg json.RawMessage) (Experiment } var b ExperimentActionClassification switch m["type"] { - case "continuous": + case string(ExperimentActionTypeContinuous): b = &ContinuousAction{} - case "delay": + case string(ExperimentActionTypeDelay): b = &DelayAction{} - case "discrete": + case string(ExperimentActionTypeDiscrete): b = &DiscreteAction{} default: b = &ExperimentAction{} diff --git a/sdk/resourcemanager/chaos/armchaos/responses.go b/sdk/resourcemanager/chaos/armchaos/responses.go index 7f27a717922c..21d77ede8e1c 100644 --- a/sdk/resourcemanager/chaos/armchaos/responses.go +++ b/sdk/resourcemanager/chaos/armchaos/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. @@ -108,8 +105,8 @@ type ExperimentsClientUpdateResponse struct { // OperationStatusesClientGetResponse contains the response from method OperationStatusesClient.Get. type OperationStatusesClientGetResponse struct { - // The status of operation. - OperationStatus + // The current status of an async operation. + OperationStatusResult } // OperationsClientListAllResponse contains the response from method OperationsClient.NewListAllPager. diff --git a/sdk/resourcemanager/chaos/armchaos/targets_client.go b/sdk/resourcemanager/chaos/armchaos/targets_client.go index 9254b1b2c863..63f751b6888e 100644 --- a/sdk/resourcemanager/chaos/armchaos/targets_client.go +++ b/sdk/resourcemanager/chaos/armchaos/targets_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 TargetsClient struct { } // NewTargetsClient creates a new instance of TargetsClient with the specified values. -// - subscriptionID - GUID that represents an Azure subscription ID. +// - 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 NewTargetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TargetsClient, error) { @@ -46,21 +43,21 @@ func NewTargetsClient(subscriptionID string, credential azcore.TokenCredential, // CreateOrUpdate - Create or update a Target resource that extends a tracked regional resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. -// - parentProviderNamespace - String that represents a resource provider namespace. -// - parentResourceType - String that represents a resource type. -// - parentResourceName - String that represents a resource name. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - parentProviderNamespace - The parent resource provider namespace. +// - parentResourceType - The parent resource type. +// - parentResourceName - The parent resource name. // - targetName - String that represents a Target resource name. -// - target - Target resource to be created or updated. +// - resource - Target resource to be created or updated. // - options - TargetsClientCreateOrUpdateOptions contains the optional parameters for the TargetsClient.CreateOrUpdate method. -func (client *TargetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, target Target, options *TargetsClientCreateOrUpdateOptions) (TargetsClientCreateOrUpdateResponse, error) { +func (client *TargetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, resource Target, options *TargetsClientCreateOrUpdateOptions) (TargetsClientCreateOrUpdateResponse, error) { var err error const operationName = "TargetsClient.CreateOrUpdate" 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, parentProviderNamespace, parentResourceType, parentResourceName, targetName, target, options) + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, targetName, resource, options) if err != nil { return TargetsClientCreateOrUpdateResponse{}, err } @@ -68,7 +65,7 @@ func (client *TargetsClient) CreateOrUpdate(ctx context.Context, resourceGroupNa if err != nil { return TargetsClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { err = runtime.NewResponseError(httpResp) return TargetsClientCreateOrUpdateResponse{}, err } @@ -77,7 +74,7 @@ func (client *TargetsClient) CreateOrUpdate(ctx context.Context, resourceGroupNa } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *TargetsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, target Target, options *TargetsClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *TargetsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, resource Target, _ *TargetsClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -108,10 +105,10 @@ func (client *TargetsClient) createOrUpdateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, target); err != nil { + if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } return req, nil @@ -129,11 +126,11 @@ func (client *TargetsClient) createOrUpdateHandleResponse(resp *http.Response) ( // Delete - Delete a Target resource that extends a tracked regional resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. -// - parentProviderNamespace - String that represents a resource provider namespace. -// - parentResourceType - String that represents a resource type. -// - parentResourceName - String that represents a resource name. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - parentProviderNamespace - The parent resource provider namespace. +// - parentResourceType - The parent resource type. +// - parentResourceName - The parent resource name. // - targetName - String that represents a Target resource name. // - options - TargetsClientDeleteOptions contains the optional parameters for the TargetsClient.Delete method. func (client *TargetsClient) Delete(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, options *TargetsClientDeleteOptions) (TargetsClientDeleteResponse, error) { @@ -158,7 +155,7 @@ func (client *TargetsClient) Delete(ctx context.Context, resourceGroupName strin } // deleteCreateRequest creates the Delete request. -func (client *TargetsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, options *TargetsClientDeleteOptions) (*policy.Request, error) { +func (client *TargetsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, _ *TargetsClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -189,7 +186,7 @@ func (client *TargetsClient) deleteCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -198,11 +195,11 @@ func (client *TargetsClient) deleteCreateRequest(ctx context.Context, resourceGr // Get - Get a Target resource that extends a tracked regional resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. -// - parentProviderNamespace - String that represents a resource provider namespace. -// - parentResourceType - String that represents a resource type. -// - parentResourceName - String that represents a resource name. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - parentProviderNamespace - The parent resource provider namespace. +// - parentResourceType - The parent resource type. +// - parentResourceName - The parent resource name. // - targetName - String that represents a Target resource name. // - options - TargetsClientGetOptions contains the optional parameters for the TargetsClient.Get method. func (client *TargetsClient) Get(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, options *TargetsClientGetOptions) (TargetsClientGetResponse, error) { @@ -228,7 +225,7 @@ func (client *TargetsClient) Get(ctx context.Context, resourceGroupName string, } // getCreateRequest creates the Get request. -func (client *TargetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, options *TargetsClientGetOptions) (*policy.Request, error) { +func (client *TargetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, _ *TargetsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -259,7 +256,7 @@ func (client *TargetsClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -276,11 +273,11 @@ func (client *TargetsClient) getHandleResponse(resp *http.Response) (TargetsClie // NewListPager - Get a list of Target resources that extend a tracked regional resource. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. -// - parentProviderNamespace - String that represents a resource provider namespace. -// - parentResourceType - String that represents a resource type. -// - parentResourceName - String that represents a resource name. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - parentProviderNamespace - The parent resource provider namespace. +// - parentResourceType - The parent resource type. +// - parentResourceName - The parent resource name. // - options - TargetsClientListOptions contains the optional parameters for the TargetsClient.NewListPager method. func (client *TargetsClient) NewListPager(resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, options *TargetsClientListOptions) *runtime.Pager[TargetsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[TargetsClientListResponse]{ @@ -333,7 +330,7 @@ func (client *TargetsClient) listCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") if options != nil && options.ContinuationToken != nil { reqQP.Set("continuationToken", *options.ContinuationToken) } diff --git a/sdk/resourcemanager/chaos/armchaos/targets_client_example_test.go b/sdk/resourcemanager/chaos/armchaos/targets_client_example_test.go deleted file mode 100644 index 3e8729e5b735..000000000000 --- a/sdk/resourcemanager/chaos/armchaos/targets_client_example_test.go +++ /dev/null @@ -1,169 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armchaos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListTargets.json -func ExampleTargetsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTargetsClient().NewListPager("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", &armchaos.TargetsClientListOptions{ContinuationToken: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.TargetListResult = armchaos.TargetListResult{ - // Value: []*armchaos.Target{ - // { - // Name: to.Ptr("Microsoft-Agent"), - // Type: to.Ptr("Microsoft.Chaos/targets"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-Agent"), - // Location: to.Ptr("centraluseuap"), - // Properties: map[string]any{ - // "agentProfileId": "ac4e8251-fdc9-4277-8e87-dc57fe5794cf", - // "identities": []any{ - // map[string]any{ - // "type": "CertificateSubjectIssuer", - // "subject": "CN=example.subject", - // }, - // }, - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetTarget.json -func ExampleTargetsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTargetsClient().Get(ctx, "exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-Agent", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Target = armchaos.Target{ - // Name: to.Ptr("Microsoft-Agent"), - // Type: to.Ptr("Microsoft.Chaos/targets"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-Agent"), - // Location: to.Ptr("centraluseuap"), - // Properties: map[string]any{ - // "agentProfileId": "ac4e8251-fdc9-4277-8e87-dc57fe5794cf", - // "identities": []any{ - // map[string]any{ - // "type": "CertificateSubjectIssuer", - // "subject": "CN=example.subject", - // }, - // }, - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DeleteTarget.json -func ExampleTargetsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewTargetsClient().Delete(ctx, "exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-Agent", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/CreateUpdateTarget.json -func ExampleTargetsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTargetsClient().CreateOrUpdate(ctx, "exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-Agent", armchaos.Target{ - Properties: map[string]any{ - "identities": []any{ - map[string]any{ - "type": "CertificateSubjectIssuer", - "subject": "CN=example.subject", - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Target = armchaos.Target{ - // Name: to.Ptr("Microsoft-Agent"), - // Type: to.Ptr("Microsoft.Chaos/targets"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-Agent"), - // Location: to.Ptr("centraluseuap"), - // Properties: map[string]any{ - // "agentProfileId": "ac4e8251-fdc9-4277-8e87-dc57fe5794cf", - // "identities": []any{ - // map[string]any{ - // "type": "CertificateSubjectIssuer", - // "subject": "CN=example.subject", - // }, - // }, - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()), - // }, - // } -} diff --git a/sdk/resourcemanager/chaos/armchaos/targets_live_test.go b/sdk/resourcemanager/chaos/armchaos/targets_live_test.go index cf78e4a3a1a6..3d17da23c2d4 100644 --- a/sdk/resourcemanager/chaos/armchaos/targets_live_test.go +++ b/sdk/resourcemanager/chaos/armchaos/targets_live_test.go @@ -15,7 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3/testutil" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" "github.com/stretchr/testify/suite" diff --git a/sdk/resourcemanager/chaos/armchaos/targettypes_client.go b/sdk/resourcemanager/chaos/armchaos/targettypes_client.go index c84ab3f33eb4..119b476ea4b0 100644 --- a/sdk/resourcemanager/chaos/armchaos/targettypes_client.go +++ b/sdk/resourcemanager/chaos/armchaos/targettypes_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 TargetTypesClient struct { } // NewTargetTypesClient creates a new instance of TargetTypesClient with the specified values. -// - subscriptionID - GUID that represents an Azure subscription ID. +// - 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 NewTargetTypesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TargetTypesClient, error) { @@ -46,17 +43,17 @@ func NewTargetTypesClient(subscriptionID string, credential azcore.TokenCredenti // Get - Get a Target Type resources for given location. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - locationName - String that represents a Location resource name. +// Generated from API version 2025-01-01 +// - location - The name of the Azure region. // - targetTypeName - String that represents a Target Type resource name. // - options - TargetTypesClientGetOptions contains the optional parameters for the TargetTypesClient.Get method. -func (client *TargetTypesClient) Get(ctx context.Context, locationName string, targetTypeName string, options *TargetTypesClientGetOptions) (TargetTypesClientGetResponse, error) { +func (client *TargetTypesClient) Get(ctx context.Context, location string, targetTypeName string, options *TargetTypesClientGetOptions) (TargetTypesClientGetResponse, error) { var err error const operationName = "TargetTypesClient.Get" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, locationName, targetTypeName, options) + req, err := client.getCreateRequest(ctx, location, targetTypeName, options) if err != nil { return TargetTypesClientGetResponse{}, err } @@ -73,16 +70,16 @@ func (client *TargetTypesClient) Get(ctx context.Context, locationName string, t } // getCreateRequest creates the Get request. -func (client *TargetTypesClient) getCreateRequest(ctx context.Context, locationName string, targetTypeName string, options *TargetTypesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}" +func (client *TargetTypesClient) getCreateRequest(ctx context.Context, location string, targetTypeName string, _ *TargetTypesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{location}/targetTypes/{targetTypeName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if locationName == "" { - return nil, errors.New("parameter locationName cannot be empty") + if location == "" { + return nil, errors.New("parameter location cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) if targetTypeName == "" { return nil, errors.New("parameter targetTypeName cannot be empty") } @@ -92,7 +89,7 @@ func (client *TargetTypesClient) getCreateRequest(ctx context.Context, locationN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -109,10 +106,10 @@ func (client *TargetTypesClient) getHandleResponse(resp *http.Response) (TargetT // NewListPager - Get a list of Target Type resources for given location. // -// Generated from API version 2024-01-01 -// - locationName - String that represents a Location resource name. +// Generated from API version 2025-01-01 +// - location - The name of the Azure region. // - options - TargetTypesClientListOptions contains the optional parameters for the TargetTypesClient.NewListPager method. -func (client *TargetTypesClient) NewListPager(locationName string, options *TargetTypesClientListOptions) *runtime.Pager[TargetTypesClientListResponse] { +func (client *TargetTypesClient) NewListPager(location string, options *TargetTypesClientListOptions) *runtime.Pager[TargetTypesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[TargetTypesClientListResponse]{ More: func(page TargetTypesClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -124,7 +121,7 @@ func (client *TargetTypesClient) NewListPager(locationName string, options *Targ nextLink = *page.NextLink } resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, locationName, options) + return client.listCreateRequest(ctx, location, options) }, nil) if err != nil { return TargetTypesClientListResponse{}, err @@ -136,22 +133,22 @@ func (client *TargetTypesClient) NewListPager(locationName string, options *Targ } // listCreateRequest creates the List request. -func (client *TargetTypesClient) listCreateRequest(ctx context.Context, locationName string, options *TargetTypesClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes" +func (client *TargetTypesClient) listCreateRequest(ctx context.Context, location string, options *TargetTypesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{location}/targetTypes" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if locationName == "" { - return nil, errors.New("parameter locationName cannot be empty") + if location == "" { + return nil, errors.New("parameter location cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") if options != nil && options.ContinuationToken != nil { reqQP.Set("continuationToken", *options.ContinuationToken) } diff --git a/sdk/resourcemanager/chaos/armchaos/targettypes_client_example_test.go b/sdk/resourcemanager/chaos/armchaos/targettypes_client_example_test.go deleted file mode 100644 index c26ec4669bc6..000000000000 --- a/sdk/resourcemanager/chaos/armchaos/targettypes_client_example_test.go +++ /dev/null @@ -1,94 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armchaos_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListTargetTypes.json -func ExampleTargetTypesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTargetTypesClient().NewListPager("westus2", &armchaos.TargetTypesClientListOptions{ContinuationToken: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.TargetTypeListResult = armchaos.TargetTypeListResult{ - // Value: []*armchaos.TargetType{ - // { - // Name: to.Ptr("Microsoft-Agent"), - // Type: to.Ptr("Microsoft.Chaos/locations/targetTypes"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/providers/Microsoft.Chaos/locations/westus2/targetTypes/Microsoft-Agent"), - // Location: to.Ptr("centraluseuap"), - // Properties: &armchaos.TargetTypeProperties{ - // Description: to.Ptr("A target represents Chaos Agent."), - // DisplayName: to.Ptr("Chaos Agent"), - // PropertiesSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine.json"), - // ResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines"), - // to.Ptr("Microsoft.Compute/virtualMachineScaleSets")}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetTargetType.json -func ExampleTargetTypesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTargetTypesClient().Get(ctx, "westus2", "Microsoft-Agent", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TargetType = armchaos.TargetType{ - // Name: to.Ptr("Microsoft-Agent"), - // Type: to.Ptr("Microsoft.Chaos/locations/targetTypes"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/providers/Microsoft.Chaos/locations/westus2/targetTypes/Microsoft-Agent"), - // Location: to.Ptr("centraluseuap"), - // Properties: &armchaos.TargetTypeProperties{ - // Description: to.Ptr("A target represents Chaos Agent."), - // DisplayName: to.Ptr("Chaos Agent"), - // PropertiesSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine.json"), - // ResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines"), - // to.Ptr("Microsoft.Compute/virtualMachineScaleSets")}, - // }, - // } -} diff --git a/sdk/resourcemanager/chaos/armchaos/targettypes_live_test.go b/sdk/resourcemanager/chaos/armchaos/targettypes_live_test.go index 494f73e36464..74d58009e393 100644 --- a/sdk/resourcemanager/chaos/armchaos/targettypes_live_test.go +++ b/sdk/resourcemanager/chaos/armchaos/targettypes_live_test.go @@ -14,7 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3/testutil" "github.com/stretchr/testify/suite" ) diff --git a/sdk/resourcemanager/chaos/armchaos/time_rfc3339.go b/sdk/resourcemanager/chaos/armchaos/time_rfc3339.go index 136b2093dcd6..d7f1c27fba2a 100644 --- a/sdk/resourcemanager/chaos/armchaos/time_rfc3339.go +++ b/sdk/resourcemanager/chaos/armchaos/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. @@ -60,6 +57,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/CHANGELOG.md b/sdk/resourcemanager/computeschedule/armcomputeschedule/CHANGELOG.md index 05bafe390c04..b5434ac307dd 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/CHANGELOG.md +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/CHANGELOG.md @@ -1,5 +1,21 @@ # Release History +## 1.1.0 (2025-04-27) +### Features Added + +- New function `*ScheduledActionsClient.VirtualMachinesExecuteCreate(context.Context, string, ExecuteCreateRequest, *ScheduledActionsClientVirtualMachinesExecuteCreateOptions) (ScheduledActionsClientVirtualMachinesExecuteCreateResponse, error)` +- New function `*ScheduledActionsClient.VirtualMachinesExecuteDelete(context.Context, string, ExecuteDeleteRequest, *ScheduledActionsClientVirtualMachinesExecuteDeleteOptions) (ScheduledActionsClientVirtualMachinesExecuteDeleteResponse, error)` +- New function `*ScheduledActionsClient.VirtualMachinesSubmitCreate(context.Context, string, SubmitCreateRequest, *ScheduledActionsClientVirtualMachinesSubmitCreateOptions) (ScheduledActionsClientVirtualMachinesSubmitCreateResponse, error)` +- New function `*ScheduledActionsClient.VirtualMachinesSubmitDelete(context.Context, string, SubmitDeleteRequest, *ScheduledActionsClientVirtualMachinesSubmitDeleteOptions) (ScheduledActionsClientVirtualMachinesSubmitDeleteResponse, error)` +- New struct `CreateResourceOperationResponse` +- New struct `DeleteResourceOperationResponse` +- New struct `ExecuteCreateRequest` +- New struct `ExecuteDeleteRequest` +- New struct `ResourceProvisionPayload` +- New struct `SubmitCreateRequest` +- New struct `SubmitDeleteRequest` + + ## 1.0.0 (2025-01-24) ### Breaking Changes diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/autorest.md b/sdk/resourcemanager/computeschedule/armcomputeschedule/autorest.md index ed1d8d0e071a..feb7b2ce9750 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/autorest.md +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/8a4eca6b060cf70da696963245656fdc440b666b/specification/computeschedule/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/8a4eca6b060cf70da696963245656fdc440b666b/specification/computeschedule/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/computeschedule/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/computeschedule/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 -tag: package-2024-10-01 +module-version: 1.1.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/client_factory.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/client_factory.go index f3b18164ab51..24b78d73c2b6 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/client_factory.go +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/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. diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/constants.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/constants.go index 373c327a661b..ec8f44d0bce2 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/constants.go +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/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 armcomputeschedule const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computeschedule/armcomputeschedule" - moduleVersion = "v1.0.0" + moduleVersion = "v1.1.0" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/internal.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/internal.go index 5f75802a569e..4b65adc76adb 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/internal.go +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/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/computeschedule/armcomputeschedule/fake/operations_server.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/operations_server.go index 0e47f1aeeaef..da9ddd88ff13 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/operations_server.go +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/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. @@ -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/computeschedule/armcomputeschedule/fake/scheduledactions_server.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/scheduledactions_server.go index bed1392f6310..d2edf2fc7467 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/scheduledactions_server.go +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/scheduledactions_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. @@ -27,10 +24,18 @@ type ScheduledActionsServer struct { // HTTP status codes to indicate success: http.StatusOK VirtualMachinesCancelOperations func(ctx context.Context, locationparameter string, requestBody armcomputeschedule.CancelOperationsRequest, options *armcomputeschedule.ScheduledActionsClientVirtualMachinesCancelOperationsOptions) (resp azfake.Responder[armcomputeschedule.ScheduledActionsClientVirtualMachinesCancelOperationsResponse], errResp azfake.ErrorResponder) + // VirtualMachinesExecuteCreate is the fake for method ScheduledActionsClient.VirtualMachinesExecuteCreate + // HTTP status codes to indicate success: http.StatusOK + VirtualMachinesExecuteCreate func(ctx context.Context, locationparameter string, requestBody armcomputeschedule.ExecuteCreateRequest, options *armcomputeschedule.ScheduledActionsClientVirtualMachinesExecuteCreateOptions) (resp azfake.Responder[armcomputeschedule.ScheduledActionsClientVirtualMachinesExecuteCreateResponse], errResp azfake.ErrorResponder) + // VirtualMachinesExecuteDeallocate is the fake for method ScheduledActionsClient.VirtualMachinesExecuteDeallocate // HTTP status codes to indicate success: http.StatusOK VirtualMachinesExecuteDeallocate func(ctx context.Context, locationparameter string, requestBody armcomputeschedule.ExecuteDeallocateRequest, options *armcomputeschedule.ScheduledActionsClientVirtualMachinesExecuteDeallocateOptions) (resp azfake.Responder[armcomputeschedule.ScheduledActionsClientVirtualMachinesExecuteDeallocateResponse], errResp azfake.ErrorResponder) + // VirtualMachinesExecuteDelete is the fake for method ScheduledActionsClient.VirtualMachinesExecuteDelete + // HTTP status codes to indicate success: http.StatusOK + VirtualMachinesExecuteDelete func(ctx context.Context, locationparameter string, requestBody armcomputeschedule.ExecuteDeleteRequest, options *armcomputeschedule.ScheduledActionsClientVirtualMachinesExecuteDeleteOptions) (resp azfake.Responder[armcomputeschedule.ScheduledActionsClientVirtualMachinesExecuteDeleteResponse], errResp azfake.ErrorResponder) + // VirtualMachinesExecuteHibernate is the fake for method ScheduledActionsClient.VirtualMachinesExecuteHibernate // HTTP status codes to indicate success: http.StatusOK VirtualMachinesExecuteHibernate func(ctx context.Context, locationparameter string, requestBody armcomputeschedule.ExecuteHibernateRequest, options *armcomputeschedule.ScheduledActionsClientVirtualMachinesExecuteHibernateOptions) (resp azfake.Responder[armcomputeschedule.ScheduledActionsClientVirtualMachinesExecuteHibernateResponse], errResp azfake.ErrorResponder) @@ -47,10 +52,18 @@ type ScheduledActionsServer struct { // HTTP status codes to indicate success: http.StatusOK VirtualMachinesGetOperationStatus func(ctx context.Context, locationparameter string, requestBody armcomputeschedule.GetOperationStatusRequest, options *armcomputeschedule.ScheduledActionsClientVirtualMachinesGetOperationStatusOptions) (resp azfake.Responder[armcomputeschedule.ScheduledActionsClientVirtualMachinesGetOperationStatusResponse], errResp azfake.ErrorResponder) + // VirtualMachinesSubmitCreate is the fake for method ScheduledActionsClient.VirtualMachinesSubmitCreate + // HTTP status codes to indicate success: http.StatusOK + VirtualMachinesSubmitCreate func(ctx context.Context, locationparameter string, requestBody armcomputeschedule.SubmitCreateRequest, options *armcomputeschedule.ScheduledActionsClientVirtualMachinesSubmitCreateOptions) (resp azfake.Responder[armcomputeschedule.ScheduledActionsClientVirtualMachinesSubmitCreateResponse], errResp azfake.ErrorResponder) + // VirtualMachinesSubmitDeallocate is the fake for method ScheduledActionsClient.VirtualMachinesSubmitDeallocate // HTTP status codes to indicate success: http.StatusOK VirtualMachinesSubmitDeallocate func(ctx context.Context, locationparameter string, requestBody armcomputeschedule.SubmitDeallocateRequest, options *armcomputeschedule.ScheduledActionsClientVirtualMachinesSubmitDeallocateOptions) (resp azfake.Responder[armcomputeschedule.ScheduledActionsClientVirtualMachinesSubmitDeallocateResponse], errResp azfake.ErrorResponder) + // VirtualMachinesSubmitDelete is the fake for method ScheduledActionsClient.VirtualMachinesSubmitDelete + // HTTP status codes to indicate success: http.StatusOK + VirtualMachinesSubmitDelete func(ctx context.Context, locationparameter string, requestBody armcomputeschedule.SubmitDeleteRequest, options *armcomputeschedule.ScheduledActionsClientVirtualMachinesSubmitDeleteOptions) (resp azfake.Responder[armcomputeschedule.ScheduledActionsClientVirtualMachinesSubmitDeleteResponse], errResp azfake.ErrorResponder) + // VirtualMachinesSubmitHibernate is the fake for method ScheduledActionsClient.VirtualMachinesSubmitHibernate // HTTP status codes to indicate success: http.StatusOK VirtualMachinesSubmitHibernate func(ctx context.Context, locationparameter string, requestBody armcomputeschedule.SubmitHibernateRequest, options *armcomputeschedule.ScheduledActionsClientVirtualMachinesSubmitHibernateOptions) (resp azfake.Responder[armcomputeschedule.ScheduledActionsClientVirtualMachinesSubmitHibernateResponse], errResp azfake.ErrorResponder) @@ -81,37 +94,64 @@ func (s *ScheduledActionsServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "ScheduledActionsClient.VirtualMachinesCancelOperations": - resp, err = s.dispatchVirtualMachinesCancelOperations(req) - case "ScheduledActionsClient.VirtualMachinesExecuteDeallocate": - resp, err = s.dispatchVirtualMachinesExecuteDeallocate(req) - case "ScheduledActionsClient.VirtualMachinesExecuteHibernate": - resp, err = s.dispatchVirtualMachinesExecuteHibernate(req) - case "ScheduledActionsClient.VirtualMachinesExecuteStart": - resp, err = s.dispatchVirtualMachinesExecuteStart(req) - case "ScheduledActionsClient.VirtualMachinesGetOperationErrors": - resp, err = s.dispatchVirtualMachinesGetOperationErrors(req) - case "ScheduledActionsClient.VirtualMachinesGetOperationStatus": - resp, err = s.dispatchVirtualMachinesGetOperationStatus(req) - case "ScheduledActionsClient.VirtualMachinesSubmitDeallocate": - resp, err = s.dispatchVirtualMachinesSubmitDeallocate(req) - case "ScheduledActionsClient.VirtualMachinesSubmitHibernate": - resp, err = s.dispatchVirtualMachinesSubmitHibernate(req) - case "ScheduledActionsClient.VirtualMachinesSubmitStart": - resp, err = s.dispatchVirtualMachinesSubmitStart(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *ScheduledActionsServerTransport) 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 scheduledActionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = scheduledActionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ScheduledActionsClient.VirtualMachinesCancelOperations": + res.resp, res.err = s.dispatchVirtualMachinesCancelOperations(req) + case "ScheduledActionsClient.VirtualMachinesExecuteCreate": + res.resp, res.err = s.dispatchVirtualMachinesExecuteCreate(req) + case "ScheduledActionsClient.VirtualMachinesExecuteDeallocate": + res.resp, res.err = s.dispatchVirtualMachinesExecuteDeallocate(req) + case "ScheduledActionsClient.VirtualMachinesExecuteDelete": + res.resp, res.err = s.dispatchVirtualMachinesExecuteDelete(req) + case "ScheduledActionsClient.VirtualMachinesExecuteHibernate": + res.resp, res.err = s.dispatchVirtualMachinesExecuteHibernate(req) + case "ScheduledActionsClient.VirtualMachinesExecuteStart": + res.resp, res.err = s.dispatchVirtualMachinesExecuteStart(req) + case "ScheduledActionsClient.VirtualMachinesGetOperationErrors": + res.resp, res.err = s.dispatchVirtualMachinesGetOperationErrors(req) + case "ScheduledActionsClient.VirtualMachinesGetOperationStatus": + res.resp, res.err = s.dispatchVirtualMachinesGetOperationStatus(req) + case "ScheduledActionsClient.VirtualMachinesSubmitCreate": + res.resp, res.err = s.dispatchVirtualMachinesSubmitCreate(req) + case "ScheduledActionsClient.VirtualMachinesSubmitDeallocate": + res.resp, res.err = s.dispatchVirtualMachinesSubmitDeallocate(req) + case "ScheduledActionsClient.VirtualMachinesSubmitDelete": + res.resp, res.err = s.dispatchVirtualMachinesSubmitDelete(req) + case "ScheduledActionsClient.VirtualMachinesSubmitHibernate": + res.resp, res.err = s.dispatchVirtualMachinesSubmitHibernate(req) + case "ScheduledActionsClient.VirtualMachinesSubmitStart": + res.resp, res.err = s.dispatchVirtualMachinesSubmitStart(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 (s *ScheduledActionsServerTransport) dispatchVirtualMachinesCancelOperations(req *http.Request) (*http.Response, error) { @@ -147,6 +187,39 @@ func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesCancelOperation return resp, nil } +func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesExecuteCreate(req *http.Request) (*http.Response, error) { + if s.srv.VirtualMachinesExecuteCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method VirtualMachinesExecuteCreate not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ComputeSchedule/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualMachinesExecuteCreate` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcomputeschedule.ExecuteCreateRequest](req) + if err != nil { + return nil, err + } + locationparameterParam, err := url.PathUnescape(matches[regex.SubexpIndex("locationparameter")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.VirtualMachinesExecuteCreate(req.Context(), locationparameterParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CreateResourceOperationResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} + func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesExecuteDeallocate(req *http.Request) (*http.Response, error) { if s.srv.VirtualMachinesExecuteDeallocate == nil { return nil, &nonRetriableError{errors.New("fake for method VirtualMachinesExecuteDeallocate not implemented")} @@ -180,6 +253,39 @@ func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesExecuteDealloca return resp, nil } +func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesExecuteDelete(req *http.Request) (*http.Response, error) { + if s.srv.VirtualMachinesExecuteDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method VirtualMachinesExecuteDelete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ComputeSchedule/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualMachinesExecuteDelete` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcomputeschedule.ExecuteDeleteRequest](req) + if err != nil { + return nil, err + } + locationparameterParam, err := url.PathUnescape(matches[regex.SubexpIndex("locationparameter")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.VirtualMachinesExecuteDelete(req.Context(), locationparameterParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DeleteResourceOperationResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} + func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesExecuteHibernate(req *http.Request) (*http.Response, error) { if s.srv.VirtualMachinesExecuteHibernate == nil { return nil, &nonRetriableError{errors.New("fake for method VirtualMachinesExecuteHibernate not implemented")} @@ -312,6 +418,39 @@ func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesGetOperationSta return resp, nil } +func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesSubmitCreate(req *http.Request) (*http.Response, error) { + if s.srv.VirtualMachinesSubmitCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method VirtualMachinesSubmitCreate not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ComputeSchedule/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualMachinesSubmitCreate` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcomputeschedule.SubmitCreateRequest](req) + if err != nil { + return nil, err + } + locationparameterParam, err := url.PathUnescape(matches[regex.SubexpIndex("locationparameter")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.VirtualMachinesSubmitCreate(req.Context(), locationparameterParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CreateResourceOperationResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} + func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesSubmitDeallocate(req *http.Request) (*http.Response, error) { if s.srv.VirtualMachinesSubmitDeallocate == nil { return nil, &nonRetriableError{errors.New("fake for method VirtualMachinesSubmitDeallocate not implemented")} @@ -345,6 +484,39 @@ func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesSubmitDeallocat return resp, nil } +func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesSubmitDelete(req *http.Request) (*http.Response, error) { + if s.srv.VirtualMachinesSubmitDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method VirtualMachinesSubmitDelete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ComputeSchedule/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualMachinesSubmitDelete` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcomputeschedule.SubmitDeleteRequest](req) + if err != nil { + return nil, err + } + locationparameterParam, err := url.PathUnescape(matches[regex.SubexpIndex("locationparameter")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.VirtualMachinesSubmitDelete(req.Context(), locationparameterParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DeleteResourceOperationResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} + func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesSubmitHibernate(req *http.Request) (*http.Response, error) { if s.srv.VirtualMachinesSubmitHibernate == nil { return nil, &nonRetriableError{errors.New("fake for method VirtualMachinesSubmitHibernate not implemented")} @@ -410,3 +582,9 @@ func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesSubmitStart(req } return resp, nil } + +// set this to conditionally intercept incoming requests to ScheduledActionsServerTransport +var scheduledActionsServerTransportInterceptor 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/computeschedule/armcomputeschedule/fake/server_factory.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/server_factory.go index 98595b101731..ca5023edb615 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/server_factory.go +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/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,7 +16,10 @@ import ( // ServerFactory is a fake server for instances of the armcomputeschedule.ClientFactory type. type ServerFactory struct { - OperationsServer OperationsServer + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // ScheduledActionsServer contains the fakes for client ScheduledActionsClient ScheduledActionsServer ScheduledActionsServer } diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/time_rfc3339.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/time_rfc3339.go deleted file mode 100644 index 81f308b0d343..000000000000 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/time_rfc3339.go +++ /dev/null @@ -1,110 +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 ( - utcDateTime = "2006-01-02T15:04:05.999999999" - utcDateTimeJSON = `"` + utcDateTime + `"` - utcDateTimeNoT = "2006-01-02 15:04:05.999999999" - utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` - dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` - dateTimeJSON = `"` + time.RFC3339Nano + `"` - dateTimeJSONNoT = `"` + dateTimeNoT + `"` -) - -type dateTimeRFC3339 time.Time - -func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalJSON() -} - -func (t dateTimeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalText() -} - -func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = dateTimeJSON - } else if tzOffset { - layout = dateTimeJSONNoT - } else if hasT { - layout = utcDateTimeJSON - } else { - layout = utcDateTimeJSONNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = time.RFC3339Nano - } else if tzOffset { - layout = dateTimeNoT - } else if hasT { - layout = utcDateTime - } else { - layout = utcDateTimeNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = dateTimeRFC3339(p) - return err -} - -func (t dateTimeRFC3339) String() string { - return time.Time(t).Format(time.RFC3339Nano) -} - -func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*dateTimeRFC3339)(t) -} - -func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || string(data) == "null" { - return nil - } - var aux dateTimeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/models.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/models.go index 3e78e04f6504..c5c8ca5c1180 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/models.go +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/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. @@ -25,6 +22,21 @@ type CancelOperationsResponse struct { Results []*ResourceOperation } +// CreateResourceOperationResponse - The response from a create request +type CreateResourceOperationResponse struct { + // REQUIRED; The description of the operation response + Description *string + + // REQUIRED; The location of the start request eg westus + Location *string + + // REQUIRED; The type of resources used in the create request eg virtual machines + Type *string + + // The results from the start request if no errors exist + Results []*ResourceOperation +} + // DeallocateResourceOperationResponse - The response from a deallocate request type DeallocateResourceOperationResponse struct { // REQUIRED; The description of the operation response @@ -40,6 +52,33 @@ type DeallocateResourceOperationResponse struct { Results []*ResourceOperation } +// DeleteResourceOperationResponse - The response from a delete request +type DeleteResourceOperationResponse struct { + // REQUIRED; The description of the operation response + Description *string + + // REQUIRED; The location of the start request eg westus + Location *string + + // REQUIRED; The type of resources used in the delete request eg virtual machines + Type *string + + // The results from the start request if no errors exist + Results []*ResourceOperation +} + +// ExecuteCreateRequest - The ExecuteCreateRequest request for create operations +type ExecuteCreateRequest struct { + // REQUIRED; The execution parameters for the request + ExecutionParameters *ExecutionParameters + + // REQUIRED; resource creation payload + ResourceConfigParameters *ResourceProvisionPayload + + // CorrelationId item + Correlationid *string +} + // ExecuteDeallocateRequest - The ExecuteDeallocateRequest request for executeDeallocate operations type ExecuteDeallocateRequest struct { // REQUIRED; CorrelationId item @@ -52,6 +91,21 @@ type ExecuteDeallocateRequest struct { Resources *Resources } +// ExecuteDeleteRequest - The ExecuteDeleteRequest request for delete operations +type ExecuteDeleteRequest struct { + // REQUIRED; The execution parameters for the request + ExecutionParameters *ExecutionParameters + + // REQUIRED; The resources for the request + Resources *Resources + + // CorrelationId item + Correlationid *string + + // Forced delete resource item + ForceDeletion *bool +} + // ExecuteHibernateRequest - The ExecuteHibernateRequest request for executeHibernate operations type ExecuteHibernateRequest struct { // REQUIRED; CorrelationId item @@ -284,6 +338,21 @@ type ResourceOperationError struct { ErrorDetails *string } +// ResourceProvisionPayload - Resource creation data model +type ResourceProvisionPayload struct { + // REQUIRED; Number of resources to be created + ResourceCount *int32 + + // baseProfile, Resource properties that common across all resources + BaseProfile *string + + // resourceOverrides, properties per resource that needs to be overwritted from baseProfile + ResourceOverrides []*string + + // if resourceOverrides doesn't contain "name", service will create name based of prefix and ResourceCount e.g. resourceprefix-0,resourceprefix-1.. + ResourcePrefix *string +} + // Resources - The resources needed for the user request type Resources struct { // REQUIRED; The resource ids used for the request @@ -332,6 +401,21 @@ type StartResourceOperationResponse struct { Results []*ResourceOperation } +// SubmitCreateRequest - The SubmitCreateRequest request for create operations +type SubmitCreateRequest struct { + // REQUIRED; resource creation payload + ResourceConfigParameters *ResourceProvisionPayload + + // REQUIRED; The schedule for the request + Schedule *Schedule + + // CorrelationId item + Correlationid *string + + // The execution parameters for the request + ExecutionParameters *ExecutionParameters +} + // SubmitDeallocateRequest - The deallocate request for resources type SubmitDeallocateRequest struct { // REQUIRED; CorrelationId item @@ -347,6 +431,24 @@ type SubmitDeallocateRequest struct { Schedule *Schedule } +// SubmitDeleteRequest - The SubmitDeleteRequest request for delete operations +type SubmitDeleteRequest struct { + // REQUIRED; The execution parameters for the request + ExecutionParameters *ExecutionParameters + + // REQUIRED; The resources for the request + Resources *Resources + + // REQUIRED; The schedule for the request + Schedule *Schedule + + // CorrelationId item + Correlationid *string + + // Forced delete resource item + ForceDeletion *bool +} + // SubmitHibernateRequest - This is the request for hibernate type SubmitHibernateRequest struct { // REQUIRED; CorrelationId item diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/models_serde.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/models_serde.go index 9fb0a1ac9c20..0e488cec0fef 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/models_serde.go +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/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. @@ -73,6 +70,45 @@ func (c *CancelOperationsResponse) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type CreateResourceOperationResponse. +func (c CreateResourceOperationResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", c.Description) + populate(objectMap, "location", c.Location) + populate(objectMap, "results", c.Results) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CreateResourceOperationResponse. +func (c *CreateResourceOperationResponse) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "results": + err = unpopulate(val, "Results", &c.Results) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type DeallocateResourceOperationResponse. func (d DeallocateResourceOperationResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -112,6 +148,80 @@ func (d *DeallocateResourceOperationResponse) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DeleteResourceOperationResponse. +func (d DeleteResourceOperationResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", d.Description) + populate(objectMap, "location", d.Location) + populate(objectMap, "results", d.Results) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeleteResourceOperationResponse. +func (d *DeleteResourceOperationResponse) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &d.Description) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "results": + err = unpopulate(val, "Results", &d.Results) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExecuteCreateRequest. +func (e ExecuteCreateRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "correlationid", e.Correlationid) + populate(objectMap, "executionParameters", e.ExecutionParameters) + populate(objectMap, "resourceConfigParameters", e.ResourceConfigParameters) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExecuteCreateRequest. +func (e *ExecuteCreateRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "correlationid": + err = unpopulate(val, "Correlationid", &e.Correlationid) + delete(rawMsg, key) + case "executionParameters": + err = unpopulate(val, "ExecutionParameters", &e.ExecutionParameters) + delete(rawMsg, key) + case "resourceConfigParameters": + err = unpopulate(val, "ResourceConfigParameters", &e.ResourceConfigParameters) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ExecuteDeallocateRequest. func (e ExecuteDeallocateRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -147,6 +257,45 @@ func (e *ExecuteDeallocateRequest) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ExecuteDeleteRequest. +func (e ExecuteDeleteRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "correlationid", e.Correlationid) + populate(objectMap, "executionParameters", e.ExecutionParameters) + populate(objectMap, "forceDeletion", e.ForceDeletion) + populate(objectMap, "resources", e.Resources) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExecuteDeleteRequest. +func (e *ExecuteDeleteRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "correlationid": + err = unpopulate(val, "Correlationid", &e.Correlationid) + delete(rawMsg, key) + case "executionParameters": + err = unpopulate(val, "ExecutionParameters", &e.ExecutionParameters) + delete(rawMsg, key) + case "forceDeletion": + err = unpopulate(val, "ForceDeletion", &e.ForceDeletion) + delete(rawMsg, key) + case "resources": + err = unpopulate(val, "Resources", &e.Resources) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ExecuteHibernateRequest. func (e ExecuteHibernateRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -751,6 +900,45 @@ func (r *ResourceOperationError) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ResourceProvisionPayload. +func (r ResourceProvisionPayload) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "baseProfile", r.BaseProfile) + populate(objectMap, "resourceCount", r.ResourceCount) + populate(objectMap, "resourceOverrides", r.ResourceOverrides) + populate(objectMap, "resourcePrefix", r.ResourcePrefix) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceProvisionPayload. +func (r *ResourceProvisionPayload) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "baseProfile": + err = unpopulate(val, "BaseProfile", &r.BaseProfile) + delete(rawMsg, key) + case "resourceCount": + err = unpopulate(val, "ResourceCount", &r.ResourceCount) + delete(rawMsg, key) + case "resourceOverrides": + err = unpopulate(val, "ResourceOverrides", &r.ResourceOverrides) + delete(rawMsg, key) + case "resourcePrefix": + err = unpopulate(val, "ResourcePrefix", &r.ResourcePrefix) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Resources. func (r Resources) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -891,6 +1079,45 @@ func (s *StartResourceOperationResponse) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SubmitCreateRequest. +func (s SubmitCreateRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "correlationid", s.Correlationid) + populate(objectMap, "executionParameters", s.ExecutionParameters) + populate(objectMap, "resourceConfigParameters", s.ResourceConfigParameters) + populate(objectMap, "schedule", s.Schedule) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubmitCreateRequest. +func (s *SubmitCreateRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "correlationid": + err = unpopulate(val, "Correlationid", &s.Correlationid) + delete(rawMsg, key) + case "executionParameters": + err = unpopulate(val, "ExecutionParameters", &s.ExecutionParameters) + delete(rawMsg, key) + case "resourceConfigParameters": + err = unpopulate(val, "ResourceConfigParameters", &s.ResourceConfigParameters) + delete(rawMsg, key) + case "schedule": + err = unpopulate(val, "Schedule", &s.Schedule) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type SubmitDeallocateRequest. func (s SubmitDeallocateRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -930,6 +1157,49 @@ func (s *SubmitDeallocateRequest) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SubmitDeleteRequest. +func (s SubmitDeleteRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "correlationid", s.Correlationid) + populate(objectMap, "executionParameters", s.ExecutionParameters) + populate(objectMap, "forceDeletion", s.ForceDeletion) + populate(objectMap, "resources", s.Resources) + populate(objectMap, "schedule", s.Schedule) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubmitDeleteRequest. +func (s *SubmitDeleteRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "correlationid": + err = unpopulate(val, "Correlationid", &s.Correlationid) + delete(rawMsg, key) + case "executionParameters": + err = unpopulate(val, "ExecutionParameters", &s.ExecutionParameters) + delete(rawMsg, key) + case "forceDeletion": + err = unpopulate(val, "ForceDeletion", &s.ForceDeletion) + delete(rawMsg, key) + case "resources": + err = unpopulate(val, "Resources", &s.Resources) + delete(rawMsg, key) + case "schedule": + err = unpopulate(val, "Schedule", &s.Schedule) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type SubmitHibernateRequest. func (s SubmitHibernateRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/operations_client.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/operations_client.go index 90c8dbfcfb1b..a3d9dd5e89ef 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/operations_client.go +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/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. @@ -39,7 +36,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - List the operations for the provider // -// Generated from API version 2024-10-01 +// Generated from API version 2025-05-01 // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -65,14 +62,14 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption } // listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.ComputeSchedule/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/operations_client_example_test.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/operations_client_example_test.go deleted file mode 100644 index 95ee2e4dcf2e..000000000000 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/operations_client_example_test.go +++ /dev/null @@ -1,58 +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 armcomputeschedule_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computeschedule/armcomputeschedule" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a4eca6b060cf70da696963245656fdc440b666b/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/stable/2024-10-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 := armcomputeschedule.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 = armcomputeschedule.OperationListResult{ - // Value: []*armcomputeschedule.Operation{ - // { - // Name: to.Ptr("mtiwosbky"), - // ActionType: to.Ptr(armcomputeschedule.ActionTypeInternal), - // Display: &armcomputeschedule.OperationDisplay{ - // Description: to.Ptr("moyje"), - // Operation: to.Ptr("tuneyqwanedwnnbztrmq"), - // Provider: to.Ptr("vtlhmqtfhlyllnplzpdpq"), - // Resource: to.Ptr("epj"), - // }, - // IsDataAction: to.Ptr(true), - // Origin: to.Ptr(armcomputeschedule.OriginUser), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/options.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/options.go index 74458d76ce84..a4d119ae42f7 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/options.go +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/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. @@ -19,12 +16,24 @@ type ScheduledActionsClientVirtualMachinesCancelOperationsOptions struct { // placeholder for future optional parameters } +// ScheduledActionsClientVirtualMachinesExecuteCreateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesExecuteCreate +// method. +type ScheduledActionsClientVirtualMachinesExecuteCreateOptions struct { + // placeholder for future optional parameters +} + // ScheduledActionsClientVirtualMachinesExecuteDeallocateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesExecuteDeallocate // method. type ScheduledActionsClientVirtualMachinesExecuteDeallocateOptions struct { // placeholder for future optional parameters } +// ScheduledActionsClientVirtualMachinesExecuteDeleteOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesExecuteDelete +// method. +type ScheduledActionsClientVirtualMachinesExecuteDeleteOptions struct { + // placeholder for future optional parameters +} + // ScheduledActionsClientVirtualMachinesExecuteHibernateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesExecuteHibernate // method. type ScheduledActionsClientVirtualMachinesExecuteHibernateOptions struct { @@ -49,12 +58,24 @@ type ScheduledActionsClientVirtualMachinesGetOperationStatusOptions struct { // placeholder for future optional parameters } +// ScheduledActionsClientVirtualMachinesSubmitCreateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesSubmitCreate +// method. +type ScheduledActionsClientVirtualMachinesSubmitCreateOptions struct { + // placeholder for future optional parameters +} + // ScheduledActionsClientVirtualMachinesSubmitDeallocateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesSubmitDeallocate // method. type ScheduledActionsClientVirtualMachinesSubmitDeallocateOptions struct { // placeholder for future optional parameters } +// ScheduledActionsClientVirtualMachinesSubmitDeleteOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesSubmitDelete +// method. +type ScheduledActionsClientVirtualMachinesSubmitDeleteOptions struct { + // placeholder for future optional parameters +} + // ScheduledActionsClientVirtualMachinesSubmitHibernateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesSubmitHibernate // method. type ScheduledActionsClientVirtualMachinesSubmitHibernateOptions struct { diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/responses.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/responses.go index 4f24350bc7d9..804175a9babb 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/responses.go +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/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. @@ -20,12 +17,24 @@ type ScheduledActionsClientVirtualMachinesCancelOperationsResponse struct { CancelOperationsResponse } +// ScheduledActionsClientVirtualMachinesExecuteCreateResponse contains the response from method ScheduledActionsClient.VirtualMachinesExecuteCreate. +type ScheduledActionsClientVirtualMachinesExecuteCreateResponse struct { + // The response from a create request + CreateResourceOperationResponse +} + // ScheduledActionsClientVirtualMachinesExecuteDeallocateResponse contains the response from method ScheduledActionsClient.VirtualMachinesExecuteDeallocate. type ScheduledActionsClientVirtualMachinesExecuteDeallocateResponse struct { // The response from a deallocate request DeallocateResourceOperationResponse } +// ScheduledActionsClientVirtualMachinesExecuteDeleteResponse contains the response from method ScheduledActionsClient.VirtualMachinesExecuteDelete. +type ScheduledActionsClientVirtualMachinesExecuteDeleteResponse struct { + // The response from a delete request + DeleteResourceOperationResponse +} + // ScheduledActionsClientVirtualMachinesExecuteHibernateResponse contains the response from method ScheduledActionsClient.VirtualMachinesExecuteHibernate. type ScheduledActionsClientVirtualMachinesExecuteHibernateResponse struct { // The response from a Hibernate request @@ -50,12 +59,24 @@ type ScheduledActionsClientVirtualMachinesGetOperationStatusResponse struct { GetOperationStatusResponse } +// ScheduledActionsClientVirtualMachinesSubmitCreateResponse contains the response from method ScheduledActionsClient.VirtualMachinesSubmitCreate. +type ScheduledActionsClientVirtualMachinesSubmitCreateResponse struct { + // The response from a create request + CreateResourceOperationResponse +} + // ScheduledActionsClientVirtualMachinesSubmitDeallocateResponse contains the response from method ScheduledActionsClient.VirtualMachinesSubmitDeallocate. type ScheduledActionsClientVirtualMachinesSubmitDeallocateResponse struct { // The response from a deallocate request DeallocateResourceOperationResponse } +// ScheduledActionsClientVirtualMachinesSubmitDeleteResponse contains the response from method ScheduledActionsClient.VirtualMachinesSubmitDelete. +type ScheduledActionsClientVirtualMachinesSubmitDeleteResponse struct { + // The response from a delete request + DeleteResourceOperationResponse +} + // ScheduledActionsClientVirtualMachinesSubmitHibernateResponse contains the response from method ScheduledActionsClient.VirtualMachinesSubmitHibernate. type ScheduledActionsClientVirtualMachinesSubmitHibernateResponse struct { // The response from a Hibernate request diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/scheduledactions_client.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/scheduledactions_client.go index 10d1780d4da3..b2053542f1ae 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/scheduledactions_client.go +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/scheduledactions_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. @@ -47,7 +44,7 @@ func NewScheduledActionsClient(subscriptionID string, credential azcore.TokenCre // request // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-05-01 // - locationparameter - The location name. // - requestBody - The request body // - options - ScheduledActionsClientVirtualMachinesCancelOperationsOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesCancelOperations @@ -75,7 +72,7 @@ func (client *ScheduledActionsClient) VirtualMachinesCancelOperations(ctx contex } // virtualMachinesCancelOperationsCreateRequest creates the VirtualMachinesCancelOperations request. -func (client *ScheduledActionsClient) virtualMachinesCancelOperationsCreateRequest(ctx context.Context, locationparameter string, requestBody CancelOperationsRequest, options *ScheduledActionsClientVirtualMachinesCancelOperationsOptions) (*policy.Request, error) { +func (client *ScheduledActionsClient) virtualMachinesCancelOperationsCreateRequest(ctx context.Context, locationparameter string, requestBody CancelOperationsRequest, _ *ScheduledActionsClientVirtualMachinesCancelOperationsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesCancelOperations" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -90,7 +87,7 @@ func (client *ScheduledActionsClient) virtualMachinesCancelOperationsCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, requestBody); err != nil { @@ -108,11 +105,76 @@ func (client *ScheduledActionsClient) virtualMachinesCancelOperationsHandleRespo return result, nil } +// VirtualMachinesExecuteCreate - VirtualMachinesExecuteCreate: Execute create operation for a batch of virtual machines, +// this operation is triggered as soon as Computeschedule receives it. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-05-01 +// - locationparameter - The location name. +// - requestBody - The request body +// - options - ScheduledActionsClientVirtualMachinesExecuteCreateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesExecuteCreate +// method. +func (client *ScheduledActionsClient) VirtualMachinesExecuteCreate(ctx context.Context, locationparameter string, requestBody ExecuteCreateRequest, options *ScheduledActionsClientVirtualMachinesExecuteCreateOptions) (ScheduledActionsClientVirtualMachinesExecuteCreateResponse, error) { + var err error + const operationName = "ScheduledActionsClient.VirtualMachinesExecuteCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.virtualMachinesExecuteCreateCreateRequest(ctx, locationparameter, requestBody, options) + if err != nil { + return ScheduledActionsClientVirtualMachinesExecuteCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScheduledActionsClientVirtualMachinesExecuteCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ScheduledActionsClientVirtualMachinesExecuteCreateResponse{}, err + } + resp, err := client.virtualMachinesExecuteCreateHandleResponse(httpResp) + return resp, err +} + +// virtualMachinesExecuteCreateCreateRequest creates the VirtualMachinesExecuteCreate request. +func (client *ScheduledActionsClient) virtualMachinesExecuteCreateCreateRequest(ctx context.Context, locationparameter string, requestBody ExecuteCreateRequest, _ *ScheduledActionsClientVirtualMachinesExecuteCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteCreate" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if locationparameter == "" { + return nil, errors.New("parameter locationparameter cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{locationparameter}", url.PathEscape(locationparameter)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, requestBody); err != nil { + return nil, err + } + return req, nil +} + +// virtualMachinesExecuteCreateHandleResponse handles the VirtualMachinesExecuteCreate response. +func (client *ScheduledActionsClient) virtualMachinesExecuteCreateHandleResponse(resp *http.Response) (ScheduledActionsClientVirtualMachinesExecuteCreateResponse, error) { + result := ScheduledActionsClientVirtualMachinesExecuteCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CreateResourceOperationResponse); err != nil { + return ScheduledActionsClientVirtualMachinesExecuteCreateResponse{}, err + } + return result, nil +} + // VirtualMachinesExecuteDeallocate - VirtualMachinesExecuteDeallocate: Execute deallocate operation for a batch of virtual // machines, this operation is triggered as soon as Computeschedule receives it. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-05-01 // - locationparameter - The location name. // - requestBody - The request body // - options - ScheduledActionsClientVirtualMachinesExecuteDeallocateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesExecuteDeallocate @@ -140,7 +202,7 @@ func (client *ScheduledActionsClient) VirtualMachinesExecuteDeallocate(ctx conte } // virtualMachinesExecuteDeallocateCreateRequest creates the VirtualMachinesExecuteDeallocate request. -func (client *ScheduledActionsClient) virtualMachinesExecuteDeallocateCreateRequest(ctx context.Context, locationparameter string, requestBody ExecuteDeallocateRequest, options *ScheduledActionsClientVirtualMachinesExecuteDeallocateOptions) (*policy.Request, error) { +func (client *ScheduledActionsClient) virtualMachinesExecuteDeallocateCreateRequest(ctx context.Context, locationparameter string, requestBody ExecuteDeallocateRequest, _ *ScheduledActionsClientVirtualMachinesExecuteDeallocateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteDeallocate" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -155,7 +217,7 @@ func (client *ScheduledActionsClient) virtualMachinesExecuteDeallocateCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, requestBody); err != nil { @@ -173,11 +235,76 @@ func (client *ScheduledActionsClient) virtualMachinesExecuteDeallocateHandleResp return result, nil } +// VirtualMachinesExecuteDelete - VirtualMachinesExecuteDelete: Execute delete operation for a batch of virtual machines, +// this operation is triggered as soon as Computeschedule receives it. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-05-01 +// - locationparameter - The location name. +// - requestBody - The request body +// - options - ScheduledActionsClientVirtualMachinesExecuteDeleteOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesExecuteDelete +// method. +func (client *ScheduledActionsClient) VirtualMachinesExecuteDelete(ctx context.Context, locationparameter string, requestBody ExecuteDeleteRequest, options *ScheduledActionsClientVirtualMachinesExecuteDeleteOptions) (ScheduledActionsClientVirtualMachinesExecuteDeleteResponse, error) { + var err error + const operationName = "ScheduledActionsClient.VirtualMachinesExecuteDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.virtualMachinesExecuteDeleteCreateRequest(ctx, locationparameter, requestBody, options) + if err != nil { + return ScheduledActionsClientVirtualMachinesExecuteDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScheduledActionsClientVirtualMachinesExecuteDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ScheduledActionsClientVirtualMachinesExecuteDeleteResponse{}, err + } + resp, err := client.virtualMachinesExecuteDeleteHandleResponse(httpResp) + return resp, err +} + +// virtualMachinesExecuteDeleteCreateRequest creates the VirtualMachinesExecuteDelete request. +func (client *ScheduledActionsClient) virtualMachinesExecuteDeleteCreateRequest(ctx context.Context, locationparameter string, requestBody ExecuteDeleteRequest, _ *ScheduledActionsClientVirtualMachinesExecuteDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteDelete" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if locationparameter == "" { + return nil, errors.New("parameter locationparameter cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{locationparameter}", url.PathEscape(locationparameter)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, requestBody); err != nil { + return nil, err + } + return req, nil +} + +// virtualMachinesExecuteDeleteHandleResponse handles the VirtualMachinesExecuteDelete response. +func (client *ScheduledActionsClient) virtualMachinesExecuteDeleteHandleResponse(resp *http.Response) (ScheduledActionsClientVirtualMachinesExecuteDeleteResponse, error) { + result := ScheduledActionsClientVirtualMachinesExecuteDeleteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeleteResourceOperationResponse); err != nil { + return ScheduledActionsClientVirtualMachinesExecuteDeleteResponse{}, err + } + return result, nil +} + // VirtualMachinesExecuteHibernate - VirtualMachinesExecuteHibernate: Execute hibernate operation for a batch of virtual machines, // this operation is triggered as soon as Computeschedule receives it. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-05-01 // - locationparameter - The location name. // - requestBody - The request body // - options - ScheduledActionsClientVirtualMachinesExecuteHibernateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesExecuteHibernate @@ -205,7 +332,7 @@ func (client *ScheduledActionsClient) VirtualMachinesExecuteHibernate(ctx contex } // virtualMachinesExecuteHibernateCreateRequest creates the VirtualMachinesExecuteHibernate request. -func (client *ScheduledActionsClient) virtualMachinesExecuteHibernateCreateRequest(ctx context.Context, locationparameter string, requestBody ExecuteHibernateRequest, options *ScheduledActionsClientVirtualMachinesExecuteHibernateOptions) (*policy.Request, error) { +func (client *ScheduledActionsClient) virtualMachinesExecuteHibernateCreateRequest(ctx context.Context, locationparameter string, requestBody ExecuteHibernateRequest, _ *ScheduledActionsClientVirtualMachinesExecuteHibernateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteHibernate" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -220,7 +347,7 @@ func (client *ScheduledActionsClient) virtualMachinesExecuteHibernateCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, requestBody); err != nil { @@ -242,7 +369,7 @@ func (client *ScheduledActionsClient) virtualMachinesExecuteHibernateHandleRespo // operation is triggered as soon as Computeschedule receives it. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-05-01 // - locationparameter - The location name. // - requestBody - The request body // - options - ScheduledActionsClientVirtualMachinesExecuteStartOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesExecuteStart @@ -270,7 +397,7 @@ func (client *ScheduledActionsClient) VirtualMachinesExecuteStart(ctx context.Co } // virtualMachinesExecuteStartCreateRequest creates the VirtualMachinesExecuteStart request. -func (client *ScheduledActionsClient) virtualMachinesExecuteStartCreateRequest(ctx context.Context, locationparameter string, requestBody ExecuteStartRequest, options *ScheduledActionsClientVirtualMachinesExecuteStartOptions) (*policy.Request, error) { +func (client *ScheduledActionsClient) virtualMachinesExecuteStartCreateRequest(ctx context.Context, locationparameter string, requestBody ExecuteStartRequest, _ *ScheduledActionsClientVirtualMachinesExecuteStartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteStart" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -285,7 +412,7 @@ func (client *ScheduledActionsClient) virtualMachinesExecuteStartCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, requestBody); err != nil { @@ -307,7 +434,7 @@ func (client *ScheduledActionsClient) virtualMachinesExecuteStartHandleResponse( // errors encountered, additional logs) if they exist. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-05-01 // - locationparameter - The location name. // - requestBody - The request body // - options - ScheduledActionsClientVirtualMachinesGetOperationErrorsOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesGetOperationErrors @@ -335,7 +462,7 @@ func (client *ScheduledActionsClient) VirtualMachinesGetOperationErrors(ctx cont } // virtualMachinesGetOperationErrorsCreateRequest creates the VirtualMachinesGetOperationErrors request. -func (client *ScheduledActionsClient) virtualMachinesGetOperationErrorsCreateRequest(ctx context.Context, locationparameter string, requestBody GetOperationErrorsRequest, options *ScheduledActionsClientVirtualMachinesGetOperationErrorsOptions) (*policy.Request, error) { +func (client *ScheduledActionsClient) virtualMachinesGetOperationErrorsCreateRequest(ctx context.Context, locationparameter string, requestBody GetOperationErrorsRequest, _ *ScheduledActionsClientVirtualMachinesGetOperationErrorsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesGetOperationErrors" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -350,7 +477,7 @@ func (client *ScheduledActionsClient) virtualMachinesGetOperationErrorsCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, requestBody); err != nil { @@ -372,7 +499,7 @@ func (client *ScheduledActionsClient) virtualMachinesGetOperationErrorsHandleRes // on virtual machines // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-05-01 // - locationparameter - The location name. // - requestBody - The request body // - options - ScheduledActionsClientVirtualMachinesGetOperationStatusOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesGetOperationStatus @@ -400,7 +527,7 @@ func (client *ScheduledActionsClient) VirtualMachinesGetOperationStatus(ctx cont } // virtualMachinesGetOperationStatusCreateRequest creates the VirtualMachinesGetOperationStatus request. -func (client *ScheduledActionsClient) virtualMachinesGetOperationStatusCreateRequest(ctx context.Context, locationparameter string, requestBody GetOperationStatusRequest, options *ScheduledActionsClientVirtualMachinesGetOperationStatusOptions) (*policy.Request, error) { +func (client *ScheduledActionsClient) virtualMachinesGetOperationStatusCreateRequest(ctx context.Context, locationparameter string, requestBody GetOperationStatusRequest, _ *ScheduledActionsClientVirtualMachinesGetOperationStatusOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesGetOperationStatus" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -415,7 +542,7 @@ func (client *ScheduledActionsClient) virtualMachinesGetOperationStatusCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, requestBody); err != nil { @@ -433,11 +560,76 @@ func (client *ScheduledActionsClient) virtualMachinesGetOperationStatusHandleRes return result, nil } +// VirtualMachinesSubmitCreate - VirtualMachinesSubmitCreate: submit create operation for a batch of virtual machines, at +// datetime in future. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-05-01 +// - locationparameter - The location name. +// - requestBody - The request body +// - options - ScheduledActionsClientVirtualMachinesSubmitCreateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesSubmitCreate +// method. +func (client *ScheduledActionsClient) VirtualMachinesSubmitCreate(ctx context.Context, locationparameter string, requestBody SubmitCreateRequest, options *ScheduledActionsClientVirtualMachinesSubmitCreateOptions) (ScheduledActionsClientVirtualMachinesSubmitCreateResponse, error) { + var err error + const operationName = "ScheduledActionsClient.VirtualMachinesSubmitCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.virtualMachinesSubmitCreateCreateRequest(ctx, locationparameter, requestBody, options) + if err != nil { + return ScheduledActionsClientVirtualMachinesSubmitCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScheduledActionsClientVirtualMachinesSubmitCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ScheduledActionsClientVirtualMachinesSubmitCreateResponse{}, err + } + resp, err := client.virtualMachinesSubmitCreateHandleResponse(httpResp) + return resp, err +} + +// virtualMachinesSubmitCreateCreateRequest creates the VirtualMachinesSubmitCreate request. +func (client *ScheduledActionsClient) virtualMachinesSubmitCreateCreateRequest(ctx context.Context, locationparameter string, requestBody SubmitCreateRequest, _ *ScheduledActionsClientVirtualMachinesSubmitCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesSubmitCreate" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if locationparameter == "" { + return nil, errors.New("parameter locationparameter cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{locationparameter}", url.PathEscape(locationparameter)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, requestBody); err != nil { + return nil, err + } + return req, nil +} + +// virtualMachinesSubmitCreateHandleResponse handles the VirtualMachinesSubmitCreate response. +func (client *ScheduledActionsClient) virtualMachinesSubmitCreateHandleResponse(resp *http.Response) (ScheduledActionsClientVirtualMachinesSubmitCreateResponse, error) { + result := ScheduledActionsClientVirtualMachinesSubmitCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CreateResourceOperationResponse); err != nil { + return ScheduledActionsClientVirtualMachinesSubmitCreateResponse{}, err + } + return result, nil +} + // VirtualMachinesSubmitDeallocate - VirtualMachinesSubmitDeallocate: Schedule deallocate operation for a batch of virtual // machines at datetime in future. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-05-01 // - locationparameter - The location name. // - requestBody - The request body // - options - ScheduledActionsClientVirtualMachinesSubmitDeallocateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesSubmitDeallocate @@ -465,7 +657,7 @@ func (client *ScheduledActionsClient) VirtualMachinesSubmitDeallocate(ctx contex } // virtualMachinesSubmitDeallocateCreateRequest creates the VirtualMachinesSubmitDeallocate request. -func (client *ScheduledActionsClient) virtualMachinesSubmitDeallocateCreateRequest(ctx context.Context, locationparameter string, requestBody SubmitDeallocateRequest, options *ScheduledActionsClientVirtualMachinesSubmitDeallocateOptions) (*policy.Request, error) { +func (client *ScheduledActionsClient) virtualMachinesSubmitDeallocateCreateRequest(ctx context.Context, locationparameter string, requestBody SubmitDeallocateRequest, _ *ScheduledActionsClientVirtualMachinesSubmitDeallocateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesSubmitDeallocate" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -480,7 +672,7 @@ func (client *ScheduledActionsClient) virtualMachinesSubmitDeallocateCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, requestBody); err != nil { @@ -498,11 +690,76 @@ func (client *ScheduledActionsClient) virtualMachinesSubmitDeallocateHandleRespo return result, nil } +// VirtualMachinesSubmitDelete - VirtualMachinesSubmitDelete: submit delete operation for a batch of virtual machines, at +// datetime in future. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-05-01 +// - locationparameter - The location name. +// - requestBody - The request body +// - options - ScheduledActionsClientVirtualMachinesSubmitDeleteOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesSubmitDelete +// method. +func (client *ScheduledActionsClient) VirtualMachinesSubmitDelete(ctx context.Context, locationparameter string, requestBody SubmitDeleteRequest, options *ScheduledActionsClientVirtualMachinesSubmitDeleteOptions) (ScheduledActionsClientVirtualMachinesSubmitDeleteResponse, error) { + var err error + const operationName = "ScheduledActionsClient.VirtualMachinesSubmitDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.virtualMachinesSubmitDeleteCreateRequest(ctx, locationparameter, requestBody, options) + if err != nil { + return ScheduledActionsClientVirtualMachinesSubmitDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScheduledActionsClientVirtualMachinesSubmitDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ScheduledActionsClientVirtualMachinesSubmitDeleteResponse{}, err + } + resp, err := client.virtualMachinesSubmitDeleteHandleResponse(httpResp) + return resp, err +} + +// virtualMachinesSubmitDeleteCreateRequest creates the VirtualMachinesSubmitDelete request. +func (client *ScheduledActionsClient) virtualMachinesSubmitDeleteCreateRequest(ctx context.Context, locationparameter string, requestBody SubmitDeleteRequest, _ *ScheduledActionsClientVirtualMachinesSubmitDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesSubmitDelete" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if locationparameter == "" { + return nil, errors.New("parameter locationparameter cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{locationparameter}", url.PathEscape(locationparameter)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, requestBody); err != nil { + return nil, err + } + return req, nil +} + +// virtualMachinesSubmitDeleteHandleResponse handles the VirtualMachinesSubmitDelete response. +func (client *ScheduledActionsClient) virtualMachinesSubmitDeleteHandleResponse(resp *http.Response) (ScheduledActionsClientVirtualMachinesSubmitDeleteResponse, error) { + result := ScheduledActionsClientVirtualMachinesSubmitDeleteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeleteResourceOperationResponse); err != nil { + return ScheduledActionsClientVirtualMachinesSubmitDeleteResponse{}, err + } + return result, nil +} + // VirtualMachinesSubmitHibernate - VirtualMachinesSubmitHibernate: Schedule hibernate operation for a batch of virtual machines // at datetime in future. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-05-01 // - locationparameter - The location name. // - requestBody - The request body // - options - ScheduledActionsClientVirtualMachinesSubmitHibernateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesSubmitHibernate @@ -530,7 +787,7 @@ func (client *ScheduledActionsClient) VirtualMachinesSubmitHibernate(ctx context } // virtualMachinesSubmitHibernateCreateRequest creates the VirtualMachinesSubmitHibernate request. -func (client *ScheduledActionsClient) virtualMachinesSubmitHibernateCreateRequest(ctx context.Context, locationparameter string, requestBody SubmitHibernateRequest, options *ScheduledActionsClientVirtualMachinesSubmitHibernateOptions) (*policy.Request, error) { +func (client *ScheduledActionsClient) virtualMachinesSubmitHibernateCreateRequest(ctx context.Context, locationparameter string, requestBody SubmitHibernateRequest, _ *ScheduledActionsClientVirtualMachinesSubmitHibernateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesSubmitHibernate" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -545,7 +802,7 @@ func (client *ScheduledActionsClient) virtualMachinesSubmitHibernateCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, requestBody); err != nil { @@ -567,7 +824,7 @@ func (client *ScheduledActionsClient) virtualMachinesSubmitHibernateHandleRespon // in future. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-05-01 // - locationparameter - The location name. // - requestBody - The request body // - options - ScheduledActionsClientVirtualMachinesSubmitStartOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesSubmitStart @@ -595,7 +852,7 @@ func (client *ScheduledActionsClient) VirtualMachinesSubmitStart(ctx context.Con } // virtualMachinesSubmitStartCreateRequest creates the VirtualMachinesSubmitStart request. -func (client *ScheduledActionsClient) virtualMachinesSubmitStartCreateRequest(ctx context.Context, locationparameter string, requestBody SubmitStartRequest, options *ScheduledActionsClientVirtualMachinesSubmitStartOptions) (*policy.Request, error) { +func (client *ScheduledActionsClient) virtualMachinesSubmitStartCreateRequest(ctx context.Context, locationparameter string, requestBody SubmitStartRequest, _ *ScheduledActionsClientVirtualMachinesSubmitStartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesSubmitStart" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -610,7 +867,7 @@ func (client *ScheduledActionsClient) virtualMachinesSubmitStartCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, requestBody); err != nil { diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/scheduledactions_client_example_test.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/scheduledactions_client_example_test.go deleted file mode 100644 index b9fd4877476e..000000000000 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/scheduledactions_client_example_test.go +++ /dev/null @@ -1,561 +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 armcomputeschedule_test - -import ( - "context" - "log" - - "time" - - "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/computeschedule/armcomputeschedule" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a4eca6b060cf70da696963245656fdc440b666b/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/stable/2024-10-01/examples/ScheduledActions_VirtualMachinesCancelOperations.json -func ExampleScheduledActionsClient_VirtualMachinesCancelOperations() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcomputeschedule.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesCancelOperations(ctx, "eastus2euap", armcomputeschedule.CancelOperationsRequest{ - Correlationid: to.Ptr("23480d2f-1dca-4610-afb4-gg25eec1f34r"), - OperationIDs: []*string{ - to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r")}, - }, 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.CancelOperationsResponse = armcomputeschedule.CancelOperationsResponse{ - // Results: []*armcomputeschedule.ResourceOperation{ - // { - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), - // Operation: &armcomputeschedule.ResourceOperationDetails{ - // OperationID: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), - // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.668Z"); return t}()), - // Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.667Z"); return t}()), - // DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeInitiateAt), - // OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeDeallocate), - // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // ResourceOperationError: &armcomputeschedule.ResourceOperationError{ - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), - // }, - // RetryPolicy: &armcomputeschedule.RetryPolicy{ - // RetryCount: to.Ptr[int32](4), - // RetryWindowInMinutes: to.Ptr[int32](27), - // }, - // State: to.Ptr(armcomputeschedule.OperationStateCancelled), - // SubscriptionID: to.Ptr("D8E30CC0-2763-4FCC-84A8-3C5659281032"), - // TimeZone: to.Ptr("UTC"), - // Timezone: to.Ptr("UTC"), - // }, - // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a4eca6b060cf70da696963245656fdc440b666b/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/stable/2024-10-01/examples/ScheduledActions_VirtualMachinesExecuteDeallocate.json -func ExampleScheduledActionsClient_VirtualMachinesExecuteDeallocate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcomputeschedule.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesExecuteDeallocate(ctx, "eastus2euap", armcomputeschedule.ExecuteDeallocateRequest{ - Correlationid: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), - ExecutionParameters: &armcomputeschedule.ExecutionParameters{ - RetryPolicy: &armcomputeschedule.RetryPolicy{ - RetryCount: to.Ptr[int32](4), - RetryWindowInMinutes: to.Ptr[int32](27), - }, - }, - Resources: &armcomputeschedule.Resources{ - IDs: []*string{ - to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3")}, - }, - }, 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.DeallocateResourceOperationResponse = armcomputeschedule.DeallocateResourceOperationResponse{ - // Type: to.Ptr("VirtualMachine"), - // Description: to.Ptr("Deallocate Resource Request"), - // Location: to.Ptr("eastus2euap"), - // Results: []*armcomputeschedule.ResourceOperation{ - // { - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), - // Operation: &armcomputeschedule.ResourceOperationDetails{ - // OperationID: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), - // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.668Z"); return t}()), - // Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.667Z"); return t}()), - // DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeInitiateAt), - // OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeDeallocate), - // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // ResourceOperationError: &armcomputeschedule.ResourceOperationError{ - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), - // }, - // RetryPolicy: &armcomputeschedule.RetryPolicy{ - // RetryCount: to.Ptr[int32](4), - // RetryWindowInMinutes: to.Ptr[int32](27), - // }, - // State: to.Ptr(armcomputeschedule.OperationStateSucceeded), - // SubscriptionID: to.Ptr("D8E30CC0-2763-4FCC-84A8-3C5659281032"), - // TimeZone: to.Ptr("UTC"), - // Timezone: to.Ptr("UTC"), - // }, - // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a4eca6b060cf70da696963245656fdc440b666b/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/stable/2024-10-01/examples/ScheduledActions_VirtualMachinesExecuteHibernate.json -func ExampleScheduledActionsClient_VirtualMachinesExecuteHibernate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcomputeschedule.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesExecuteHibernate(ctx, "eastus2euap", armcomputeschedule.ExecuteHibernateRequest{ - Correlationid: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), - ExecutionParameters: &armcomputeschedule.ExecutionParameters{ - RetryPolicy: &armcomputeschedule.RetryPolicy{ - RetryCount: to.Ptr[int32](5), - RetryWindowInMinutes: to.Ptr[int32](27), - }, - }, - Resources: &armcomputeschedule.Resources{ - IDs: []*string{ - to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3")}, - }, - }, 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.HibernateResourceOperationResponse = armcomputeschedule.HibernateResourceOperationResponse{ - // Type: to.Ptr("VirtualMachine"), - // Description: to.Ptr("Hibernate Resource Request"), - // Location: to.Ptr("eastus2euap"), - // Results: []*armcomputeschedule.ResourceOperation{ - // { - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), - // Operation: &armcomputeschedule.ResourceOperationDetails{ - // OperationID: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), - // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.668Z"); return t}()), - // Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.667Z"); return t}()), - // DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeInitiateAt), - // OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeHibernate), - // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // ResourceOperationError: &armcomputeschedule.ResourceOperationError{ - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), - // }, - // RetryPolicy: &armcomputeschedule.RetryPolicy{ - // RetryCount: to.Ptr[int32](5), - // RetryWindowInMinutes: to.Ptr[int32](27), - // }, - // State: to.Ptr(armcomputeschedule.OperationStateSucceeded), - // SubscriptionID: to.Ptr("D8E30CC0-2763-4FCC-84A8-3C5659281032"), - // TimeZone: to.Ptr("UTC"), - // Timezone: to.Ptr("UTC"), - // }, - // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a4eca6b060cf70da696963245656fdc440b666b/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/stable/2024-10-01/examples/ScheduledActions_VirtualMachinesExecuteStart.json -func ExampleScheduledActionsClient_VirtualMachinesExecuteStart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcomputeschedule.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesExecuteStart(ctx, "eastus2euap", armcomputeschedule.ExecuteStartRequest{ - Correlationid: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), - ExecutionParameters: &armcomputeschedule.ExecutionParameters{ - RetryPolicy: &armcomputeschedule.RetryPolicy{ - RetryCount: to.Ptr[int32](2), - RetryWindowInMinutes: to.Ptr[int32](27), - }, - }, - Resources: &armcomputeschedule.Resources{ - IDs: []*string{ - to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3")}, - }, - }, 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.StartResourceOperationResponse = armcomputeschedule.StartResourceOperationResponse{ - // Type: to.Ptr("virtualMachine"), - // Description: to.Ptr("Start Resource Request"), - // Location: to.Ptr("eastus2euap"), - // Results: []*armcomputeschedule.ResourceOperation{ - // { - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), - // Operation: &armcomputeschedule.ResourceOperationDetails{ - // OperationID: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), - // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.668Z"); return t}()), - // Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.667Z"); return t}()), - // DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeInitiateAt), - // OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeStart), - // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // ResourceOperationError: &armcomputeschedule.ResourceOperationError{ - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), - // }, - // RetryPolicy: &armcomputeschedule.RetryPolicy{ - // RetryCount: to.Ptr[int32](2), - // RetryWindowInMinutes: to.Ptr[int32](27), - // }, - // State: to.Ptr(armcomputeschedule.OperationStateSucceeded), - // SubscriptionID: to.Ptr("D8E30CC0-2763-4FCC-84A8-3C5659281032"), - // TimeZone: to.Ptr("UTC"), - // Timezone: to.Ptr("UTC"), - // }, - // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a4eca6b060cf70da696963245656fdc440b666b/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/stable/2024-10-01/examples/ScheduledActions_VirtualMachinesGetOperationErrors.json -func ExampleScheduledActionsClient_VirtualMachinesGetOperationErrors() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcomputeschedule.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesGetOperationErrors(ctx, "eastus2euap", armcomputeschedule.GetOperationErrorsRequest{ - OperationIDs: []*string{ - to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r")}, - }, 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.GetOperationErrorsResponse = armcomputeschedule.GetOperationErrorsResponse{ - // Results: []*armcomputeschedule.OperationErrorsResult{ - // { - // OperationID: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), - // ActivationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.999Z"); return t}()), - // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.999Z"); return t}()), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.999Z"); return t}()), - // OperationErrors: []*armcomputeschedule.OperationErrorDetails{ - // { - // AzureOperationName: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), - // CrpOperationID: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-27T16:55:03.357Z"); return t}()), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.999Z"); return t}()), - // }}, - // RequestErrorCode: to.Ptr("null"), - // RequestErrorDetails: to.Ptr("null"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a4eca6b060cf70da696963245656fdc440b666b/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/stable/2024-10-01/examples/ScheduledActions_VirtualMachinesGetOperationStatus.json -func ExampleScheduledActionsClient_VirtualMachinesGetOperationStatus() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcomputeschedule.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesGetOperationStatus(ctx, "eastus2euap", armcomputeschedule.GetOperationStatusRequest{ - Correlationid: to.Ptr("35780d2f-1dca-4610-afb4-dd25eec1f34r"), - OperationIDs: []*string{ - to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r")}, - }, 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.GetOperationStatusResponse = armcomputeschedule.GetOperationStatusResponse{ - // Results: []*armcomputeschedule.ResourceOperation{ - // { - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), - // Operation: &armcomputeschedule.ResourceOperationDetails{ - // OperationID: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), - // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.668Z"); return t}()), - // Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.667Z"); return t}()), - // DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeInitiateAt), - // OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeDeallocate), - // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // ResourceOperationError: &armcomputeschedule.ResourceOperationError{ - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), - // }, - // RetryPolicy: &armcomputeschedule.RetryPolicy{ - // RetryCount: to.Ptr[int32](4), - // RetryWindowInMinutes: to.Ptr[int32](27), - // }, - // State: to.Ptr(armcomputeschedule.OperationStateSucceeded), - // SubscriptionID: to.Ptr("D8E30CC0-2763-4FCC-84A8-3C5659281032"), - // TimeZone: to.Ptr("UTC"), - // Timezone: to.Ptr("UTC"), - // }, - // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a4eca6b060cf70da696963245656fdc440b666b/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/stable/2024-10-01/examples/ScheduledActions_VirtualMachinesSubmitDeallocate.json -func ExampleScheduledActionsClient_VirtualMachinesSubmitDeallocate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcomputeschedule.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesSubmitDeallocate(ctx, "eastus2euap", armcomputeschedule.SubmitDeallocateRequest{ - Correlationid: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), - ExecutionParameters: &armcomputeschedule.ExecutionParameters{ - RetryPolicy: &armcomputeschedule.RetryPolicy{ - RetryCount: to.Ptr[int32](4), - RetryWindowInMinutes: to.Ptr[int32](27), - }, - }, - Resources: &armcomputeschedule.Resources{ - IDs: []*string{ - to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3")}, - }, - Schedule: &armcomputeschedule.Schedule{ - Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:54.215Z"); return t }()), - DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeInitiateAt), - Timezone: to.Ptr("UTC"), - }, - }, 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.DeallocateResourceOperationResponse = armcomputeschedule.DeallocateResourceOperationResponse{ - // Type: to.Ptr("virtualMachine"), - // Description: to.Ptr("Deallocate Resource Request"), - // Location: to.Ptr("eastus2euap"), - // Results: []*armcomputeschedule.ResourceOperation{ - // { - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), - // Operation: &armcomputeschedule.ResourceOperationDetails{ - // OperationID: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), - // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.668Z"); return t}()), - // Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.667Z"); return t}()), - // DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeInitiateAt), - // OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeDeallocate), - // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // ResourceOperationError: &armcomputeschedule.ResourceOperationError{ - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), - // }, - // RetryPolicy: &armcomputeschedule.RetryPolicy{ - // RetryCount: to.Ptr[int32](4), - // RetryWindowInMinutes: to.Ptr[int32](27), - // }, - // State: to.Ptr(armcomputeschedule.OperationStateSucceeded), - // SubscriptionID: to.Ptr("D8E30CC0-2763-4FCC-84A8-3C5659281032"), - // TimeZone: to.Ptr("UTC"), - // Timezone: to.Ptr("UTC"), - // }, - // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a4eca6b060cf70da696963245656fdc440b666b/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/stable/2024-10-01/examples/ScheduledActions_VirtualMachinesSubmitHibernate.json -func ExampleScheduledActionsClient_VirtualMachinesSubmitHibernate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcomputeschedule.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesSubmitHibernate(ctx, "eastus2euap", armcomputeschedule.SubmitHibernateRequest{ - Correlationid: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), - ExecutionParameters: &armcomputeschedule.ExecutionParameters{ - RetryPolicy: &armcomputeschedule.RetryPolicy{ - RetryCount: to.Ptr[int32](2), - RetryWindowInMinutes: to.Ptr[int32](27), - }, - }, - Resources: &armcomputeschedule.Resources{ - IDs: []*string{ - to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3")}, - }, - Schedule: &armcomputeschedule.Schedule{ - Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:54.215Z"); return t }()), - DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeInitiateAt), - Timezone: to.Ptr("UTC"), - }, - }, 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.HibernateResourceOperationResponse = armcomputeschedule.HibernateResourceOperationResponse{ - // Type: to.Ptr("virtualMachine"), - // Description: to.Ptr("Hibernate Resource Request"), - // Location: to.Ptr("eastus2euap"), - // Results: []*armcomputeschedule.ResourceOperation{ - // { - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), - // Operation: &armcomputeschedule.ResourceOperationDetails{ - // OperationID: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), - // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.668Z"); return t}()), - // Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.667Z"); return t}()), - // DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeInitiateAt), - // OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeHibernate), - // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // ResourceOperationError: &armcomputeschedule.ResourceOperationError{ - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), - // }, - // RetryPolicy: &armcomputeschedule.RetryPolicy{ - // RetryCount: to.Ptr[int32](2), - // RetryWindowInMinutes: to.Ptr[int32](27), - // }, - // State: to.Ptr(armcomputeschedule.OperationStateSucceeded), - // SubscriptionID: to.Ptr("D8E30CC0-2763-4FCC-84A8-3C5659281032"), - // TimeZone: to.Ptr("UTC"), - // Timezone: to.Ptr("UTC"), - // }, - // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a4eca6b060cf70da696963245656fdc440b666b/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/stable/2024-10-01/examples/ScheduledActions_VirtualMachinesSubmitStart.json -func ExampleScheduledActionsClient_VirtualMachinesSubmitStart() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armcomputeschedule.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesSubmitStart(ctx, "eastus2euap", armcomputeschedule.SubmitStartRequest{ - Correlationid: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), - ExecutionParameters: &armcomputeschedule.ExecutionParameters{ - RetryPolicy: &armcomputeschedule.RetryPolicy{ - RetryCount: to.Ptr[int32](5), - RetryWindowInMinutes: to.Ptr[int32](27), - }, - }, - Resources: &armcomputeschedule.Resources{ - IDs: []*string{ - to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3")}, - }, - Schedule: &armcomputeschedule.Schedule{ - Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:54.215Z"); return t }()), - DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeInitiateAt), - Timezone: to.Ptr("UTC"), - }, - }, 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.StartResourceOperationResponse = armcomputeschedule.StartResourceOperationResponse{ - // Type: to.Ptr("virtualMachine"), - // Description: to.Ptr("Start Resource Request"), - // Location: to.Ptr("eastus2euap"), - // Results: []*armcomputeschedule.ResourceOperation{ - // { - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), - // Operation: &armcomputeschedule.ResourceOperationDetails{ - // OperationID: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), - // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.668Z"); return t}()), - // Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.667Z"); return t}()), - // DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeInitiateAt), - // OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeStart), - // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // ResourceOperationError: &armcomputeschedule.ResourceOperationError{ - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), - // }, - // RetryPolicy: &armcomputeschedule.RetryPolicy{ - // RetryCount: to.Ptr[int32](5), - // RetryWindowInMinutes: to.Ptr[int32](27), - // }, - // State: to.Ptr(armcomputeschedule.OperationStateSucceeded), - // SubscriptionID: to.Ptr("D8E30CC0-2763-4FCC-84A8-3C5659281032"), - // TimeZone: to.Ptr("UTC"), - // Timezone: to.Ptr("UTC"), - // }, - // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // }}, - // } -} diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/time_rfc3339.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/time_rfc3339.go index c69bdcbe0925..b49323f00c50 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/time_rfc3339.go +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/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. @@ -60,6 +57,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/CHANGELOG.md b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/CHANGELOG.md new file mode 100644 index 000000000000..4830689416a7 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2025-04-27) +### Other Changes + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/LICENSE.txt b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/README.md b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/README.md new file mode 100644 index 000000000000..5284a75848db --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/README.md @@ -0,0 +1,90 @@ +# Azure Databasefleetmanager Module for Go + +The `armdatabasefleetmanager` module provides operations for working with Azure Databasefleetmanager. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).) + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Databasefleetmanager module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Databasefleetmanager. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Client Factory + +Azure Databasefleetmanager module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armdatabasefleetmanager.NewClientFactory(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +clientFactory, err := armdatabasefleetmanager.NewClientFactory(, cred, &options) +``` + +## Clients + +A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. + +```go +client := clientFactory.NewFirewallRulesClient() +``` + +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Databasefleetmanager` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/autorest.md b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/autorest.md new file mode 100644 index 000000000000..5271b8eef4fd --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/autorest.md @@ -0,0 +1,13 @@ +### AutoRest Configuration + +> see https://aka.ms/autorest + +``` yaml +azure-arm: true +require: +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/databasefleetmanager/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/databasefleetmanager/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 0.1.0 + +``` \ No newline at end of file diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/build.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/build.go new file mode 100644 index 000000000000..480ba43f1e86 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/build.go @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file enables 'go generate' to regenerate this specific SDK +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -alwaysSetBodyParamRequired -removeUnreferencedTypes resourcemanager/databasefleetmanager/armdatabasefleetmanager + +package armdatabasefleetmanager diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/ci.yml b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/ci.yml new file mode 100644 index 000000000000..cfeeed61f070 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/ci.yml @@ -0,0 +1,27 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + ServiceDirectory: 'resourcemanager/databasefleetmanager/armdatabasefleetmanager' diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/client_factory.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/client_factory.go new file mode 100644 index 000000000000..76fb86f0eba2 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/client_factory.go @@ -0,0 +1,81 @@ +// 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 armdatabasefleetmanager + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + 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. 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) { + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, + internal: internal, + }, nil +} + +// NewFirewallRulesClient creates a new instance of FirewallRulesClient. +func (c *ClientFactory) NewFirewallRulesClient() *FirewallRulesClient { + return &FirewallRulesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewFleetDatabasesClient creates a new instance of FleetDatabasesClient. +func (c *ClientFactory) NewFleetDatabasesClient() *FleetDatabasesClient { + return &FleetDatabasesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewFleetTiersClient creates a new instance of FleetTiersClient. +func (c *ClientFactory) NewFleetTiersClient() *FleetTiersClient { + return &FleetTiersClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewFleetsClient creates a new instance of FleetsClient. +func (c *ClientFactory) NewFleetsClient() *FleetsClient { + return &FleetsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewFleetspacesClient creates a new instance of FleetspacesClient. +func (c *ClientFactory) NewFleetspacesClient() *FleetspacesClient { + return &FleetspacesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + return &OperationsClient{ + internal: c.internal, + } +} diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/constants.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/constants.go new file mode 100644 index 000000000000..9ff82567ba81 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/constants.go @@ -0,0 +1,187 @@ +// 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 armdatabasefleetmanager + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager" + moduleVersion = "v0.1.0" +) + +// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string + +const ( + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + +// AzureProvisioningState - The provisioning state of the resource. +type AzureProvisioningState string + +const ( + // AzureProvisioningStateAccepted - Request on the resource has been accepted. + AzureProvisioningStateAccepted AzureProvisioningState = "Accepted" + // AzureProvisioningStateCanceled - Resource creation was canceled. + AzureProvisioningStateCanceled AzureProvisioningState = "Canceled" + // AzureProvisioningStateFailed - Resource creation failed. + AzureProvisioningStateFailed AzureProvisioningState = "Failed" + // AzureProvisioningStateProvisioning - Resource is provisioning. + AzureProvisioningStateProvisioning AzureProvisioningState = "Provisioning" + // AzureProvisioningStateSucceeded - Resource has been created. + AzureProvisioningStateSucceeded AzureProvisioningState = "Succeeded" +) + +// PossibleAzureProvisioningStateValues returns the possible values for the AzureProvisioningState const type. +func PossibleAzureProvisioningStateValues() []AzureProvisioningState { + return []AzureProvisioningState{ + AzureProvisioningStateAccepted, + AzureProvisioningStateCanceled, + AzureProvisioningStateFailed, + AzureProvisioningStateProvisioning, + AzureProvisioningStateSucceeded, + } +} + +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// DatabaseCreateMode - Create mode. Available options: Default - Create a database. Copy - Copy the source database (source +// database name must be specified) PointInTimeRestore - Create a database by restoring source +// database from a point in time (source database name and restore from time must be specified) +type DatabaseCreateMode string + +const ( + // DatabaseCreateModeCopy - Copy the source database (source database name must be specified). + DatabaseCreateModeCopy DatabaseCreateMode = "Copy" + // DatabaseCreateModeDefault - Create a database. + DatabaseCreateModeDefault DatabaseCreateMode = "Default" + // DatabaseCreateModePointInTimeRestore - Create a database by restoring source database from a point in time (source database + // name and restore from time must be specified). + DatabaseCreateModePointInTimeRestore DatabaseCreateMode = "PointInTimeRestore" +) + +// PossibleDatabaseCreateModeValues returns the possible values for the DatabaseCreateMode const type. +func PossibleDatabaseCreateModeValues() []DatabaseCreateMode { + return []DatabaseCreateMode{ + DatabaseCreateModeCopy, + DatabaseCreateModeDefault, + DatabaseCreateModePointInTimeRestore, + } +} + +// IdentityType - Identity type of the main principal. +type IdentityType string + +const ( + // IdentityTypeNone - No identity. + IdentityTypeNone IdentityType = "None" + // IdentityTypeUserAssigned - User assigned identity. + IdentityTypeUserAssigned IdentityType = "UserAssigned" +) + +// PossibleIdentityTypeValues returns the possible values for the IdentityType const type. +func PossibleIdentityTypeValues() []IdentityType { + return []IdentityType{ + IdentityTypeNone, + IdentityTypeUserAssigned, + } +} + +// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default +// value is "user,system" +type Origin string + +const ( + OriginSystem Origin = "system" + OriginUser Origin = "user" + OriginUserSystem Origin = "user,system" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} + +// PrincipalType - Principal type of the authorized principal. +type PrincipalType string + +const ( + // PrincipalTypeApplication - Application principal type. + PrincipalTypeApplication PrincipalType = "Application" + // PrincipalTypeUser - User principal type. + PrincipalTypeUser PrincipalType = "User" +) + +// PossiblePrincipalTypeValues returns the possible values for the PrincipalType const type. +func PossiblePrincipalTypeValues() []PrincipalType { + return []PrincipalType{ + PrincipalTypeApplication, + PrincipalTypeUser, + } +} + +// ResourceType - Resource type of the destination tier override. +type ResourceType string + +const ( + // ResourceTypeDatabase - Database resource type. + ResourceTypeDatabase ResourceType = "Database" + // ResourceTypePool - Elastic pool resource type. + ResourceTypePool ResourceType = "Pool" +) + +// PossibleResourceTypeValues returns the possible values for the ResourceType const type. +func PossibleResourceTypeValues() []ResourceType { + return []ResourceType{ + ResourceTypeDatabase, + ResourceTypePool, + } +} + +// ZoneRedundancy - Status of zone redundancy in a tier. +type ZoneRedundancy string + +const ( + // ZoneRedundancyDisabled - Zone redundancy disabled. + ZoneRedundancyDisabled ZoneRedundancy = "Disabled" + // ZoneRedundancyEnabled - Zone redundancy enabled. + ZoneRedundancyEnabled ZoneRedundancy = "Enabled" +) + +// PossibleZoneRedundancyValues returns the possible values for the ZoneRedundancy const type. +func PossibleZoneRedundancyValues() []ZoneRedundancy { + return []ZoneRedundancy{ + ZoneRedundancyDisabled, + ZoneRedundancyEnabled, + } +} diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/firewallrules_server.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/firewallrules_server.go new file mode 100644 index 000000000000..fcb763a94584 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/firewallrules_server.go @@ -0,0 +1,353 @@ +// 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 ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// FirewallRulesServer is a fake server for instances of the armdatabasefleetmanager.FirewallRulesClient type. +type FirewallRulesServer struct { + // BeginCreateOrUpdate is the fake for method FirewallRulesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, firewallRuleName string, resource armdatabasefleetmanager.FirewallRule, options *armdatabasefleetmanager.FirewallRulesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FirewallRulesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method FirewallRulesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, firewallRuleName string, options *armdatabasefleetmanager.FirewallRulesClientBeginDeleteOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FirewallRulesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method FirewallRulesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, firewallRuleName string, options *armdatabasefleetmanager.FirewallRulesClientGetOptions) (resp azfake.Responder[armdatabasefleetmanager.FirewallRulesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByFleetspacePager is the fake for method FirewallRulesClient.NewListByFleetspacePager + // HTTP status codes to indicate success: http.StatusOK + NewListByFleetspacePager func(resourceGroupName string, fleetName string, fleetspaceName string, options *armdatabasefleetmanager.FirewallRulesClientListByFleetspaceOptions) (resp azfake.PagerResponder[armdatabasefleetmanager.FirewallRulesClientListByFleetspaceResponse]) +} + +// NewFirewallRulesServerTransport creates a new instance of FirewallRulesServerTransport with the provided implementation. +// The returned FirewallRulesServerTransport instance is connected to an instance of armdatabasefleetmanager.FirewallRulesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewFirewallRulesServerTransport(srv *FirewallRulesServer) *FirewallRulesServerTransport { + return &FirewallRulesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FirewallRulesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FirewallRulesClientDeleteResponse]](), + newListByFleetspacePager: newTracker[azfake.PagerResponder[armdatabasefleetmanager.FirewallRulesClientListByFleetspaceResponse]](), + } +} + +// FirewallRulesServerTransport connects instances of armdatabasefleetmanager.FirewallRulesClient to instances of FirewallRulesServer. +// Don't use this type directly, use NewFirewallRulesServerTransport instead. +type FirewallRulesServerTransport struct { + srv *FirewallRulesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armdatabasefleetmanager.FirewallRulesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armdatabasefleetmanager.FirewallRulesClientDeleteResponse]] + newListByFleetspacePager *tracker[azfake.PagerResponder[armdatabasefleetmanager.FirewallRulesClientListByFleetspaceResponse]] +} + +// Do implements the policy.Transporter interface for FirewallRulesServerTransport. +func (f *FirewallRulesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return f.dispatchToMethodFake(req, method) +} + +func (f *FirewallRulesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if firewallRulesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = firewallRulesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "FirewallRulesClient.BeginCreateOrUpdate": + res.resp, res.err = f.dispatchBeginCreateOrUpdate(req) + case "FirewallRulesClient.BeginDelete": + res.resp, res.err = f.dispatchBeginDelete(req) + case "FirewallRulesClient.Get": + res.resp, res.err = f.dispatchGet(req) + case "FirewallRulesClient.NewListByFleetspacePager": + res.resp, res.err = f.dispatchNewListByFleetspacePager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (f *FirewallRulesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if f.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := f.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/firewallRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdatabasefleetmanager.FirewallRule](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + firewallRuleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("firewallRuleName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, firewallRuleNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + f.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + f.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + f.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (f *FirewallRulesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if f.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := f.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/firewallRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + firewallRuleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("firewallRuleName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginDelete(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, firewallRuleNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + f.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + f.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + f.beginDelete.remove(req) + } + + return resp, nil +} + +func (f *FirewallRulesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if f.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/firewallRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + firewallRuleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("firewallRuleName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.Get(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, firewallRuleNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).FirewallRule, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (f *FirewallRulesServerTransport) dispatchNewListByFleetspacePager(req *http.Request) (*http.Response, error) { + if f.srv.NewListByFleetspacePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByFleetspacePager not implemented")} + } + newListByFleetspacePager := f.newListByFleetspacePager.get(req) + if newListByFleetspacePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/firewallRules` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + skipUnescaped, err := url.QueryUnescape(qp.Get("$skip")) + if err != nil { + return nil, err + } + skipParam, err := parseOptional(skipUnescaped, func(v string) (int64, error) { + p, parseErr := strconv.ParseInt(v, 10, 64) + if parseErr != nil { + return 0, parseErr + } + return p, nil + }) + if err != nil { + return nil, err + } + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int64, error) { + p, parseErr := strconv.ParseInt(v, 10, 64) + if parseErr != nil { + return 0, parseErr + } + return p, nil + }) + if err != nil { + return nil, err + } + skiptokenUnescaped, err := url.QueryUnescape(qp.Get("$skiptoken")) + if err != nil { + return nil, err + } + skiptokenParam := getOptional(skiptokenUnescaped) + var options *armdatabasefleetmanager.FirewallRulesClientListByFleetspaceOptions + if skipParam != nil || topParam != nil || skiptokenParam != nil { + options = &armdatabasefleetmanager.FirewallRulesClientListByFleetspaceOptions{ + Skip: skipParam, + Top: topParam, + Skiptoken: skiptokenParam, + } + } + resp := f.srv.NewListByFleetspacePager(resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, options) + newListByFleetspacePager = &resp + f.newListByFleetspacePager.add(req, newListByFleetspacePager) + server.PagerResponderInjectNextLinks(newListByFleetspacePager, req, func(page *armdatabasefleetmanager.FirewallRulesClientListByFleetspaceResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByFleetspacePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + f.newListByFleetspacePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByFleetspacePager) { + f.newListByFleetspacePager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to FirewallRulesServerTransport +var firewallRulesServerTransportInterceptor 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/databasefleetmanager/armdatabasefleetmanager/fake/fleetdatabases_server.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/fleetdatabases_server.go new file mode 100644 index 000000000000..947ade61a36e --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/fleetdatabases_server.go @@ -0,0 +1,611 @@ +// 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 ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// FleetDatabasesServer is a fake server for instances of the armdatabasefleetmanager.FleetDatabasesClient type. +type FleetDatabasesServer struct { + // BeginChangeTier is the fake for method FleetDatabasesClient.BeginChangeTier + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginChangeTier func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, body armdatabasefleetmanager.DatabaseChangeTierProperties, options *armdatabasefleetmanager.FleetDatabasesClientBeginChangeTierOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientChangeTierResponse], errResp azfake.ErrorResponder) + + // BeginCreateOrUpdate is the fake for method FleetDatabasesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, resource armdatabasefleetmanager.FleetDatabase, options *armdatabasefleetmanager.FleetDatabasesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method FleetDatabasesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, options *armdatabasefleetmanager.FleetDatabasesClientBeginDeleteOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method FleetDatabasesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, options *armdatabasefleetmanager.FleetDatabasesClientGetOptions) (resp azfake.Responder[armdatabasefleetmanager.FleetDatabasesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByFleetspacePager is the fake for method FleetDatabasesClient.NewListByFleetspacePager + // HTTP status codes to indicate success: http.StatusOK + NewListByFleetspacePager func(resourceGroupName string, fleetName string, fleetspaceName string, options *armdatabasefleetmanager.FleetDatabasesClientListByFleetspaceOptions) (resp azfake.PagerResponder[armdatabasefleetmanager.FleetDatabasesClientListByFleetspaceResponse]) + + // BeginRename is the fake for method FleetDatabasesClient.BeginRename + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginRename func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, body armdatabasefleetmanager.DatabaseRenameProperties, options *armdatabasefleetmanager.FleetDatabasesClientBeginRenameOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientRenameResponse], errResp azfake.ErrorResponder) + + // BeginRevert is the fake for method FleetDatabasesClient.BeginRevert + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginRevert func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, options *armdatabasefleetmanager.FleetDatabasesClientBeginRevertOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientRevertResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method FleetDatabasesClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, properties armdatabasefleetmanager.FleetDatabase, options *armdatabasefleetmanager.FleetDatabasesClientBeginUpdateOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewFleetDatabasesServerTransport creates a new instance of FleetDatabasesServerTransport with the provided implementation. +// The returned FleetDatabasesServerTransport instance is connected to an instance of armdatabasefleetmanager.FleetDatabasesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewFleetDatabasesServerTransport(srv *FleetDatabasesServer) *FleetDatabasesServerTransport { + return &FleetDatabasesServerTransport{ + srv: srv, + beginChangeTier: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientChangeTierResponse]](), + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientDeleteResponse]](), + newListByFleetspacePager: newTracker[azfake.PagerResponder[armdatabasefleetmanager.FleetDatabasesClientListByFleetspaceResponse]](), + beginRename: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientRenameResponse]](), + beginRevert: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientRevertResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientUpdateResponse]](), + } +} + +// FleetDatabasesServerTransport connects instances of armdatabasefleetmanager.FleetDatabasesClient to instances of FleetDatabasesServer. +// Don't use this type directly, use NewFleetDatabasesServerTransport instead. +type FleetDatabasesServerTransport struct { + srv *FleetDatabasesServer + beginChangeTier *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientChangeTierResponse]] + beginCreateOrUpdate *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientDeleteResponse]] + newListByFleetspacePager *tracker[azfake.PagerResponder[armdatabasefleetmanager.FleetDatabasesClientListByFleetspaceResponse]] + beginRename *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientRenameResponse]] + beginRevert *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientRevertResponse]] + beginUpdate *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for FleetDatabasesServerTransport. +func (f *FleetDatabasesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return f.dispatchToMethodFake(req, method) +} + +func (f *FleetDatabasesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if fleetDatabasesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = fleetDatabasesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "FleetDatabasesClient.BeginChangeTier": + res.resp, res.err = f.dispatchBeginChangeTier(req) + case "FleetDatabasesClient.BeginCreateOrUpdate": + res.resp, res.err = f.dispatchBeginCreateOrUpdate(req) + case "FleetDatabasesClient.BeginDelete": + res.resp, res.err = f.dispatchBeginDelete(req) + case "FleetDatabasesClient.Get": + res.resp, res.err = f.dispatchGet(req) + case "FleetDatabasesClient.NewListByFleetspacePager": + res.resp, res.err = f.dispatchNewListByFleetspacePager(req) + case "FleetDatabasesClient.BeginRename": + res.resp, res.err = f.dispatchBeginRename(req) + case "FleetDatabasesClient.BeginRevert": + res.resp, res.err = f.dispatchBeginRevert(req) + case "FleetDatabasesClient.BeginUpdate": + res.resp, res.err = f.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 (f *FleetDatabasesServerTransport) dispatchBeginChangeTier(req *http.Request) (*http.Response, error) { + if f.srv.BeginChangeTier == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginChangeTier not implemented")} + } + beginChangeTier := f.beginChangeTier.get(req) + if beginChangeTier == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/changeTier` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdatabasefleetmanager.DatabaseChangeTierProperties](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + databaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("databaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginChangeTier(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, databaseNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginChangeTier = &respr + f.beginChangeTier.add(req, beginChangeTier) + } + + resp, err := server.PollerResponderNext(beginChangeTier, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + f.beginChangeTier.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginChangeTier) { + f.beginChangeTier.remove(req) + } + + return resp, nil +} + +func (f *FleetDatabasesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if f.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := f.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdatabasefleetmanager.FleetDatabase](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + databaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("databaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, databaseNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + f.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + f.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + f.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (f *FleetDatabasesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if f.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := f.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + databaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("databaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginDelete(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, databaseNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + f.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + f.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + f.beginDelete.remove(req) + } + + return resp, nil +} + +func (f *FleetDatabasesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if f.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + databaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("databaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.Get(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, databaseNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).FleetDatabase, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (f *FleetDatabasesServerTransport) dispatchNewListByFleetspacePager(req *http.Request) (*http.Response, error) { + if f.srv.NewListByFleetspacePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByFleetspacePager not implemented")} + } + newListByFleetspacePager := f.newListByFleetspacePager.get(req) + if newListByFleetspacePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + skipUnescaped, err := url.QueryUnescape(qp.Get("$skip")) + if err != nil { + return nil, err + } + skipParam, err := parseOptional(skipUnescaped, func(v string) (int64, error) { + p, parseErr := strconv.ParseInt(v, 10, 64) + if parseErr != nil { + return 0, parseErr + } + return p, nil + }) + if err != nil { + return nil, err + } + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int64, error) { + p, parseErr := strconv.ParseInt(v, 10, 64) + if parseErr != nil { + return 0, parseErr + } + return p, nil + }) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + skiptokenUnescaped, err := url.QueryUnescape(qp.Get("$skiptoken")) + if err != nil { + return nil, err + } + skiptokenParam := getOptional(skiptokenUnescaped) + var options *armdatabasefleetmanager.FleetDatabasesClientListByFleetspaceOptions + if skipParam != nil || topParam != nil || filterParam != nil || skiptokenParam != nil { + options = &armdatabasefleetmanager.FleetDatabasesClientListByFleetspaceOptions{ + Skip: skipParam, + Top: topParam, + Filter: filterParam, + Skiptoken: skiptokenParam, + } + } + resp := f.srv.NewListByFleetspacePager(resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, options) + newListByFleetspacePager = &resp + f.newListByFleetspacePager.add(req, newListByFleetspacePager) + server.PagerResponderInjectNextLinks(newListByFleetspacePager, req, func(page *armdatabasefleetmanager.FleetDatabasesClientListByFleetspaceResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByFleetspacePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + f.newListByFleetspacePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByFleetspacePager) { + f.newListByFleetspacePager.remove(req) + } + return resp, nil +} + +func (f *FleetDatabasesServerTransport) dispatchBeginRename(req *http.Request) (*http.Response, error) { + if f.srv.BeginRename == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginRename not implemented")} + } + beginRename := f.beginRename.get(req) + if beginRename == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/rename` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdatabasefleetmanager.DatabaseRenameProperties](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + databaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("databaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginRename(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, databaseNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginRename = &respr + f.beginRename.add(req, beginRename) + } + + resp, err := server.PollerResponderNext(beginRename, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + f.beginRename.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginRename) { + f.beginRename.remove(req) + } + + return resp, nil +} + +func (f *FleetDatabasesServerTransport) dispatchBeginRevert(req *http.Request) (*http.Response, error) { + if f.srv.BeginRevert == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginRevert not implemented")} + } + beginRevert := f.beginRevert.get(req) + if beginRevert == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/revert` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + databaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("databaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginRevert(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, databaseNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginRevert = &respr + f.beginRevert.add(req, beginRevert) + } + + resp, err := server.PollerResponderNext(beginRevert, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + f.beginRevert.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginRevert) { + f.beginRevert.remove(req) + } + + return resp, nil +} + +func (f *FleetDatabasesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if f.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := f.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdatabasefleetmanager.FleetDatabase](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + databaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("databaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginUpdate(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, databaseNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + f.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + f.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + f.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to FleetDatabasesServerTransport +var fleetDatabasesServerTransportInterceptor 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/databasefleetmanager/armdatabasefleetmanager/fake/fleets_server.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/fleets_server.go new file mode 100644 index 000000000000..c42f8b7b5a1c --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/fleets_server.go @@ -0,0 +1,418 @@ +// 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 ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// FleetsServer is a fake server for instances of the armdatabasefleetmanager.FleetsClient type. +type FleetsServer struct { + // BeginCreateOrUpdate is the fake for method FleetsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, fleetName string, resource armdatabasefleetmanager.Fleet, options *armdatabasefleetmanager.FleetsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method FleetsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, fleetName string, options *armdatabasefleetmanager.FleetsClientBeginDeleteOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method FleetsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, fleetName string, options *armdatabasefleetmanager.FleetsClientGetOptions) (resp azfake.Responder[armdatabasefleetmanager.FleetsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method FleetsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armdatabasefleetmanager.FleetsClientListOptions) (resp azfake.PagerResponder[armdatabasefleetmanager.FleetsClientListResponse]) + + // NewListByResourceGroupPager is the fake for method FleetsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armdatabasefleetmanager.FleetsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armdatabasefleetmanager.FleetsClientListByResourceGroupResponse]) + + // BeginUpdate is the fake for method FleetsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, fleetName string, properties armdatabasefleetmanager.FleetUpdate, options *armdatabasefleetmanager.FleetsClientBeginUpdateOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewFleetsServerTransport creates a new instance of FleetsServerTransport with the provided implementation. +// The returned FleetsServerTransport instance is connected to an instance of armdatabasefleetmanager.FleetsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewFleetsServerTransport(srv *FleetsServer) *FleetsServerTransport { + return &FleetsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetsClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armdatabasefleetmanager.FleetsClientListResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armdatabasefleetmanager.FleetsClientListByResourceGroupResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetsClientUpdateResponse]](), + } +} + +// FleetsServerTransport connects instances of armdatabasefleetmanager.FleetsClient to instances of FleetsServer. +// Don't use this type directly, use NewFleetsServerTransport instead. +type FleetsServerTransport struct { + srv *FleetsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetsClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armdatabasefleetmanager.FleetsClientListResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armdatabasefleetmanager.FleetsClientListByResourceGroupResponse]] + beginUpdate *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for FleetsServerTransport. +func (f *FleetsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return f.dispatchToMethodFake(req, method) +} + +func (f *FleetsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if fleetsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = fleetsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "FleetsClient.BeginCreateOrUpdate": + res.resp, res.err = f.dispatchBeginCreateOrUpdate(req) + case "FleetsClient.BeginDelete": + res.resp, res.err = f.dispatchBeginDelete(req) + case "FleetsClient.Get": + res.resp, res.err = f.dispatchGet(req) + case "FleetsClient.NewListPager": + res.resp, res.err = f.dispatchNewListPager(req) + case "FleetsClient.NewListByResourceGroupPager": + res.resp, res.err = f.dispatchNewListByResourceGroupPager(req) + case "FleetsClient.BeginUpdate": + res.resp, res.err = f.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 (f *FleetsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if f.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := f.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdatabasefleetmanager.Fleet](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, fleetNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + f.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + f.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + f.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (f *FleetsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if f.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := f.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginDelete(req.Context(), resourceGroupNameParam, fleetNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + f.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + f.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + f.beginDelete.remove(req) + } + + return resp, nil +} + +func (f *FleetsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if f.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.Get(req.Context(), resourceGroupNameParam, fleetNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Fleet, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (f *FleetsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if f.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := f.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := f.srv.NewListPager(nil) + newListPager = &resp + f.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armdatabasefleetmanager.FleetsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + f.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + f.newListPager.remove(req) + } + return resp, nil +} + +func (f *FleetsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if f.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := f.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + skipUnescaped, err := url.QueryUnescape(qp.Get("$skip")) + if err != nil { + return nil, err + } + skipParam, err := parseOptional(skipUnescaped, func(v string) (int64, error) { + p, parseErr := strconv.ParseInt(v, 10, 64) + if parseErr != nil { + return 0, parseErr + } + return p, nil + }) + if err != nil { + return nil, err + } + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int64, error) { + p, parseErr := strconv.ParseInt(v, 10, 64) + if parseErr != nil { + return 0, parseErr + } + return p, nil + }) + if err != nil { + return nil, err + } + skiptokenUnescaped, err := url.QueryUnescape(qp.Get("$skiptoken")) + if err != nil { + return nil, err + } + skiptokenParam := getOptional(skiptokenUnescaped) + var options *armdatabasefleetmanager.FleetsClientListByResourceGroupOptions + if skipParam != nil || topParam != nil || skiptokenParam != nil { + options = &armdatabasefleetmanager.FleetsClientListByResourceGroupOptions{ + Skip: skipParam, + Top: topParam, + Skiptoken: skiptokenParam, + } + } + resp := f.srv.NewListByResourceGroupPager(resourceGroupNameParam, options) + newListByResourceGroupPager = &resp + f.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armdatabasefleetmanager.FleetsClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + f.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + f.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (f *FleetsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if f.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := f.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdatabasefleetmanager.FleetUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginUpdate(req.Context(), resourceGroupNameParam, fleetNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + f.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + f.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + f.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to FleetsServerTransport +var fleetsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/fleetspaces_server.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/fleetspaces_server.go new file mode 100644 index 000000000000..24c34b982e3a --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/fleetspaces_server.go @@ -0,0 +1,513 @@ +// 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 ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// FleetspacesServer is a fake server for instances of the armdatabasefleetmanager.FleetspacesClient type. +type FleetspacesServer struct { + // BeginCreateOrUpdate is the fake for method FleetspacesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, resource armdatabasefleetmanager.Fleetspace, options *armdatabasefleetmanager.FleetspacesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetspacesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method FleetspacesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, options *armdatabasefleetmanager.FleetspacesClientBeginDeleteOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetspacesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method FleetspacesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, options *armdatabasefleetmanager.FleetspacesClientGetOptions) (resp azfake.Responder[armdatabasefleetmanager.FleetspacesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByFleetPager is the fake for method FleetspacesClient.NewListByFleetPager + // HTTP status codes to indicate success: http.StatusOK + NewListByFleetPager func(resourceGroupName string, fleetName string, options *armdatabasefleetmanager.FleetspacesClientListByFleetOptions) (resp azfake.PagerResponder[armdatabasefleetmanager.FleetspacesClientListByFleetResponse]) + + // BeginRegisterServer is the fake for method FleetspacesClient.BeginRegisterServer + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginRegisterServer func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, body armdatabasefleetmanager.RegisterServerProperties, options *armdatabasefleetmanager.FleetspacesClientBeginRegisterServerOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetspacesClientRegisterServerResponse], errResp azfake.ErrorResponder) + + // BeginUnregister is the fake for method FleetspacesClient.BeginUnregister + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginUnregister func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, options *armdatabasefleetmanager.FleetspacesClientBeginUnregisterOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetspacesClientUnregisterResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method FleetspacesClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, properties armdatabasefleetmanager.Fleetspace, options *armdatabasefleetmanager.FleetspacesClientBeginUpdateOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetspacesClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewFleetspacesServerTransport creates a new instance of FleetspacesServerTransport with the provided implementation. +// The returned FleetspacesServerTransport instance is connected to an instance of armdatabasefleetmanager.FleetspacesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewFleetspacesServerTransport(srv *FleetspacesServer) *FleetspacesServerTransport { + return &FleetspacesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetspacesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetspacesClientDeleteResponse]](), + newListByFleetPager: newTracker[azfake.PagerResponder[armdatabasefleetmanager.FleetspacesClientListByFleetResponse]](), + beginRegisterServer: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetspacesClientRegisterServerResponse]](), + beginUnregister: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetspacesClientUnregisterResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetspacesClientUpdateResponse]](), + } +} + +// FleetspacesServerTransport connects instances of armdatabasefleetmanager.FleetspacesClient to instances of FleetspacesServer. +// Don't use this type directly, use NewFleetspacesServerTransport instead. +type FleetspacesServerTransport struct { + srv *FleetspacesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetspacesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetspacesClientDeleteResponse]] + newListByFleetPager *tracker[azfake.PagerResponder[armdatabasefleetmanager.FleetspacesClientListByFleetResponse]] + beginRegisterServer *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetspacesClientRegisterServerResponse]] + beginUnregister *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetspacesClientUnregisterResponse]] + beginUpdate *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetspacesClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for FleetspacesServerTransport. +func (f *FleetspacesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return f.dispatchToMethodFake(req, method) +} + +func (f *FleetspacesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if fleetspacesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = fleetspacesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "FleetspacesClient.BeginCreateOrUpdate": + res.resp, res.err = f.dispatchBeginCreateOrUpdate(req) + case "FleetspacesClient.BeginDelete": + res.resp, res.err = f.dispatchBeginDelete(req) + case "FleetspacesClient.Get": + res.resp, res.err = f.dispatchGet(req) + case "FleetspacesClient.NewListByFleetPager": + res.resp, res.err = f.dispatchNewListByFleetPager(req) + case "FleetspacesClient.BeginRegisterServer": + res.resp, res.err = f.dispatchBeginRegisterServer(req) + case "FleetspacesClient.BeginUnregister": + res.resp, res.err = f.dispatchBeginUnregister(req) + case "FleetspacesClient.BeginUpdate": + res.resp, res.err = f.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 (f *FleetspacesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if f.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := f.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdatabasefleetmanager.Fleetspace](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + f.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + f.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + f.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (f *FleetspacesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if f.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := f.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginDelete(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + f.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + f.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + f.beginDelete.remove(req) + } + + return resp, nil +} + +func (f *FleetspacesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if f.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.Get(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Fleetspace, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (f *FleetspacesServerTransport) dispatchNewListByFleetPager(req *http.Request) (*http.Response, error) { + if f.srv.NewListByFleetPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByFleetPager not implemented")} + } + newListByFleetPager := f.newListByFleetPager.get(req) + if newListByFleetPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + skipUnescaped, err := url.QueryUnescape(qp.Get("$skip")) + if err != nil { + return nil, err + } + skipParam, err := parseOptional(skipUnescaped, func(v string) (int64, error) { + p, parseErr := strconv.ParseInt(v, 10, 64) + if parseErr != nil { + return 0, parseErr + } + return p, nil + }) + if err != nil { + return nil, err + } + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int64, error) { + p, parseErr := strconv.ParseInt(v, 10, 64) + if parseErr != nil { + return 0, parseErr + } + return p, nil + }) + if err != nil { + return nil, err + } + skiptokenUnescaped, err := url.QueryUnescape(qp.Get("$skiptoken")) + if err != nil { + return nil, err + } + skiptokenParam := getOptional(skiptokenUnescaped) + var options *armdatabasefleetmanager.FleetspacesClientListByFleetOptions + if skipParam != nil || topParam != nil || skiptokenParam != nil { + options = &armdatabasefleetmanager.FleetspacesClientListByFleetOptions{ + Skip: skipParam, + Top: topParam, + Skiptoken: skiptokenParam, + } + } + resp := f.srv.NewListByFleetPager(resourceGroupNameParam, fleetNameParam, options) + newListByFleetPager = &resp + f.newListByFleetPager.add(req, newListByFleetPager) + server.PagerResponderInjectNextLinks(newListByFleetPager, req, func(page *armdatabasefleetmanager.FleetspacesClientListByFleetResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByFleetPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + f.newListByFleetPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByFleetPager) { + f.newListByFleetPager.remove(req) + } + return resp, nil +} + +func (f *FleetspacesServerTransport) dispatchBeginRegisterServer(req *http.Request) (*http.Response, error) { + if f.srv.BeginRegisterServer == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginRegisterServer not implemented")} + } + beginRegisterServer := f.beginRegisterServer.get(req) + if beginRegisterServer == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/registerServer` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdatabasefleetmanager.RegisterServerProperties](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginRegisterServer(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginRegisterServer = &respr + f.beginRegisterServer.add(req, beginRegisterServer) + } + + resp, err := server.PollerResponderNext(beginRegisterServer, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + f.beginRegisterServer.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginRegisterServer) { + f.beginRegisterServer.remove(req) + } + + return resp, nil +} + +func (f *FleetspacesServerTransport) dispatchBeginUnregister(req *http.Request) (*http.Response, error) { + if f.srv.BeginUnregister == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUnregister not implemented")} + } + beginUnregister := f.beginUnregister.get(req) + if beginUnregister == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/unregister` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginUnregister(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUnregister = &respr + f.beginUnregister.add(req, beginUnregister) + } + + resp, err := server.PollerResponderNext(beginUnregister, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + f.beginUnregister.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUnregister) { + f.beginUnregister.remove(req) + } + + return resp, nil +} + +func (f *FleetspacesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if f.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := f.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdatabasefleetmanager.Fleetspace](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginUpdate(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + f.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + f.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + f.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to FleetspacesServerTransport +var fleetspacesServerTransportInterceptor 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/databasefleetmanager/armdatabasefleetmanager/fake/fleettiers_server.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/fleettiers_server.go new file mode 100644 index 000000000000..783ed6910838 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/fleettiers_server.go @@ -0,0 +1,440 @@ +// 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 ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// FleetTiersServer is a fake server for instances of the armdatabasefleetmanager.FleetTiersClient type. +type FleetTiersServer struct { + // BeginCreateOrUpdate is the fake for method FleetTiersClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, fleetName string, tierName string, resource armdatabasefleetmanager.FleetTier, options *armdatabasefleetmanager.FleetTiersClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetTiersClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method FleetTiersClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, fleetName string, tierName string, options *armdatabasefleetmanager.FleetTiersClientBeginDeleteOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetTiersClientDeleteResponse], errResp azfake.ErrorResponder) + + // Disable is the fake for method FleetTiersClient.Disable + // HTTP status codes to indicate success: http.StatusOK + Disable func(ctx context.Context, resourceGroupName string, fleetName string, tierName string, options *armdatabasefleetmanager.FleetTiersClientDisableOptions) (resp azfake.Responder[armdatabasefleetmanager.FleetTiersClientDisableResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method FleetTiersClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, fleetName string, tierName string, options *armdatabasefleetmanager.FleetTiersClientGetOptions) (resp azfake.Responder[armdatabasefleetmanager.FleetTiersClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByFleetPager is the fake for method FleetTiersClient.NewListByFleetPager + // HTTP status codes to indicate success: http.StatusOK + NewListByFleetPager func(resourceGroupName string, fleetName string, options *armdatabasefleetmanager.FleetTiersClientListByFleetOptions) (resp azfake.PagerResponder[armdatabasefleetmanager.FleetTiersClientListByFleetResponse]) + + // BeginUpdate is the fake for method FleetTiersClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, fleetName string, tierName string, properties armdatabasefleetmanager.FleetTier, options *armdatabasefleetmanager.FleetTiersClientBeginUpdateOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetTiersClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewFleetTiersServerTransport creates a new instance of FleetTiersServerTransport with the provided implementation. +// The returned FleetTiersServerTransport instance is connected to an instance of armdatabasefleetmanager.FleetTiersClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewFleetTiersServerTransport(srv *FleetTiersServer) *FleetTiersServerTransport { + return &FleetTiersServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetTiersClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetTiersClientDeleteResponse]](), + newListByFleetPager: newTracker[azfake.PagerResponder[armdatabasefleetmanager.FleetTiersClientListByFleetResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetTiersClientUpdateResponse]](), + } +} + +// FleetTiersServerTransport connects instances of armdatabasefleetmanager.FleetTiersClient to instances of FleetTiersServer. +// Don't use this type directly, use NewFleetTiersServerTransport instead. +type FleetTiersServerTransport struct { + srv *FleetTiersServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetTiersClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetTiersClientDeleteResponse]] + newListByFleetPager *tracker[azfake.PagerResponder[armdatabasefleetmanager.FleetTiersClientListByFleetResponse]] + beginUpdate *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetTiersClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for FleetTiersServerTransport. +func (f *FleetTiersServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return f.dispatchToMethodFake(req, method) +} + +func (f *FleetTiersServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if fleetTiersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = fleetTiersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "FleetTiersClient.BeginCreateOrUpdate": + res.resp, res.err = f.dispatchBeginCreateOrUpdate(req) + case "FleetTiersClient.BeginDelete": + res.resp, res.err = f.dispatchBeginDelete(req) + case "FleetTiersClient.Disable": + res.resp, res.err = f.dispatchDisable(req) + case "FleetTiersClient.Get": + res.resp, res.err = f.dispatchGet(req) + case "FleetTiersClient.NewListByFleetPager": + res.resp, res.err = f.dispatchNewListByFleetPager(req) + case "FleetTiersClient.BeginUpdate": + res.resp, res.err = f.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 (f *FleetTiersServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if f.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := f.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tiers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdatabasefleetmanager.FleetTier](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + tierNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("tierName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, fleetNameParam, tierNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + f.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + f.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + f.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (f *FleetTiersServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if f.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := f.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tiers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + tierNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("tierName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginDelete(req.Context(), resourceGroupNameParam, fleetNameParam, tierNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + f.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + f.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + f.beginDelete.remove(req) + } + + return resp, nil +} + +func (f *FleetTiersServerTransport) dispatchDisable(req *http.Request) (*http.Response, error) { + if f.srv.Disable == nil { + return nil, &nonRetriableError{errors.New("fake for method Disable not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tiers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/disable` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + tierNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("tierName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.Disable(req.Context(), resourceGroupNameParam, fleetNameParam, tierNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).FleetTier, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (f *FleetTiersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if f.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tiers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + tierNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("tierName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.Get(req.Context(), resourceGroupNameParam, fleetNameParam, tierNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).FleetTier, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (f *FleetTiersServerTransport) dispatchNewListByFleetPager(req *http.Request) (*http.Response, error) { + if f.srv.NewListByFleetPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByFleetPager not implemented")} + } + newListByFleetPager := f.newListByFleetPager.get(req) + if newListByFleetPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tiers` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + skipUnescaped, err := url.QueryUnescape(qp.Get("$skip")) + if err != nil { + return nil, err + } + skipParam, err := parseOptional(skipUnescaped, func(v string) (int64, error) { + p, parseErr := strconv.ParseInt(v, 10, 64) + if parseErr != nil { + return 0, parseErr + } + return p, nil + }) + if err != nil { + return nil, err + } + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int64, error) { + p, parseErr := strconv.ParseInt(v, 10, 64) + if parseErr != nil { + return 0, parseErr + } + return p, nil + }) + if err != nil { + return nil, err + } + skiptokenUnescaped, err := url.QueryUnescape(qp.Get("$skiptoken")) + if err != nil { + return nil, err + } + skiptokenParam := getOptional(skiptokenUnescaped) + var options *armdatabasefleetmanager.FleetTiersClientListByFleetOptions + if skipParam != nil || topParam != nil || skiptokenParam != nil { + options = &armdatabasefleetmanager.FleetTiersClientListByFleetOptions{ + Skip: skipParam, + Top: topParam, + Skiptoken: skiptokenParam, + } + } + resp := f.srv.NewListByFleetPager(resourceGroupNameParam, fleetNameParam, options) + newListByFleetPager = &resp + f.newListByFleetPager.add(req, newListByFleetPager) + server.PagerResponderInjectNextLinks(newListByFleetPager, req, func(page *armdatabasefleetmanager.FleetTiersClientListByFleetResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByFleetPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + f.newListByFleetPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByFleetPager) { + f.newListByFleetPager.remove(req) + } + return resp, nil +} + +func (f *FleetTiersServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if f.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := f.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tiers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdatabasefleetmanager.FleetTier](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + tierNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("tierName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginUpdate(req.Context(), resourceGroupNameParam, fleetNameParam, tierNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + f.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + f.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + f.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to FleetTiersServerTransport +var fleetTiersServerTransportInterceptor 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/databasefleetmanager/armdatabasefleetmanager/fake/internal.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/internal.go new file mode 100644 index 000000000000..c614f8d5643a --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/internal.go @@ -0,0 +1,85 @@ +// 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 ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "net/http" + "reflect" + "sync" +) + +type result struct { + resp *http.Response + err error +} + +type nonRetriableError struct { + error +} + +func (nonRetriableError) NonRetriable() { + // marker method +} + +func contains[T comparable](s []T, v T) bool { + for _, vv := range s { + if vv == v { + return true + } + } + return false +} + +func getOptional[T any](v T) *T { + if reflect.ValueOf(v).IsZero() { + return nil + } + return &v +} + +func parseOptional[T any](v string, parse func(v string) (T, error)) (*T, error) { + if v == "" { + return nil, nil + } + t, err := parse(v) + if err != nil { + return nil, err + } + return &t, err +} + +func newTracker[T any]() *tracker[T] { + return &tracker[T]{ + items: map[string]*T{}, + } +} + +type tracker[T any] struct { + items map[string]*T + mu sync.Mutex +} + +func (p *tracker[T]) get(req *http.Request) *T { + p.mu.Lock() + defer p.mu.Unlock() + if item, ok := p.items[server.SanitizePagerPollerPath(req.URL.Path)]; ok { + return item + } + return nil +} + +func (p *tracker[T]) add(req *http.Request, item *T) { + p.mu.Lock() + defer p.mu.Unlock() + p.items[server.SanitizePagerPollerPath(req.URL.Path)] = item +} + +func (p *tracker[T]) remove(req *http.Request) { + p.mu.Lock() + defer p.mu.Unlock() + delete(p.items, server.SanitizePagerPollerPath(req.URL.Path)) +} diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/operations_server.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/operations_server.go new file mode 100644 index 000000000000..033dc2b2cb7d --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/operations_server.go @@ -0,0 +1,118 @@ +// 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 ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager" + "net/http" +) + +// OperationsServer is a fake server for instances of the armdatabasefleetmanager.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armdatabasefleetmanager.OperationsClientListOptions) (resp azfake.PagerResponder[armdatabasefleetmanager.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of armdatabasefleetmanager.OperationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { + return &OperationsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armdatabasefleetmanager.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of armdatabasefleetmanager.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armdatabasefleetmanager.OperationsClientListResponse]] +} + +// Do implements the policy.Transporter interface for OperationsServerTransport. +func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return o.dispatchToMethodFake(req, method) +} + +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if 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) + } + + } + 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) { + if o.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := o.newListPager.get(req) + if newListPager == nil { + resp := o.srv.NewListPager(nil) + newListPager = &resp + o.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armdatabasefleetmanager.OperationsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + o.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + o.newListPager.remove(req) + } + 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/databasefleetmanager/armdatabasefleetmanager/fake/server_factory.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/server_factory.go new file mode 100644 index 000000000000..7ddb43745fe0 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/server_factory.go @@ -0,0 +1,112 @@ +// 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 ( + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" + "sync" +) + +// ServerFactory is a fake server for instances of the armdatabasefleetmanager.ClientFactory type. +type ServerFactory struct { + // FirewallRulesServer contains the fakes for client FirewallRulesClient + FirewallRulesServer FirewallRulesServer + + // FleetDatabasesServer contains the fakes for client FleetDatabasesClient + FleetDatabasesServer FleetDatabasesServer + + // FleetTiersServer contains the fakes for client FleetTiersClient + FleetTiersServer FleetTiersServer + + // FleetsServer contains the fakes for client FleetsClient + FleetsServer FleetsServer + + // FleetspacesServer contains the fakes for client FleetspacesClient + FleetspacesServer FleetspacesServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armdatabasefleetmanager.ClientFactory via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { + return &ServerFactoryTransport{ + srv: srv, + } +} + +// ServerFactoryTransport connects instances of armdatabasefleetmanager.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trFirewallRulesServer *FirewallRulesServerTransport + trFleetDatabasesServer *FleetDatabasesServerTransport + trFleetTiersServer *FleetTiersServerTransport + trFleetsServer *FleetsServerTransport + trFleetspacesServer *FleetspacesServerTransport + trOperationsServer *OperationsServerTransport +} + +// Do implements the policy.Transporter interface for ServerFactoryTransport. +func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + client := method[:strings.Index(method, ".")] + var resp *http.Response + var err error + + switch client { + case "FirewallRulesClient": + initServer(s, &s.trFirewallRulesServer, func() *FirewallRulesServerTransport { + return NewFirewallRulesServerTransport(&s.srv.FirewallRulesServer) + }) + resp, err = s.trFirewallRulesServer.Do(req) + case "FleetDatabasesClient": + initServer(s, &s.trFleetDatabasesServer, func() *FleetDatabasesServerTransport { + return NewFleetDatabasesServerTransport(&s.srv.FleetDatabasesServer) + }) + resp, err = s.trFleetDatabasesServer.Do(req) + case "FleetTiersClient": + initServer(s, &s.trFleetTiersServer, func() *FleetTiersServerTransport { return NewFleetTiersServerTransport(&s.srv.FleetTiersServer) }) + resp, err = s.trFleetTiersServer.Do(req) + case "FleetsClient": + initServer(s, &s.trFleetsServer, func() *FleetsServerTransport { return NewFleetsServerTransport(&s.srv.FleetsServer) }) + resp, err = s.trFleetsServer.Do(req) + case "FleetspacesClient": + initServer(s, &s.trFleetspacesServer, func() *FleetspacesServerTransport { return NewFleetspacesServerTransport(&s.srv.FleetspacesServer) }) + resp, err = s.trFleetspacesServer.Do(req) + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + default: + err = fmt.Errorf("unhandled client %s", client) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { + s.trMu.Lock() + if *dst == nil { + *dst = src() + } + s.trMu.Unlock() +} diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/firewallrules_client.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/firewallrules_client.go new file mode 100644 index 000000000000..1fae45770ff8 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/firewallrules_client.go @@ -0,0 +1,373 @@ +// 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 armdatabasefleetmanager + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// FirewallRulesClient contains the methods for the FirewallRules group. +// Don't use this type directly, use NewFirewallRulesClient() instead. +type FirewallRulesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewFirewallRulesClient creates a new instance of FirewallRulesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewFirewallRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FirewallRulesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FirewallRulesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a firewall rule. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - firewallRuleName - Name of the firewall rule. +// - resource - The firewall rule object to create or update. +// - options - FirewallRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the FirewallRulesClient.BeginCreateOrUpdate +// method. +func (client *FirewallRulesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, firewallRuleName string, resource FirewallRule, options *FirewallRulesClientBeginCreateOrUpdateOptions) (*runtime.Poller[FirewallRulesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, fleetName, fleetspaceName, firewallRuleName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FirewallRulesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FirewallRulesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates a firewall rule. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FirewallRulesClient) createOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, firewallRuleName string, resource FirewallRule, options *FirewallRulesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "FirewallRulesClient.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, fleetName, fleetspaceName, firewallRuleName, resource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *FirewallRulesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, firewallRuleName string, resource FirewallRule, _ *FirewallRulesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/firewallRules/{firewallRuleName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + if firewallRuleName == "" { + return nil, errors.New("parameter firewallRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallRuleName}", url.PathEscape(firewallRuleName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a firewall rule. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - firewallRuleName - Name of the firewall rule. +// - options - FirewallRulesClientBeginDeleteOptions contains the optional parameters for the FirewallRulesClient.BeginDelete +// method. +func (client *FirewallRulesClient) BeginDelete(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, firewallRuleName string, options *FirewallRulesClientBeginDeleteOptions) (*runtime.Poller[FirewallRulesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, fleetName, fleetspaceName, firewallRuleName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FirewallRulesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FirewallRulesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a firewall rule. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FirewallRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, firewallRuleName string, options *FirewallRulesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "FirewallRulesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, fleetName, fleetspaceName, firewallRuleName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *FirewallRulesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, firewallRuleName string, _ *FirewallRulesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/firewallRules/{firewallRuleName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + if firewallRuleName == "" { + return nil, errors.New("parameter firewallRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallRuleName}", url.PathEscape(firewallRuleName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a firewall rule. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - firewallRuleName - Name of the firewall rule. +// - options - FirewallRulesClientGetOptions contains the optional parameters for the FirewallRulesClient.Get method. +func (client *FirewallRulesClient) Get(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, firewallRuleName string, options *FirewallRulesClientGetOptions) (FirewallRulesClientGetResponse, error) { + var err error + const operationName = "FirewallRulesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, fleetName, fleetspaceName, firewallRuleName, options) + if err != nil { + return FirewallRulesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FirewallRulesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FirewallRulesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *FirewallRulesClient) getCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, firewallRuleName string, _ *FirewallRulesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/firewallRules/{firewallRuleName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + if firewallRuleName == "" { + return nil, errors.New("parameter firewallRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallRuleName}", url.PathEscape(firewallRuleName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FirewallRulesClient) getHandleResponse(resp *http.Response) (FirewallRulesClientGetResponse, error) { + result := FirewallRulesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FirewallRule); err != nil { + return FirewallRulesClientGetResponse{}, err + } + return result, nil +} + +// NewListByFleetspacePager - Gets all firewall rules in a fleetspace. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - options - FirewallRulesClientListByFleetspaceOptions contains the optional parameters for the FirewallRulesClient.NewListByFleetspacePager +// method. +func (client *FirewallRulesClient) NewListByFleetspacePager(resourceGroupName string, fleetName string, fleetspaceName string, options *FirewallRulesClientListByFleetspaceOptions) *runtime.Pager[FirewallRulesClientListByFleetspaceResponse] { + return runtime.NewPager(runtime.PagingHandler[FirewallRulesClientListByFleetspaceResponse]{ + More: func(page FirewallRulesClientListByFleetspaceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FirewallRulesClientListByFleetspaceResponse) (FirewallRulesClientListByFleetspaceResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "FirewallRulesClient.NewListByFleetspacePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByFleetspaceCreateRequest(ctx, resourceGroupName, fleetName, fleetspaceName, options) + }, nil) + if err != nil { + return FirewallRulesClientListByFleetspaceResponse{}, err + } + return client.listByFleetspaceHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByFleetspaceCreateRequest creates the ListByFleetspace request. +func (client *FirewallRulesClient) listByFleetspaceCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, options *FirewallRulesClientListByFleetspaceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/firewallRules" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(*options.Skip, 10)) + } + if options != nil && options.Skiptoken != nil { + reqQP.Set("$skiptoken", *options.Skiptoken) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(*options.Top, 10)) + } + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByFleetspaceHandleResponse handles the ListByFleetspace response. +func (client *FirewallRulesClient) listByFleetspaceHandleResponse(resp *http.Response) (FirewallRulesClientListByFleetspaceResponse, error) { + result := FirewallRulesClientListByFleetspaceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FirewallRuleListResult); err != nil { + return FirewallRulesClientListByFleetspaceResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleetdatabases_client.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleetdatabases_client.go new file mode 100644 index 000000000000..7cfd335215b0 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleetdatabases_client.go @@ -0,0 +1,736 @@ +// 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 armdatabasefleetmanager + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// FleetDatabasesClient contains the methods for the FleetDatabases group. +// Don't use this type directly, use NewFleetDatabasesClient() instead. +type FleetDatabasesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewFleetDatabasesClient creates a new instance of FleetDatabasesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewFleetDatabasesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FleetDatabasesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FleetDatabasesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginChangeTier - Moves database to a different tier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - databaseName - Name of the database. +// - body - The details of the change tier operation. +// - options - FleetDatabasesClientBeginChangeTierOptions contains the optional parameters for the FleetDatabasesClient.BeginChangeTier +// method. +func (client *FleetDatabasesClient) BeginChangeTier(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, body DatabaseChangeTierProperties, options *FleetDatabasesClientBeginChangeTierOptions) (*runtime.Poller[FleetDatabasesClientChangeTierResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.changeTier(ctx, resourceGroupName, fleetName, fleetspaceName, databaseName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetDatabasesClientChangeTierResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetDatabasesClientChangeTierResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ChangeTier - Moves database to a different tier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetDatabasesClient) changeTier(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, body DatabaseChangeTierProperties, options *FleetDatabasesClientBeginChangeTierOptions) (*http.Response, error) { + var err error + const operationName = "FleetDatabasesClient.BeginChangeTier" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.changeTierCreateRequest(ctx, resourceGroupName, fleetName, fleetspaceName, databaseName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// changeTierCreateRequest creates the ChangeTier request. +func (client *FleetDatabasesClient) changeTierCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, body DatabaseChangeTierProperties, _ *FleetDatabasesClientBeginChangeTierOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/databases/{databaseName}/changeTier" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginCreateOrUpdate - Creates or updates a fleet database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - databaseName - Name of the database. +// - resource - The database object to create or update. +// - options - FleetDatabasesClientBeginCreateOrUpdateOptions contains the optional parameters for the FleetDatabasesClient.BeginCreateOrUpdate +// method. +func (client *FleetDatabasesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, resource FleetDatabase, options *FleetDatabasesClientBeginCreateOrUpdateOptions) (*runtime.Poller[FleetDatabasesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, fleetName, fleetspaceName, databaseName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetDatabasesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetDatabasesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates a fleet database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetDatabasesClient) createOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, resource FleetDatabase, options *FleetDatabasesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "FleetDatabasesClient.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, fleetName, fleetspaceName, databaseName, resource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *FleetDatabasesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, resource FleetDatabase, _ *FleetDatabasesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/databases/{databaseName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a fleet database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - databaseName - Name of the database. +// - options - FleetDatabasesClientBeginDeleteOptions contains the optional parameters for the FleetDatabasesClient.BeginDelete +// method. +func (client *FleetDatabasesClient) BeginDelete(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, options *FleetDatabasesClientBeginDeleteOptions) (*runtime.Poller[FleetDatabasesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, fleetName, fleetspaceName, databaseName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetDatabasesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetDatabasesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a fleet database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetDatabasesClient) deleteOperation(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, options *FleetDatabasesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "FleetDatabasesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, fleetName, fleetspaceName, databaseName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *FleetDatabasesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, _ *FleetDatabasesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/databases/{databaseName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a fleet database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - databaseName - Name of the database. +// - options - FleetDatabasesClientGetOptions contains the optional parameters for the FleetDatabasesClient.Get method. +func (client *FleetDatabasesClient) Get(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, options *FleetDatabasesClientGetOptions) (FleetDatabasesClientGetResponse, error) { + var err error + const operationName = "FleetDatabasesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, fleetName, fleetspaceName, databaseName, options) + if err != nil { + return FleetDatabasesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FleetDatabasesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FleetDatabasesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *FleetDatabasesClient) getCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, _ *FleetDatabasesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/databases/{databaseName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FleetDatabasesClient) getHandleResponse(resp *http.Response) (FleetDatabasesClientGetResponse, error) { + result := FleetDatabasesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FleetDatabase); err != nil { + return FleetDatabasesClientGetResponse{}, err + } + return result, nil +} + +// NewListByFleetspacePager - Gets all fleet databases in a fleetspace. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - options - FleetDatabasesClientListByFleetspaceOptions contains the optional parameters for the FleetDatabasesClient.NewListByFleetspacePager +// method. +func (client *FleetDatabasesClient) NewListByFleetspacePager(resourceGroupName string, fleetName string, fleetspaceName string, options *FleetDatabasesClientListByFleetspaceOptions) *runtime.Pager[FleetDatabasesClientListByFleetspaceResponse] { + return runtime.NewPager(runtime.PagingHandler[FleetDatabasesClientListByFleetspaceResponse]{ + More: func(page FleetDatabasesClientListByFleetspaceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FleetDatabasesClientListByFleetspaceResponse) (FleetDatabasesClientListByFleetspaceResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "FleetDatabasesClient.NewListByFleetspacePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByFleetspaceCreateRequest(ctx, resourceGroupName, fleetName, fleetspaceName, options) + }, nil) + if err != nil { + return FleetDatabasesClientListByFleetspaceResponse{}, err + } + return client.listByFleetspaceHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByFleetspaceCreateRequest creates the ListByFleetspace request. +func (client *FleetDatabasesClient) listByFleetspaceCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, options *FleetDatabasesClientListByFleetspaceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/databases" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(*options.Skip, 10)) + } + if options != nil && options.Skiptoken != nil { + reqQP.Set("$skiptoken", *options.Skiptoken) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(*options.Top, 10)) + } + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByFleetspaceHandleResponse handles the ListByFleetspace response. +func (client *FleetDatabasesClient) listByFleetspaceHandleResponse(resp *http.Response) (FleetDatabasesClientListByFleetspaceResponse, error) { + result := FleetDatabasesClientListByFleetspaceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FleetDatabaseListResult); err != nil { + return FleetDatabasesClientListByFleetspaceResponse{}, err + } + return result, nil +} + +// BeginRename - Renames a database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - databaseName - Name of the database. +// - body - The details of the rename operation. +// - options - FleetDatabasesClientBeginRenameOptions contains the optional parameters for the FleetDatabasesClient.BeginRename +// method. +func (client *FleetDatabasesClient) BeginRename(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, body DatabaseRenameProperties, options *FleetDatabasesClientBeginRenameOptions) (*runtime.Poller[FleetDatabasesClientRenameResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.rename(ctx, resourceGroupName, fleetName, fleetspaceName, databaseName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetDatabasesClientRenameResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetDatabasesClientRenameResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Rename - Renames a database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetDatabasesClient) rename(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, body DatabaseRenameProperties, options *FleetDatabasesClientBeginRenameOptions) (*http.Response, error) { + var err error + const operationName = "FleetDatabasesClient.BeginRename" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.renameCreateRequest(ctx, resourceGroupName, fleetName, fleetspaceName, databaseName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// renameCreateRequest creates the Rename request. +func (client *FleetDatabasesClient) renameCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, body DatabaseRenameProperties, _ *FleetDatabasesClientBeginRenameOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/databases/{databaseName}/rename" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginRevert - Revert a database transparent data encryption (TDE). +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - databaseName - Name of the database. +// - options - FleetDatabasesClientBeginRevertOptions contains the optional parameters for the FleetDatabasesClient.BeginRevert +// method. +func (client *FleetDatabasesClient) BeginRevert(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, options *FleetDatabasesClientBeginRevertOptions) (*runtime.Poller[FleetDatabasesClientRevertResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.revert(ctx, resourceGroupName, fleetName, fleetspaceName, databaseName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetDatabasesClientRevertResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetDatabasesClientRevertResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Revert - Revert a database transparent data encryption (TDE). +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetDatabasesClient) revert(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, options *FleetDatabasesClientBeginRevertOptions) (*http.Response, error) { + var err error + const operationName = "FleetDatabasesClient.BeginRevert" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.revertCreateRequest(ctx, resourceGroupName, fleetName, fleetspaceName, databaseName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// revertCreateRequest creates the Revert request. +func (client *FleetDatabasesClient) revertCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, _ *FleetDatabasesClientBeginRevertOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/databases/{databaseName}/revert" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginUpdate - Updates a fleet database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - databaseName - Name of the database. +// - properties - The database object to patch. +// - options - FleetDatabasesClientBeginUpdateOptions contains the optional parameters for the FleetDatabasesClient.BeginUpdate +// method. +func (client *FleetDatabasesClient) BeginUpdate(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, properties FleetDatabase, options *FleetDatabasesClientBeginUpdateOptions) (*runtime.Poller[FleetDatabasesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, fleetName, fleetspaceName, databaseName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetDatabasesClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetDatabasesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Updates a fleet database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetDatabasesClient) update(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, properties FleetDatabase, options *FleetDatabasesClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "FleetDatabasesClient.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, fleetName, fleetspaceName, databaseName, properties, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *FleetDatabasesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, properties FleetDatabase, _ *FleetDatabasesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/databases/{databaseName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleets_client.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleets_client.go new file mode 100644 index 000000000000..019b66cb96bd --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleets_client.go @@ -0,0 +1,466 @@ +// 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 armdatabasefleetmanager + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// FleetsClient contains the methods for the Fleets group. +// Don't use this type directly, use NewFleetsClient() instead. +type FleetsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewFleetsClient creates a new instance of FleetsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewFleetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FleetsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FleetsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a fleet resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - resource - The fleet object to create or update. +// - options - FleetsClientBeginCreateOrUpdateOptions contains the optional parameters for the FleetsClient.BeginCreateOrUpdate +// method. +func (client *FleetsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, resource Fleet, options *FleetsClientBeginCreateOrUpdateOptions) (*runtime.Poller[FleetsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, fleetName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetsClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates a fleet resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetsClient) createOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, resource Fleet, options *FleetsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "FleetsClient.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, fleetName, resource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *FleetsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, resource Fleet, _ *FleetsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a fleet. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - options - FleetsClientBeginDeleteOptions contains the optional parameters for the FleetsClient.BeginDelete method. +func (client *FleetsClient) BeginDelete(ctx context.Context, resourceGroupName string, fleetName string, options *FleetsClientBeginDeleteOptions) (*runtime.Poller[FleetsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, fleetName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a fleet. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetsClient) deleteOperation(ctx context.Context, resourceGroupName string, fleetName string, options *FleetsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "FleetsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, fleetName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *FleetsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, _ *FleetsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a fleet resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - options - FleetsClientGetOptions contains the optional parameters for the FleetsClient.Get method. +func (client *FleetsClient) Get(ctx context.Context, resourceGroupName string, fleetName string, options *FleetsClientGetOptions) (FleetsClientGetResponse, error) { + var err error + const operationName = "FleetsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, fleetName, options) + if err != nil { + return FleetsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FleetsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FleetsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *FleetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, _ *FleetsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FleetsClient) getHandleResponse(resp *http.Response) (FleetsClientGetResponse, error) { + result := FleetsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Fleet); err != nil { + return FleetsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all fleets in a subscription. +// +// Generated from API version 2025-02-01-preview +// - options - FleetsClientListOptions contains the optional parameters for the FleetsClient.NewListPager method. +func (client *FleetsClient) NewListPager(options *FleetsClientListOptions) *runtime.Pager[FleetsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[FleetsClientListResponse]{ + More: func(page FleetsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FleetsClientListResponse) (FleetsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "FleetsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return FleetsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *FleetsClient) listCreateRequest(ctx context.Context, _ *FleetsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DatabaseFleetManager/fleets" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *FleetsClient) listHandleResponse(resp *http.Response) (FleetsClientListResponse, error) { + result := FleetsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FleetListResult); err != nil { + return FleetsClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Gets all fleets in a resource group. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - FleetsClientListByResourceGroupOptions contains the optional parameters for the FleetsClient.NewListByResourceGroupPager +// method. +func (client *FleetsClient) NewListByResourceGroupPager(resourceGroupName string, options *FleetsClientListByResourceGroupOptions) *runtime.Pager[FleetsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[FleetsClientListByResourceGroupResponse]{ + More: func(page FleetsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FleetsClientListByResourceGroupResponse) (FleetsClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "FleetsClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return FleetsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *FleetsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *FleetsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(*options.Skip, 10)) + } + if options != nil && options.Skiptoken != nil { + reqQP.Set("$skiptoken", *options.Skiptoken) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(*options.Top, 10)) + } + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *FleetsClient) listByResourceGroupHandleResponse(resp *http.Response) (FleetsClientListByResourceGroupResponse, error) { + result := FleetsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FleetListResult); err != nil { + return FleetsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// BeginUpdate - Modifies a fleet resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - properties - The fleet object to patch. +// - options - FleetsClientBeginUpdateOptions contains the optional parameters for the FleetsClient.BeginUpdate method. +func (client *FleetsClient) BeginUpdate(ctx context.Context, resourceGroupName string, fleetName string, properties FleetUpdate, options *FleetsClientBeginUpdateOptions) (*runtime.Poller[FleetsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, fleetName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Modifies a fleet resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetsClient) update(ctx context.Context, resourceGroupName string, fleetName string, properties FleetUpdate, options *FleetsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "FleetsClient.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, fleetName, properties, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *FleetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, properties FleetUpdate, _ *FleetsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleetspaces_client.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleetspaces_client.go new file mode 100644 index 000000000000..9fb9d48d5112 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleetspaces_client.go @@ -0,0 +1,605 @@ +// 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 armdatabasefleetmanager + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// FleetspacesClient contains the methods for the Fleetspaces group. +// Don't use this type directly, use NewFleetspacesClient() instead. +type FleetspacesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewFleetspacesClient creates a new instance of FleetspacesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewFleetspacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FleetspacesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FleetspacesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a fleetspace resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - resource - The fleet object to create or update. +// - options - FleetspacesClientBeginCreateOrUpdateOptions contains the optional parameters for the FleetspacesClient.BeginCreateOrUpdate +// method. +func (client *FleetspacesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, resource Fleetspace, options *FleetspacesClientBeginCreateOrUpdateOptions) (*runtime.Poller[FleetspacesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, fleetName, fleetspaceName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetspacesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetspacesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates a fleetspace resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetspacesClient) createOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, resource Fleetspace, options *FleetspacesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "FleetspacesClient.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, fleetName, fleetspaceName, resource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *FleetspacesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, resource Fleetspace, _ *FleetspacesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a fleetspace. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - options - FleetspacesClientBeginDeleteOptions contains the optional parameters for the FleetspacesClient.BeginDelete method. +func (client *FleetspacesClient) BeginDelete(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, options *FleetspacesClientBeginDeleteOptions) (*runtime.Poller[FleetspacesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, fleetName, fleetspaceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetspacesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetspacesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a fleetspace. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetspacesClient) deleteOperation(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, options *FleetspacesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "FleetspacesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, fleetName, fleetspaceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *FleetspacesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, _ *FleetspacesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets fleetspace resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - options - FleetspacesClientGetOptions contains the optional parameters for the FleetspacesClient.Get method. +func (client *FleetspacesClient) Get(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, options *FleetspacesClientGetOptions) (FleetspacesClientGetResponse, error) { + var err error + const operationName = "FleetspacesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, fleetName, fleetspaceName, options) + if err != nil { + return FleetspacesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FleetspacesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FleetspacesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *FleetspacesClient) getCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, _ *FleetspacesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FleetspacesClient) getHandleResponse(resp *http.Response) (FleetspacesClientGetResponse, error) { + result := FleetspacesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Fleetspace); err != nil { + return FleetspacesClientGetResponse{}, err + } + return result, nil +} + +// NewListByFleetPager - Lists fleetspaces in a fleet. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - options - FleetspacesClientListByFleetOptions contains the optional parameters for the FleetspacesClient.NewListByFleetPager +// method. +func (client *FleetspacesClient) NewListByFleetPager(resourceGroupName string, fleetName string, options *FleetspacesClientListByFleetOptions) *runtime.Pager[FleetspacesClientListByFleetResponse] { + return runtime.NewPager(runtime.PagingHandler[FleetspacesClientListByFleetResponse]{ + More: func(page FleetspacesClientListByFleetResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FleetspacesClientListByFleetResponse) (FleetspacesClientListByFleetResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "FleetspacesClient.NewListByFleetPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByFleetCreateRequest(ctx, resourceGroupName, fleetName, options) + }, nil) + if err != nil { + return FleetspacesClientListByFleetResponse{}, err + } + return client.listByFleetHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByFleetCreateRequest creates the ListByFleet request. +func (client *FleetspacesClient) listByFleetCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, options *FleetspacesClientListByFleetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(*options.Skip, 10)) + } + if options != nil && options.Skiptoken != nil { + reqQP.Set("$skiptoken", *options.Skiptoken) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(*options.Top, 10)) + } + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByFleetHandleResponse handles the ListByFleet response. +func (client *FleetspacesClient) listByFleetHandleResponse(resp *http.Response) (FleetspacesClientListByFleetResponse, error) { + result := FleetspacesClientListByFleetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FleetspaceListResult); err != nil { + return FleetspacesClientListByFleetResponse{}, err + } + return result, nil +} + +// BeginRegisterServer - Migrates an existing logical server into fleet. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - body - The details of the register server operation. +// - options - FleetspacesClientBeginRegisterServerOptions contains the optional parameters for the FleetspacesClient.BeginRegisterServer +// method. +func (client *FleetspacesClient) BeginRegisterServer(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, body RegisterServerProperties, options *FleetspacesClientBeginRegisterServerOptions) (*runtime.Poller[FleetspacesClientRegisterServerResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.registerServer(ctx, resourceGroupName, fleetName, fleetspaceName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetspacesClientRegisterServerResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetspacesClientRegisterServerResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// RegisterServer - Migrates an existing logical server into fleet. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetspacesClient) registerServer(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, body RegisterServerProperties, options *FleetspacesClientBeginRegisterServerOptions) (*http.Response, error) { + var err error + const operationName = "FleetspacesClient.BeginRegisterServer" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.registerServerCreateRequest(ctx, resourceGroupName, fleetName, fleetspaceName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// registerServerCreateRequest creates the RegisterServer request. +func (client *FleetspacesClient) registerServerCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, body RegisterServerProperties, _ *FleetspacesClientBeginRegisterServerOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/registerServer" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginUnregister - Unregisters all databases from a fleetspace +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - options - FleetspacesClientBeginUnregisterOptions contains the optional parameters for the FleetspacesClient.BeginUnregister +// method. +func (client *FleetspacesClient) BeginUnregister(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, options *FleetspacesClientBeginUnregisterOptions) (*runtime.Poller[FleetspacesClientUnregisterResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.unregister(ctx, resourceGroupName, fleetName, fleetspaceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetspacesClientUnregisterResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetspacesClientUnregisterResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Unregister - Unregisters all databases from a fleetspace +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetspacesClient) unregister(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, options *FleetspacesClientBeginUnregisterOptions) (*http.Response, error) { + var err error + const operationName = "FleetspacesClient.BeginUnregister" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.unregisterCreateRequest(ctx, resourceGroupName, fleetName, fleetspaceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// unregisterCreateRequest creates the Unregister request. +func (client *FleetspacesClient) unregisterCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, _ *FleetspacesClientBeginUnregisterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/unregister" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginUpdate - Modifies a fleetspace resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - properties - The resource properties to be updated. +// - options - FleetspacesClientBeginUpdateOptions contains the optional parameters for the FleetspacesClient.BeginUpdate method. +func (client *FleetspacesClient) BeginUpdate(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, properties Fleetspace, options *FleetspacesClientBeginUpdateOptions) (*runtime.Poller[FleetspacesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, fleetName, fleetspaceName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetspacesClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetspacesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Modifies a fleetspace resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetspacesClient) update(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, properties Fleetspace, options *FleetspacesClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "FleetspacesClient.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, fleetName, fleetspaceName, properties, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *FleetspacesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, properties Fleetspace, _ *FleetspacesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleettiers_client.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleettiers_client.go new file mode 100644 index 000000000000..5c52ec5d8adc --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleettiers_client.go @@ -0,0 +1,506 @@ +// 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 armdatabasefleetmanager + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// FleetTiersClient contains the methods for the FleetTiers group. +// Don't use this type directly, use NewFleetTiersClient() instead. +type FleetTiersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewFleetTiersClient creates a new instance of FleetTiersClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewFleetTiersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FleetTiersClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FleetTiersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a tier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - tierName - Name of the tier. +// - resource - The tier object to create or update. +// - options - FleetTiersClientBeginCreateOrUpdateOptions contains the optional parameters for the FleetTiersClient.BeginCreateOrUpdate +// method. +func (client *FleetTiersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, tierName string, resource FleetTier, options *FleetTiersClientBeginCreateOrUpdateOptions) (*runtime.Poller[FleetTiersClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, fleetName, tierName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetTiersClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetTiersClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates a tier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetTiersClient) createOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, tierName string, resource FleetTier, options *FleetTiersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "FleetTiersClient.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, fleetName, tierName, resource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *FleetTiersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, tierName string, resource FleetTier, _ *FleetTiersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/tiers/{tierName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if tierName == "" { + return nil, errors.New("parameter tierName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tierName}", url.PathEscape(tierName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a tier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - tierName - Name of the tier. +// - options - FleetTiersClientBeginDeleteOptions contains the optional parameters for the FleetTiersClient.BeginDelete method. +func (client *FleetTiersClient) BeginDelete(ctx context.Context, resourceGroupName string, fleetName string, tierName string, options *FleetTiersClientBeginDeleteOptions) (*runtime.Poller[FleetTiersClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, fleetName, tierName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetTiersClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetTiersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a tier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetTiersClient) deleteOperation(ctx context.Context, resourceGroupName string, fleetName string, tierName string, options *FleetTiersClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "FleetTiersClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, fleetName, tierName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *FleetTiersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, tierName string, _ *FleetTiersClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/tiers/{tierName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if tierName == "" { + return nil, errors.New("parameter tierName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tierName}", url.PathEscape(tierName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Disable - Disables a tier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - tierName - Name of the tier. +// - options - FleetTiersClientDisableOptions contains the optional parameters for the FleetTiersClient.Disable method. +func (client *FleetTiersClient) Disable(ctx context.Context, resourceGroupName string, fleetName string, tierName string, options *FleetTiersClientDisableOptions) (FleetTiersClientDisableResponse, error) { + var err error + const operationName = "FleetTiersClient.Disable" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.disableCreateRequest(ctx, resourceGroupName, fleetName, tierName, options) + if err != nil { + return FleetTiersClientDisableResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FleetTiersClientDisableResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FleetTiersClientDisableResponse{}, err + } + resp, err := client.disableHandleResponse(httpResp) + return resp, err +} + +// disableCreateRequest creates the Disable request. +func (client *FleetTiersClient) disableCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, tierName string, _ *FleetTiersClientDisableOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/tiers/{tierName}/disable" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if tierName == "" { + return nil, errors.New("parameter tierName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tierName}", url.PathEscape(tierName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// disableHandleResponse handles the Disable response. +func (client *FleetTiersClient) disableHandleResponse(resp *http.Response) (FleetTiersClientDisableResponse, error) { + result := FleetTiersClientDisableResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FleetTier); err != nil { + return FleetTiersClientDisableResponse{}, err + } + return result, nil +} + +// Get - Gets a tier resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - tierName - Name of the tier. +// - options - FleetTiersClientGetOptions contains the optional parameters for the FleetTiersClient.Get method. +func (client *FleetTiersClient) Get(ctx context.Context, resourceGroupName string, fleetName string, tierName string, options *FleetTiersClientGetOptions) (FleetTiersClientGetResponse, error) { + var err error + const operationName = "FleetTiersClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, fleetName, tierName, options) + if err != nil { + return FleetTiersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FleetTiersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FleetTiersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *FleetTiersClient) getCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, tierName string, _ *FleetTiersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/tiers/{tierName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if tierName == "" { + return nil, errors.New("parameter tierName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tierName}", url.PathEscape(tierName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FleetTiersClient) getHandleResponse(resp *http.Response) (FleetTiersClientGetResponse, error) { + result := FleetTiersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FleetTier); err != nil { + return FleetTiersClientGetResponse{}, err + } + return result, nil +} + +// NewListByFleetPager - List tiers in a fleet. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - options - FleetTiersClientListByFleetOptions contains the optional parameters for the FleetTiersClient.NewListByFleetPager +// method. +func (client *FleetTiersClient) NewListByFleetPager(resourceGroupName string, fleetName string, options *FleetTiersClientListByFleetOptions) *runtime.Pager[FleetTiersClientListByFleetResponse] { + return runtime.NewPager(runtime.PagingHandler[FleetTiersClientListByFleetResponse]{ + More: func(page FleetTiersClientListByFleetResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FleetTiersClientListByFleetResponse) (FleetTiersClientListByFleetResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "FleetTiersClient.NewListByFleetPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByFleetCreateRequest(ctx, resourceGroupName, fleetName, options) + }, nil) + if err != nil { + return FleetTiersClientListByFleetResponse{}, err + } + return client.listByFleetHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByFleetCreateRequest creates the ListByFleet request. +func (client *FleetTiersClient) listByFleetCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, options *FleetTiersClientListByFleetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/tiers" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(*options.Skip, 10)) + } + if options != nil && options.Skiptoken != nil { + reqQP.Set("$skiptoken", *options.Skiptoken) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(*options.Top, 10)) + } + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByFleetHandleResponse handles the ListByFleet response. +func (client *FleetTiersClient) listByFleetHandleResponse(resp *http.Response) (FleetTiersClientListByFleetResponse, error) { + result := FleetTiersClientListByFleetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FleetTierListResult); err != nil { + return FleetTiersClientListByFleetResponse{}, err + } + return result, nil +} + +// BeginUpdate - Updates a tier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - tierName - Name of the tier. +// - properties - The resource properties to be updated. +// - options - FleetTiersClientBeginUpdateOptions contains the optional parameters for the FleetTiersClient.BeginUpdate method. +func (client *FleetTiersClient) BeginUpdate(ctx context.Context, resourceGroupName string, fleetName string, tierName string, properties FleetTier, options *FleetTiersClientBeginUpdateOptions) (*runtime.Poller[FleetTiersClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, fleetName, tierName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetTiersClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetTiersClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Updates a tier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetTiersClient) update(ctx context.Context, resourceGroupName string, fleetName string, tierName string, properties FleetTier, options *FleetTiersClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "FleetTiersClient.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, fleetName, tierName, properties, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *FleetTiersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, tierName string, properties FleetTier, _ *FleetTiersClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/tiers/{tierName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if tierName == "" { + return nil, errors.New("parameter tierName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tierName}", url.PathEscape(tierName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/go.mod b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/go.mod new file mode 100644 index 000000000000..c66623035b1a --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/go.mod @@ -0,0 +1,13 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager + +go 1.23.0 + +toolchain go1.23.8 + +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect + golang.org/x/net v0.37.0 // indirect + golang.org/x/text v0.23.0 // indirect +) diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/go.sum b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/go.sum new file mode 100644 index 000000000000..cfff861c9769 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/go.sum @@ -0,0 +1,16 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 h1:DSDNVxqkoXJiko6x8a90zidoYqnYYa6c1MTzDKzKkTo= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1/go.mod h1:zGqV2R4Cr/k8Uye5w+dgQ06WJtEcbQG/8J7BB6hnCr4= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c= +golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= +golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= +golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/models.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/models.go new file mode 100644 index 000000000000..64d16da8841d --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/models.go @@ -0,0 +1,452 @@ +// 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 armdatabasefleetmanager + +import "time" + +// DatabaseChangeTierProperties - A database change tier definition. +type DatabaseChangeTierProperties struct { + // A target tier name. + TargetTierName *string +} + +// DatabaseIdentity - Database Identity properties. +type DatabaseIdentity struct { + // Client Id of the database identity. + ClientID *string + + // Principal Id of the database identity. + PrincipalID *string + + // Resource Id of the database identity. + ResourceID *string +} + +// DatabaseRenameProperties - A database rename definition. +type DatabaseRenameProperties struct { + // New database name. + NewName *string +} + +// DestinationTierOverride - A destination tier override. +type DestinationTierOverride struct { + // REQUIRED; Resource name. + ResourceName *string + + // REQUIRED; Resource type. + ResourceType *ResourceType + + // REQUIRED; Destination tier name. + TierName *string +} + +// FirewallRule - A firewall rule. +type FirewallRule struct { + // A Firewall rule properties. + Properties *FirewallRuleProperties + + // 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 + 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 +} + +// FirewallRuleListResult - The response of a FirewallRule list operation. +type FirewallRuleListResult struct { + // REQUIRED; The FirewallRule items on this page + Value []*FirewallRule + + // The link to the next page of items + NextLink *string +} + +// FirewallRuleProperties - A Firewall rule properties. +type FirewallRuleProperties struct { + // End IP address. + EndIPAddress *string + + // Start IP address. + StartIPAddress *string + + // READ-ONLY; Provisioning state. + ProvisioningState *AzureProvisioningState +} + +// Fleet - A Database Fleet. +type Fleet struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The fleet properties. + Properties *FleetProperties + + // Resource tags. + Tags map[string]*string + + // 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 + 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 +} + +// FleetDatabase - A fleet database. +type FleetDatabase struct { + // Fleet database properties. + Properties *FleetDatabaseProperties + + // 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 + 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 +} + +// FleetDatabaseListResult - The response of a FleetDatabase list operation. +type FleetDatabaseListResult struct { + // REQUIRED; The FleetDatabase items on this page + Value []*FleetDatabase + + // The link to the next page of items + NextLink *string +} + +// FleetDatabaseProperties - Fleet database properties. +type FleetDatabaseProperties struct { + // Database collation. + Collation *string + + // Create mode. Available options: Default - Create a database. Copy - Copy the source database (source database name must + // be specified) PointInTimeRestore - Create a database by restoring source + // database from a point in time (source database name and restore from time must be specified) + CreateMode *DatabaseCreateMode + + // Identity property. + Identity *Identity + + // Additional database properties to be applied as the underlying database resource tags. + ResourceTags map[string]*string + + // Restore from time when CreateMode is PointInTimeRestore. + RestoreFromTime *time.Time + + // Source database name used when CreateMode is Copy or PointInTimeRestore. + SourceDatabaseName *string + + // Name of the tier this database belongs to. + TierName *string + + // Transparent Data Encryption properties + TransparentDataEncryption *TransparentDataEncryption + + // READ-ONLY; Backup retention in days. + BackupRetentionDays *int32 + + // READ-ONLY; Connection string to connect to the database with. + ConnectionString *string + + // READ-ONLY; Maximum database size in Gb. + DatabaseSizeGbMax *int32 + + // READ-ONLY; Earliest restore time. + EarliestRestoreTime *time.Time + + // READ-ONLY; Latest restore time. + LatestRestoreTime *time.Time + + // READ-ONLY; Resource identifier for the underlying database resource. + OriginalDatabaseID *string + + // READ-ONLY; Database state. + ProvisioningState *AzureProvisioningState + + // READ-ONLY; If true, database is recoverable. + Recoverable *bool +} + +// FleetListResult - The response of a Fleet list operation. +type FleetListResult struct { + // REQUIRED; The Fleet items on this page + Value []*Fleet + + // The link to the next page of items + NextLink *string +} + +// FleetProperties - The Database Fleet properties. +type FleetProperties struct { + // Fleet description. + Description *string + + // READ-ONLY; Provisioning state. + ProvisioningState *AzureProvisioningState +} + +// FleetTier - A SQL Database Fleet tier. +type FleetTier struct { + // A Fleet tier properties. + Properties *FleetTierProperties + + // 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 + 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 +} + +// FleetTierListResult - The response of a FleetTier list operation. +type FleetTierListResult struct { + // REQUIRED; The FleetTier items on this page + Value []*FleetTier + + // The link to the next page of items + NextLink *string +} + +// FleetTierProperties - A Fleet tier properties. +type FleetTierProperties struct { + // Capacity of provisioned resources in the tier, in units matching the specified service tier, for example vCore for GeneralPurpose. + Capacity *int32 + + // Maximum allocated capacity per database, in units matching the specified service tier. + DatabaseCapacityMax *float64 + + // Minimum allocated capacity per database, in units matching the specified service tier. + DatabaseCapacityMin *float64 + + // Maximum database size in Gb. + DatabaseSizeGbMax *int32 + + // Family of provisioned resources, for example Gen5. + Family *string + + // Number of high availability replicas for databases in this tier. + HighAvailabilityReplicaCount *int32 + + // Maximum number of databases per pool. + PoolNumOfDatabasesMax *int32 + + // If true, databases are pooled. + Pooled *bool + + // If true, serverless resources are provisioned in the tier. + Serverless *bool + + // Service tier of provisioned resources. Supported values: GeneralPurpose, Hyperscale. + ServiceTier *string + + // Enable zone redundancy for all databases in this tier. + ZoneRedundancy *ZoneRedundancy + + // READ-ONLY; If true, tier is disabled. + Disabled *bool + + // READ-ONLY; Provisioning state. + ProvisioningState *AzureProvisioningState +} + +// FleetUpdate - An update to a Database Fleet. +type FleetUpdate struct { + // The Database Fleet properties. + Properties *FleetProperties + + // Resource tags. + Tags map[string]*string +} + +// Fleetspace - A fleetspace. +type Fleetspace struct { + // A Fleetspace properties. + Properties *FleetspaceProperties + + // 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 + 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 +} + +// FleetspaceListResult - The response of a Fleetspace list operation. +type FleetspaceListResult struct { + // REQUIRED; The Fleetspace items on this page + Value []*Fleetspace + + // The link to the next page of items + NextLink *string +} + +// FleetspaceProperties - A Fleetspace properties. +type FleetspaceProperties struct { + // Maximum number of vCores database fleet manager is allowed to provision in the fleetspace. + CapacityMax *int32 + + // Main Microsoft Entra ID principal that has admin access to all databases in the fleetspace. + MainPrincipal *MainPrincipal + + // READ-ONLY; Fleetspace state. + ProvisioningState *AzureProvisioningState +} + +// Identity - Database Identity. +type Identity struct { + // The federated client id for the SQL Database. It is used for cross tenant CMK scenario. + FederatedClientID *string + + // Identity type of the main principal. + IdentityType *IdentityType + + // User identity ids + UserAssignedIdentities []*DatabaseIdentity +} + +// MainPrincipal - A main principal. +type MainPrincipal struct { + // Application Id of the main principal. + ApplicationID *string + + // Login name of the main principal. + Login *string + + // Object Id of the main principal. + ObjectID *string + + // Principal type of the main principal. + PrincipalType *PrincipalType + + // Tenant Id of the main principal. + TenantID *string +} + +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane + // operations. + IsDataAction *bool + + // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", + // "Microsoft.Compute/virtualMachines/capture/action" + Name *string + + // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + // value is "user,system" + Origin *Origin +} + +// OperationDisplay - Localized display information for this particular operation. +type OperationDisplay struct { + // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. + Description *string + + // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + // Machine", "Restart Virtual Machine". + Operation *string + + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". + Provider *string + + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". + Resource *string +} + +// OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to +// get the next set of results. +type OperationListResult struct { + // READ-ONLY; URL to get the next set of operation list results (if there are any). + NextLink *string + + // READ-ONLY; List of operations supported by the resource provider + Value []*Operation +} + +// RegisterServerProperties - Server registration definition. +type RegisterServerProperties struct { + // Destination tier overrides. + DestinationTierOverrides []*DestinationTierOverride + + // Source resource group name. + SourceResourceGroupName *string + + // Source SQL Server name. + SourceServerName *string + + // Source subscription id. + SourceSubscriptionID *string + + // Destination tier name. + TierName *string +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time + + // The identity that created the resource. + CreatedBy *string + + // The type of identity that created the resource. + CreatedByType *CreatedByType + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time + + // The identity that last modified the resource. + LastModifiedBy *string + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType +} + +// TransparentDataEncryption - Transparent Data Encryption properties. +type TransparentDataEncryption struct { + // Enable key auto rotation + EnableAutoRotation *bool + + // Customer Managed Key (CMK) Uri. + KeyURI *string + + // Additional Keys + Keys []*string +} diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/models_serde.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/models_serde.go new file mode 100644 index 000000000000..d494f03bd632 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/models_serde.go @@ -0,0 +1,1145 @@ +// 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 armdatabasefleetmanager + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type DatabaseChangeTierProperties. +func (d DatabaseChangeTierProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "targetTierName", d.TargetTierName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseChangeTierProperties. +func (d *DatabaseChangeTierProperties) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "targetTierName": + err = unpopulate(val, "TargetTierName", &d.TargetTierName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabaseIdentity. +func (d DatabaseIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", d.ClientID) + populate(objectMap, "principalId", d.PrincipalID) + populate(objectMap, "resourceId", d.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseIdentity. +func (d *DatabaseIdentity) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &d.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &d.PrincipalID) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &d.ResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabaseRenameProperties. +func (d DatabaseRenameProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "newName", d.NewName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseRenameProperties. +func (d *DatabaseRenameProperties) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "newName": + err = unpopulate(val, "NewName", &d.NewName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DestinationTierOverride. +func (d DestinationTierOverride) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "resourceName", d.ResourceName) + populate(objectMap, "resourceType", d.ResourceType) + populate(objectMap, "tierName", d.TierName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DestinationTierOverride. +func (d *DestinationTierOverride) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "resourceName": + err = unpopulate(val, "ResourceName", &d.ResourceName) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &d.ResourceType) + delete(rawMsg, key) + case "tierName": + err = unpopulate(val, "TierName", &d.TierName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallRule. +func (f FirewallRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", f.ID) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallRule. +func (f *FirewallRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallRuleListResult. +func (f FirewallRuleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallRuleListResult. +func (f *FirewallRuleListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallRuleProperties. +func (f FirewallRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "endIpAddress", f.EndIPAddress) + populate(objectMap, "provisioningState", f.ProvisioningState) + populate(objectMap, "startIpAddress", f.StartIPAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallRuleProperties. +func (f *FirewallRuleProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endIpAddress": + err = unpopulate(val, "EndIPAddress", &f.EndIPAddress) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &f.ProvisioningState) + delete(rawMsg, key) + case "startIpAddress": + err = unpopulate(val, "StartIPAddress", &f.StartIPAddress) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Fleet. +func (f Fleet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", f.ID) + populate(objectMap, "location", f.Location) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "tags", f.Tags) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Fleet. +func (f *Fleet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &f.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &f.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FleetDatabase. +func (f FleetDatabase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", f.ID) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetDatabase. +func (f *FleetDatabase) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FleetDatabaseListResult. +func (f FleetDatabaseListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetDatabaseListResult. +func (f *FleetDatabaseListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FleetDatabaseProperties. +func (f FleetDatabaseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "backupRetentionDays", f.BackupRetentionDays) + populate(objectMap, "collation", f.Collation) + populate(objectMap, "connectionString", f.ConnectionString) + populate(objectMap, "createMode", f.CreateMode) + populate(objectMap, "databaseSizeGbMax", f.DatabaseSizeGbMax) + populateDateTimeRFC3339(objectMap, "earliestRestoreTime", f.EarliestRestoreTime) + populate(objectMap, "identity", f.Identity) + populateDateTimeRFC3339(objectMap, "latestRestoreTime", f.LatestRestoreTime) + populate(objectMap, "originalDatabaseId", f.OriginalDatabaseID) + populate(objectMap, "provisioningState", f.ProvisioningState) + populate(objectMap, "recoverable", f.Recoverable) + populate(objectMap, "resourceTags", f.ResourceTags) + populateDateTimeRFC3339(objectMap, "restoreFromTime", f.RestoreFromTime) + populate(objectMap, "sourceDatabaseName", f.SourceDatabaseName) + populate(objectMap, "tierName", f.TierName) + populate(objectMap, "transparentDataEncryption", f.TransparentDataEncryption) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetDatabaseProperties. +func (f *FleetDatabaseProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupRetentionDays": + err = unpopulate(val, "BackupRetentionDays", &f.BackupRetentionDays) + delete(rawMsg, key) + case "collation": + err = unpopulate(val, "Collation", &f.Collation) + delete(rawMsg, key) + case "connectionString": + err = unpopulate(val, "ConnectionString", &f.ConnectionString) + delete(rawMsg, key) + case "createMode": + err = unpopulate(val, "CreateMode", &f.CreateMode) + delete(rawMsg, key) + case "databaseSizeGbMax": + err = unpopulate(val, "DatabaseSizeGbMax", &f.DatabaseSizeGbMax) + delete(rawMsg, key) + case "earliestRestoreTime": + err = unpopulateDateTimeRFC3339(val, "EarliestRestoreTime", &f.EarliestRestoreTime) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &f.Identity) + delete(rawMsg, key) + case "latestRestoreTime": + err = unpopulateDateTimeRFC3339(val, "LatestRestoreTime", &f.LatestRestoreTime) + delete(rawMsg, key) + case "originalDatabaseId": + err = unpopulate(val, "OriginalDatabaseID", &f.OriginalDatabaseID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &f.ProvisioningState) + delete(rawMsg, key) + case "recoverable": + err = unpopulate(val, "Recoverable", &f.Recoverable) + delete(rawMsg, key) + case "resourceTags": + err = unpopulate(val, "ResourceTags", &f.ResourceTags) + delete(rawMsg, key) + case "restoreFromTime": + err = unpopulateDateTimeRFC3339(val, "RestoreFromTime", &f.RestoreFromTime) + delete(rawMsg, key) + case "sourceDatabaseName": + err = unpopulate(val, "SourceDatabaseName", &f.SourceDatabaseName) + delete(rawMsg, key) + case "tierName": + err = unpopulate(val, "TierName", &f.TierName) + delete(rawMsg, key) + case "transparentDataEncryption": + err = unpopulate(val, "TransparentDataEncryption", &f.TransparentDataEncryption) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FleetListResult. +func (f FleetListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetListResult. +func (f *FleetListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FleetProperties. +func (f FleetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", f.Description) + populate(objectMap, "provisioningState", f.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetProperties. +func (f *FleetProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &f.Description) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &f.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FleetTier. +func (f FleetTier) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", f.ID) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetTier. +func (f *FleetTier) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FleetTierListResult. +func (f FleetTierListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetTierListResult. +func (f *FleetTierListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FleetTierProperties. +func (f FleetTierProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capacity", f.Capacity) + populate(objectMap, "databaseCapacityMax", f.DatabaseCapacityMax) + populate(objectMap, "databaseCapacityMin", f.DatabaseCapacityMin) + populate(objectMap, "databaseSizeGbMax", f.DatabaseSizeGbMax) + populate(objectMap, "disabled", f.Disabled) + populate(objectMap, "family", f.Family) + populate(objectMap, "highAvailabilityReplicaCount", f.HighAvailabilityReplicaCount) + populate(objectMap, "poolNumOfDatabasesMax", f.PoolNumOfDatabasesMax) + populate(objectMap, "pooled", f.Pooled) + populate(objectMap, "provisioningState", f.ProvisioningState) + populate(objectMap, "serverless", f.Serverless) + populate(objectMap, "serviceTier", f.ServiceTier) + populate(objectMap, "zoneRedundancy", f.ZoneRedundancy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetTierProperties. +func (f *FleetTierProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capacity": + err = unpopulate(val, "Capacity", &f.Capacity) + delete(rawMsg, key) + case "databaseCapacityMax": + err = unpopulate(val, "DatabaseCapacityMax", &f.DatabaseCapacityMax) + delete(rawMsg, key) + case "databaseCapacityMin": + err = unpopulate(val, "DatabaseCapacityMin", &f.DatabaseCapacityMin) + delete(rawMsg, key) + case "databaseSizeGbMax": + err = unpopulate(val, "DatabaseSizeGbMax", &f.DatabaseSizeGbMax) + delete(rawMsg, key) + case "disabled": + err = unpopulate(val, "Disabled", &f.Disabled) + delete(rawMsg, key) + case "family": + err = unpopulate(val, "Family", &f.Family) + delete(rawMsg, key) + case "highAvailabilityReplicaCount": + err = unpopulate(val, "HighAvailabilityReplicaCount", &f.HighAvailabilityReplicaCount) + delete(rawMsg, key) + case "poolNumOfDatabasesMax": + err = unpopulate(val, "PoolNumOfDatabasesMax", &f.PoolNumOfDatabasesMax) + delete(rawMsg, key) + case "pooled": + err = unpopulate(val, "Pooled", &f.Pooled) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &f.ProvisioningState) + delete(rawMsg, key) + case "serverless": + err = unpopulate(val, "Serverless", &f.Serverless) + delete(rawMsg, key) + case "serviceTier": + err = unpopulate(val, "ServiceTier", &f.ServiceTier) + delete(rawMsg, key) + case "zoneRedundancy": + err = unpopulate(val, "ZoneRedundancy", &f.ZoneRedundancy) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FleetUpdate. +func (f FleetUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "tags", f.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetUpdate. +func (f *FleetUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &f.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Fleetspace. +func (f Fleetspace) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", f.ID) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Fleetspace. +func (f *Fleetspace) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FleetspaceListResult. +func (f FleetspaceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetspaceListResult. +func (f *FleetspaceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FleetspaceProperties. +func (f FleetspaceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capacityMax", f.CapacityMax) + populate(objectMap, "mainPrincipal", f.MainPrincipal) + populate(objectMap, "provisioningState", f.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetspaceProperties. +func (f *FleetspaceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capacityMax": + err = unpopulate(val, "CapacityMax", &f.CapacityMax) + delete(rawMsg, key) + case "mainPrincipal": + err = unpopulate(val, "MainPrincipal", &f.MainPrincipal) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &f.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "federatedClientId", i.FederatedClientID) + populate(objectMap, "identityType", i.IdentityType) + populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Identity. +func (i *Identity) 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", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "federatedClientId": + err = unpopulate(val, "FederatedClientID", &i.FederatedClientID) + delete(rawMsg, key) + case "identityType": + err = unpopulate(val, "IdentityType", &i.IdentityType) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &i.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MainPrincipal. +func (m MainPrincipal) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "applicationId", m.ApplicationID) + populate(objectMap, "login", m.Login) + populate(objectMap, "objectId", m.ObjectID) + populate(objectMap, "principalType", m.PrincipalType) + populate(objectMap, "tenantId", m.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MainPrincipal. +func (m *MainPrincipal) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applicationId": + err = unpopulate(val, "ApplicationID", &m.ApplicationID) + delete(rawMsg, key) + case "login": + err = unpopulate(val, "Login", &m.Login) + delete(rawMsg, key) + case "objectId": + err = unpopulate(val, "ObjectID", &m.ObjectID) + delete(rawMsg, key) + case "principalType": + err = unpopulate(val, "PrincipalType", &m.PrincipalType) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RegisterServerProperties. +func (r RegisterServerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "destinationTierOverrides", r.DestinationTierOverrides) + populate(objectMap, "sourceResourceGroupName", r.SourceResourceGroupName) + populate(objectMap, "sourceServerName", r.SourceServerName) + populate(objectMap, "sourceSubscriptionId", r.SourceSubscriptionID) + populate(objectMap, "tierName", r.TierName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegisterServerProperties. +func (r *RegisterServerProperties) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destinationTierOverrides": + err = unpopulate(val, "DestinationTierOverrides", &r.DestinationTierOverrides) + delete(rawMsg, key) + case "sourceResourceGroupName": + err = unpopulate(val, "SourceResourceGroupName", &r.SourceResourceGroupName) + delete(rawMsg, key) + case "sourceServerName": + err = unpopulate(val, "SourceServerName", &r.SourceServerName) + delete(rawMsg, key) + case "sourceSubscriptionId": + err = unpopulate(val, "SourceSubscriptionID", &r.SourceSubscriptionID) + delete(rawMsg, key) + case "tierName": + err = unpopulate(val, "TierName", &r.TierName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TransparentDataEncryption. +func (t TransparentDataEncryption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enableAutoRotation", t.EnableAutoRotation) + populate(objectMap, "keyUri", t.KeyURI) + populate(objectMap, "keys", t.Keys) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TransparentDataEncryption. +func (t *TransparentDataEncryption) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "enableAutoRotation": + err = unpopulate(val, "EnableAutoRotation", &t.EnableAutoRotation) + delete(rawMsg, key) + case "keyUri": + err = unpopulate(val, "KeyURI", &t.KeyURI) + delete(rawMsg, key) + case "keys": + err = unpopulate(val, "Keys", &t.Keys) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil || string(data) == "null" { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/operations_client.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/operations_client.go new file mode 100644 index 000000000000..7d9b3400606b --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/operations_client.go @@ -0,0 +1,85 @@ +// 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 armdatabasefleetmanager + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + internal *arm.Client +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - List the operations for the provider +// +// Generated from API version 2025-02-01-preview +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return OperationsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.DatabaseFleetManager/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { + result := OperationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { + return OperationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/options.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/options.go new file mode 100644 index 000000000000..c4eb94f0d57f --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/options.go @@ -0,0 +1,232 @@ +// 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 armdatabasefleetmanager + +// FirewallRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the FirewallRulesClient.BeginCreateOrUpdate +// method. +type FirewallRulesClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FirewallRulesClientBeginDeleteOptions contains the optional parameters for the FirewallRulesClient.BeginDelete method. +type FirewallRulesClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FirewallRulesClientGetOptions contains the optional parameters for the FirewallRulesClient.Get method. +type FirewallRulesClientGetOptions struct { + // placeholder for future optional parameters +} + +// FirewallRulesClientListByFleetspaceOptions contains the optional parameters for the FirewallRulesClient.NewListByFleetspacePager +// method. +type FirewallRulesClientListByFleetspaceOptions struct { + // The number of elements in the collection to skip. + Skip *int64 + + // An opaque token that identifies a starting point in the collection. + Skiptoken *string + + // The number of elements to return from the collection. + Top *int64 +} + +// FleetDatabasesClientBeginChangeTierOptions contains the optional parameters for the FleetDatabasesClient.BeginChangeTier +// method. +type FleetDatabasesClientBeginChangeTierOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetDatabasesClientBeginCreateOrUpdateOptions contains the optional parameters for the FleetDatabasesClient.BeginCreateOrUpdate +// method. +type FleetDatabasesClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetDatabasesClientBeginDeleteOptions contains the optional parameters for the FleetDatabasesClient.BeginDelete method. +type FleetDatabasesClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetDatabasesClientBeginRenameOptions contains the optional parameters for the FleetDatabasesClient.BeginRename method. +type FleetDatabasesClientBeginRenameOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetDatabasesClientBeginRevertOptions contains the optional parameters for the FleetDatabasesClient.BeginRevert method. +type FleetDatabasesClientBeginRevertOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetDatabasesClientBeginUpdateOptions contains the optional parameters for the FleetDatabasesClient.BeginUpdate method. +type FleetDatabasesClientBeginUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetDatabasesClientGetOptions contains the optional parameters for the FleetDatabasesClient.Get method. +type FleetDatabasesClientGetOptions struct { + // placeholder for future optional parameters +} + +// FleetDatabasesClientListByFleetspaceOptions contains the optional parameters for the FleetDatabasesClient.NewListByFleetspacePager +// method. +type FleetDatabasesClientListByFleetspaceOptions struct { + // An OData filter expression that filters elements in the collection. + Filter *string + + // The number of elements in the collection to skip. + Skip *int64 + + // An opaque token that identifies a starting point in the collection. + Skiptoken *string + + // The number of elements to return from the collection. + Top *int64 +} + +// FleetTiersClientBeginCreateOrUpdateOptions contains the optional parameters for the FleetTiersClient.BeginCreateOrUpdate +// method. +type FleetTiersClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetTiersClientBeginDeleteOptions contains the optional parameters for the FleetTiersClient.BeginDelete method. +type FleetTiersClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetTiersClientBeginUpdateOptions contains the optional parameters for the FleetTiersClient.BeginUpdate method. +type FleetTiersClientBeginUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetTiersClientDisableOptions contains the optional parameters for the FleetTiersClient.Disable method. +type FleetTiersClientDisableOptions struct { + // placeholder for future optional parameters +} + +// FleetTiersClientGetOptions contains the optional parameters for the FleetTiersClient.Get method. +type FleetTiersClientGetOptions struct { + // placeholder for future optional parameters +} + +// FleetTiersClientListByFleetOptions contains the optional parameters for the FleetTiersClient.NewListByFleetPager method. +type FleetTiersClientListByFleetOptions struct { + // The number of elements in the collection to skip. + Skip *int64 + + // An opaque token that identifies a starting point in the collection. + Skiptoken *string + + // The number of elements to return from the collection. + Top *int64 +} + +// FleetsClientBeginCreateOrUpdateOptions contains the optional parameters for the FleetsClient.BeginCreateOrUpdate method. +type FleetsClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetsClientBeginDeleteOptions contains the optional parameters for the FleetsClient.BeginDelete method. +type FleetsClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetsClientBeginUpdateOptions contains the optional parameters for the FleetsClient.BeginUpdate method. +type FleetsClientBeginUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetsClientGetOptions contains the optional parameters for the FleetsClient.Get method. +type FleetsClientGetOptions struct { + // placeholder for future optional parameters +} + +// FleetsClientListByResourceGroupOptions contains the optional parameters for the FleetsClient.NewListByResourceGroupPager +// method. +type FleetsClientListByResourceGroupOptions struct { + // The number of elements in the collection to skip. + Skip *int64 + + // An opaque token that identifies a starting point in the collection. + Skiptoken *string + + // The number of elements to return from the collection. + Top *int64 +} + +// FleetsClientListOptions contains the optional parameters for the FleetsClient.NewListPager method. +type FleetsClientListOptions struct { + // placeholder for future optional parameters +} + +// FleetspacesClientBeginCreateOrUpdateOptions contains the optional parameters for the FleetspacesClient.BeginCreateOrUpdate +// method. +type FleetspacesClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetspacesClientBeginDeleteOptions contains the optional parameters for the FleetspacesClient.BeginDelete method. +type FleetspacesClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetspacesClientBeginRegisterServerOptions contains the optional parameters for the FleetspacesClient.BeginRegisterServer +// method. +type FleetspacesClientBeginRegisterServerOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetspacesClientBeginUnregisterOptions contains the optional parameters for the FleetspacesClient.BeginUnregister method. +type FleetspacesClientBeginUnregisterOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetspacesClientBeginUpdateOptions contains the optional parameters for the FleetspacesClient.BeginUpdate method. +type FleetspacesClientBeginUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetspacesClientGetOptions contains the optional parameters for the FleetspacesClient.Get method. +type FleetspacesClientGetOptions struct { + // placeholder for future optional parameters +} + +// FleetspacesClientListByFleetOptions contains the optional parameters for the FleetspacesClient.NewListByFleetPager method. +type FleetspacesClientListByFleetOptions struct { + // The number of elements in the collection to skip. + Skip *int64 + + // An opaque token that identifies a starting point in the collection. + Skiptoken *string + + // The number of elements to return from the collection. + Top *int64 +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/responses.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/responses.go new file mode 100644 index 000000000000..656163bf9fc9 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/responses.go @@ -0,0 +1,188 @@ +// 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 armdatabasefleetmanager + +// FirewallRulesClientCreateOrUpdateResponse contains the response from method FirewallRulesClient.BeginCreateOrUpdate. +type FirewallRulesClientCreateOrUpdateResponse struct { + // A firewall rule. + FirewallRule +} + +// FirewallRulesClientDeleteResponse contains the response from method FirewallRulesClient.BeginDelete. +type FirewallRulesClientDeleteResponse struct { + // placeholder for future response values +} + +// FirewallRulesClientGetResponse contains the response from method FirewallRulesClient.Get. +type FirewallRulesClientGetResponse struct { + // A firewall rule. + FirewallRule +} + +// FirewallRulesClientListByFleetspaceResponse contains the response from method FirewallRulesClient.NewListByFleetspacePager. +type FirewallRulesClientListByFleetspaceResponse struct { + // The response of a FirewallRule list operation. + FirewallRuleListResult +} + +// FleetDatabasesClientChangeTierResponse contains the response from method FleetDatabasesClient.BeginChangeTier. +type FleetDatabasesClientChangeTierResponse struct { + // placeholder for future response values +} + +// FleetDatabasesClientCreateOrUpdateResponse contains the response from method FleetDatabasesClient.BeginCreateOrUpdate. +type FleetDatabasesClientCreateOrUpdateResponse struct { + // A fleet database. + FleetDatabase +} + +// FleetDatabasesClientDeleteResponse contains the response from method FleetDatabasesClient.BeginDelete. +type FleetDatabasesClientDeleteResponse struct { + // placeholder for future response values +} + +// FleetDatabasesClientGetResponse contains the response from method FleetDatabasesClient.Get. +type FleetDatabasesClientGetResponse struct { + // A fleet database. + FleetDatabase +} + +// FleetDatabasesClientListByFleetspaceResponse contains the response from method FleetDatabasesClient.NewListByFleetspacePager. +type FleetDatabasesClientListByFleetspaceResponse struct { + // The response of a FleetDatabase list operation. + FleetDatabaseListResult +} + +// FleetDatabasesClientRenameResponse contains the response from method FleetDatabasesClient.BeginRename. +type FleetDatabasesClientRenameResponse struct { + // placeholder for future response values +} + +// FleetDatabasesClientRevertResponse contains the response from method FleetDatabasesClient.BeginRevert. +type FleetDatabasesClientRevertResponse struct { + // placeholder for future response values +} + +// FleetDatabasesClientUpdateResponse contains the response from method FleetDatabasesClient.BeginUpdate. +type FleetDatabasesClientUpdateResponse struct { + // A fleet database. + FleetDatabase +} + +// FleetTiersClientCreateOrUpdateResponse contains the response from method FleetTiersClient.BeginCreateOrUpdate. +type FleetTiersClientCreateOrUpdateResponse struct { + // A SQL Database Fleet tier. + FleetTier +} + +// FleetTiersClientDeleteResponse contains the response from method FleetTiersClient.BeginDelete. +type FleetTiersClientDeleteResponse struct { + // placeholder for future response values +} + +// FleetTiersClientDisableResponse contains the response from method FleetTiersClient.Disable. +type FleetTiersClientDisableResponse struct { + // A SQL Database Fleet tier. + FleetTier +} + +// FleetTiersClientGetResponse contains the response from method FleetTiersClient.Get. +type FleetTiersClientGetResponse struct { + // A SQL Database Fleet tier. + FleetTier +} + +// FleetTiersClientListByFleetResponse contains the response from method FleetTiersClient.NewListByFleetPager. +type FleetTiersClientListByFleetResponse struct { + // The response of a FleetTier list operation. + FleetTierListResult +} + +// FleetTiersClientUpdateResponse contains the response from method FleetTiersClient.BeginUpdate. +type FleetTiersClientUpdateResponse struct { + // A SQL Database Fleet tier. + FleetTier +} + +// FleetsClientCreateOrUpdateResponse contains the response from method FleetsClient.BeginCreateOrUpdate. +type FleetsClientCreateOrUpdateResponse struct { + // A Database Fleet. + Fleet +} + +// FleetsClientDeleteResponse contains the response from method FleetsClient.BeginDelete. +type FleetsClientDeleteResponse struct { + // placeholder for future response values +} + +// FleetsClientGetResponse contains the response from method FleetsClient.Get. +type FleetsClientGetResponse struct { + // A Database Fleet. + Fleet +} + +// FleetsClientListByResourceGroupResponse contains the response from method FleetsClient.NewListByResourceGroupPager. +type FleetsClientListByResourceGroupResponse struct { + // The response of a Fleet list operation. + FleetListResult +} + +// FleetsClientListResponse contains the response from method FleetsClient.NewListPager. +type FleetsClientListResponse struct { + // The response of a Fleet list operation. + FleetListResult +} + +// FleetsClientUpdateResponse contains the response from method FleetsClient.BeginUpdate. +type FleetsClientUpdateResponse struct { + // A Database Fleet. + Fleet +} + +// FleetspacesClientCreateOrUpdateResponse contains the response from method FleetspacesClient.BeginCreateOrUpdate. +type FleetspacesClientCreateOrUpdateResponse struct { + // A fleetspace. + Fleetspace +} + +// FleetspacesClientDeleteResponse contains the response from method FleetspacesClient.BeginDelete. +type FleetspacesClientDeleteResponse struct { + // placeholder for future response values +} + +// FleetspacesClientGetResponse contains the response from method FleetspacesClient.Get. +type FleetspacesClientGetResponse struct { + // A fleetspace. + Fleetspace +} + +// FleetspacesClientListByFleetResponse contains the response from method FleetspacesClient.NewListByFleetPager. +type FleetspacesClientListByFleetResponse struct { + // The response of a Fleetspace list operation. + FleetspaceListResult +} + +// FleetspacesClientRegisterServerResponse contains the response from method FleetspacesClient.BeginRegisterServer. +type FleetspacesClientRegisterServerResponse struct { + // placeholder for future response values +} + +// FleetspacesClientUnregisterResponse contains the response from method FleetspacesClient.BeginUnregister. +type FleetspacesClientUnregisterResponse struct { + // placeholder for future response values +} + +// FleetspacesClientUpdateResponse contains the response from method FleetspacesClient.BeginUpdate. +type FleetspacesClientUpdateResponse struct { + // A fleetspace. + Fleetspace +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + OperationListResult +} diff --git a/sdk/resourcemanager/avs/armavs/fake/time_rfc3339.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/time_rfc3339.go similarity index 97% rename from sdk/resourcemanager/avs/armavs/fake/time_rfc3339.go rename to sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/time_rfc3339.go index 81f308b0d343..818cf36f5bf5 100644 --- a/sdk/resourcemanager/avs/armavs/fake/time_rfc3339.go +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/time_rfc3339.go @@ -1,12 +1,9 @@ -//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 +package armdatabasefleetmanager import ( "encoding/json" @@ -60,6 +57,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string diff --git a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/CHANGELOG.md b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/CHANGELOG.md index deed2bfbe77c..250f256fa8a2 100644 --- a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/CHANGELOG.md +++ b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.0.1 (2025-04-27) +### Other Changes + + ## 1.0.0 (2024-07-15) ### Other Changes diff --git a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/autorest.md b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/autorest.md index 43240580a538..d2f32dbee3a1 100644 --- a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/autorest.md +++ b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/informatica/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/informatica/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 -tag: package-2024-05-08 +module-version: 1.0.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/client_factory.go b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/client_factory.go index 10d93a3bb05f..c7d1c4f31c41 100644 --- a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/client_factory.go +++ b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/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. diff --git a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/constants.go b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/constants.go index 6e1de599534b..17fe00201677 100644 --- a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/constants.go +++ b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/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 arminformaticadatamgmt const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt" - moduleVersion = "v1.0.0" + moduleVersion = "v1.0.1" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/fake/internal.go b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/fake/internal.go index 5f75802a569e..4b65adc76adb 100644 --- a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/fake/internal.go +++ b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/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/informaticadatamgmt/arminformaticadatamgmt/fake/operations_server.go b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/fake/operations_server.go index a076ca936df2..5987d43744b8 100644 --- a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/fake/operations_server.go +++ b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/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. @@ -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/informaticadatamgmt/arminformaticadatamgmt/fake/organizations_server.go b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/fake/organizations_server.go index 79899a174083..278541a2a944 100644 --- a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/fake/organizations_server.go +++ b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/fake/organizations_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. @@ -29,7 +26,7 @@ type OrganizationsServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, organizationName string, resource arminformaticadatamgmt.InformaticaOrganizationResource, options *arminformaticadatamgmt.OrganizationsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[arminformaticadatamgmt.OrganizationsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method OrganizationsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, organizationName string, options *arminformaticadatamgmt.OrganizationsClientBeginDeleteOptions) (resp azfake.PollerResponder[arminformaticadatamgmt.OrganizationsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method OrganizationsClient.Get @@ -88,35 +85,54 @@ func (o *OrganizationsServerTransport) Do(req *http.Request) (*http.Response, er return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "OrganizationsClient.BeginCreateOrUpdate": - resp, err = o.dispatchBeginCreateOrUpdate(req) - case "OrganizationsClient.BeginDelete": - resp, err = o.dispatchBeginDelete(req) - case "OrganizationsClient.Get": - resp, err = o.dispatchGet(req) - case "OrganizationsClient.GetAllServerlessRuntimes": - resp, err = o.dispatchGetAllServerlessRuntimes(req) - case "OrganizationsClient.GetServerlessMetadata": - resp, err = o.dispatchGetServerlessMetadata(req) - case "OrganizationsClient.NewListByResourceGroupPager": - resp, err = o.dispatchNewListByResourceGroupPager(req) - case "OrganizationsClient.NewListBySubscriptionPager": - resp, err = o.dispatchNewListBySubscriptionPager(req) - case "OrganizationsClient.Update": - resp, err = o.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return o.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (o *OrganizationsServerTransport) 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 organizationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = organizationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OrganizationsClient.BeginCreateOrUpdate": + res.resp, res.err = o.dispatchBeginCreateOrUpdate(req) + case "OrganizationsClient.BeginDelete": + res.resp, res.err = o.dispatchBeginDelete(req) + case "OrganizationsClient.Get": + res.resp, res.err = o.dispatchGet(req) + case "OrganizationsClient.GetAllServerlessRuntimes": + res.resp, res.err = o.dispatchGetAllServerlessRuntimes(req) + case "OrganizationsClient.GetServerlessMetadata": + res.resp, res.err = o.dispatchGetServerlessMetadata(req) + case "OrganizationsClient.NewListByResourceGroupPager": + res.resp, res.err = o.dispatchNewListByResourceGroupPager(req) + case "OrganizationsClient.NewListBySubscriptionPager": + res.resp, res.err = o.dispatchNewListBySubscriptionPager(req) + case "OrganizationsClient.Update": + res.resp, res.err = o.dispatchUpdate(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 (o *OrganizationsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -200,9 +216,9 @@ func (o *OrganizationsServerTransport) dispatchBeginDelete(req *http.Request) (* return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { o.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { o.beginDelete.remove(req) @@ -416,3 +432,9 @@ func (o *OrganizationsServerTransport) dispatchUpdate(req *http.Request) (*http. } return resp, nil } + +// set this to conditionally intercept incoming requests to OrganizationsServerTransport +var organizationsServerTransportInterceptor 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/informaticadatamgmt/arminformaticadatamgmt/fake/server_factory.go b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/fake/server_factory.go index 5d84863247bc..c776ea9d387f 100644 --- a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/fake/server_factory.go +++ b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/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,8 +16,13 @@ import ( // ServerFactory is a fake server for instances of the arminformaticadatamgmt.ClientFactory type. type ServerFactory struct { - OperationsServer OperationsServer - OrganizationsServer OrganizationsServer + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // OrganizationsServer contains the fakes for client OrganizationsClient + OrganizationsServer OrganizationsServer + + // ServerlessRuntimesServer contains the fakes for client ServerlessRuntimesClient ServerlessRuntimesServer ServerlessRuntimesServer } diff --git a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/fake/serverlessruntimes_server.go b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/fake/serverlessruntimes_server.go index 47920df88d5a..5fc84226d60c 100644 --- a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/fake/serverlessruntimes_server.go +++ b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/fake/serverlessruntimes_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. @@ -33,7 +30,7 @@ type ServerlessRuntimesServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, organizationName string, serverlessRuntimeName string, resource arminformaticadatamgmt.InformaticaServerlessRuntimeResource, options *arminformaticadatamgmt.ServerlessRuntimesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[arminformaticadatamgmt.ServerlessRuntimesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method ServerlessRuntimesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, organizationName string, serverlessRuntimeName string, options *arminformaticadatamgmt.ServerlessRuntimesClientBeginDeleteOptions) (resp azfake.PollerResponder[arminformaticadatamgmt.ServerlessRuntimesClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method ServerlessRuntimesClient.Get @@ -86,35 +83,54 @@ func (s *ServerlessRuntimesServerTransport) Do(req *http.Request) (*http.Respons return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "ServerlessRuntimesClient.CheckDependencies": - resp, err = s.dispatchCheckDependencies(req) - case "ServerlessRuntimesClient.BeginCreateOrUpdate": - resp, err = s.dispatchBeginCreateOrUpdate(req) - case "ServerlessRuntimesClient.BeginDelete": - resp, err = s.dispatchBeginDelete(req) - case "ServerlessRuntimesClient.Get": - resp, err = s.dispatchGet(req) - case "ServerlessRuntimesClient.NewListByInformaticaOrganizationResourcePager": - resp, err = s.dispatchNewListByInformaticaOrganizationResourcePager(req) - case "ServerlessRuntimesClient.ServerlessResourceByID": - resp, err = s.dispatchServerlessResourceByID(req) - case "ServerlessRuntimesClient.StartFailedServerlessRuntime": - resp, err = s.dispatchStartFailedServerlessRuntime(req) - case "ServerlessRuntimesClient.Update": - resp, err = s.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return s.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (s *ServerlessRuntimesServerTransport) 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 serverlessRuntimesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = serverlessRuntimesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ServerlessRuntimesClient.CheckDependencies": + res.resp, res.err = s.dispatchCheckDependencies(req) + case "ServerlessRuntimesClient.BeginCreateOrUpdate": + res.resp, res.err = s.dispatchBeginCreateOrUpdate(req) + case "ServerlessRuntimesClient.BeginDelete": + res.resp, res.err = s.dispatchBeginDelete(req) + case "ServerlessRuntimesClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "ServerlessRuntimesClient.NewListByInformaticaOrganizationResourcePager": + res.resp, res.err = s.dispatchNewListByInformaticaOrganizationResourcePager(req) + case "ServerlessRuntimesClient.ServerlessResourceByID": + res.resp, res.err = s.dispatchServerlessResourceByID(req) + case "ServerlessRuntimesClient.StartFailedServerlessRuntime": + res.resp, res.err = s.dispatchStartFailedServerlessRuntime(req) + case "ServerlessRuntimesClient.Update": + res.resp, res.err = s.dispatchUpdate(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 (s *ServerlessRuntimesServerTransport) dispatchCheckDependencies(req *http.Request) (*http.Response, error) { @@ -243,9 +259,9 @@ func (s *ServerlessRuntimesServerTransport) dispatchBeginDelete(req *http.Reques return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { s.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { s.beginDelete.remove(req) @@ -446,3 +462,9 @@ func (s *ServerlessRuntimesServerTransport) dispatchUpdate(req *http.Request) (* } return resp, nil } + +// set this to conditionally intercept incoming requests to ServerlessRuntimesServerTransport +var serverlessRuntimesServerTransportInterceptor 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/informaticadatamgmt/arminformaticadatamgmt/fake/time_rfc3339.go b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/fake/time_rfc3339.go deleted file mode 100644 index 81f308b0d343..000000000000 --- a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/fake/time_rfc3339.go +++ /dev/null @@ -1,110 +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 ( - utcDateTime = "2006-01-02T15:04:05.999999999" - utcDateTimeJSON = `"` + utcDateTime + `"` - utcDateTimeNoT = "2006-01-02 15:04:05.999999999" - utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` - dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` - dateTimeJSON = `"` + time.RFC3339Nano + `"` - dateTimeJSONNoT = `"` + dateTimeNoT + `"` -) - -type dateTimeRFC3339 time.Time - -func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalJSON() -} - -func (t dateTimeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalText() -} - -func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = dateTimeJSON - } else if tzOffset { - layout = dateTimeJSONNoT - } else if hasT { - layout = utcDateTimeJSON - } else { - layout = utcDateTimeJSONNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = time.RFC3339Nano - } else if tzOffset { - layout = dateTimeNoT - } else if hasT { - layout = utcDateTime - } else { - layout = utcDateTimeNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = dateTimeRFC3339(p) - return err -} - -func (t dateTimeRFC3339) String() string { - return time.Time(t).Format(time.RFC3339Nano) -} - -func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*dateTimeRFC3339)(t) -} - -func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || string(data) == "null" { - return nil - } - var aux dateTimeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/go.mod b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/go.mod index 6bb729598eca..8fedb60d0706 100644 --- a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/go.mod +++ b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/informaticadatamgmt 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 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.2 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.36.0 // indirect golang.org/x/net v0.38.0 // indirect - golang.org/x/sys v0.31.0 // indirect golang.org/x/text v0.23.0 // indirect ) diff --git a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/go.sum b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/go.sum index 4bacf756f06c..4de695d9e23a 100644 --- a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/go.sum +++ b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/go.sum @@ -1,44 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 h1:DSDNVxqkoXJiko6x8a90zidoYqnYYa6c1MTzDKzKkTo= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1/go.mod h1:zGqV2R4Cr/k8Uye5w+dgQ06WJtEcbQG/8J7BB6hnCr4= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 h1:F0gBpfdPLGsw+nsgk6aqqkZS1jiixa5WwFe3fk/T3Ys= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2/go.mod h1:SqINnQ9lVVdRlyC8cd1lCI0SdX4n2paeABd2K8ggfnE= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2 h1:yz1bePFlP5Vws5+8ez6T3HWXPmwOK7Yvq8QxDBD3SKY= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2/go.mod h1:Pa9ZNPuoNu/GztvBSKk9J1cDJW6vk/n0zLtV4mgd8N8= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= -github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 h1:oygO0locgZJe7PpYPXT5A29ZkwJaPqcva7BVeemZOZs= -github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= -github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= -github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8= -github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6 h1:IsMZxCuZqKuao2vNdfD82fjjgPLfyHLpR41Z88viRWs= -github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6/go.mod h1:3VeWNIJaW+O5xpRQbPp0Ybqu1vJd/pm7s2F473HRrkw= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E= -github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= -golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= -golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/models.go b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/models.go index 2ba5ebc5a006..80b5bdb8625c 100644 --- a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/models.go +++ b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/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. diff --git a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/models_serde.go b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/models_serde.go index 34a1f05a08a5..ceebccfe5e27 100644 --- a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/models_serde.go +++ b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/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. diff --git a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/operations_client.go b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/operations_client.go index e87f0279f9c9..91f59e7d71e1 100644 --- a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/operations_client.go +++ b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/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. @@ -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/Informatica.DataManagement/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { diff --git a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/operations_client_example_test.go b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/operations_client_example_test.go deleted file mode 100644 index 9e87da7ee51e..000000000000 --- a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/operations_client_example_test.go +++ /dev/null @@ -1,85 +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 arminformaticadatamgmt_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/Informatica.DataManagement/stable/2024-05-08/examples/Operations_List_MaximumSet_Gen.json -func ExampleOperationsClient_NewListPager_operationsList() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := arminformaticadatamgmt.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 = arminformaticadatamgmt.OperationListResult{ - // Value: []*arminformaticadatamgmt.Operation{ - // { - // Name: to.Ptr("brrqleqkngjxzvw"), - // ActionType: to.Ptr(arminformaticadatamgmt.ActionTypeInternal), - // Display: &arminformaticadatamgmt.OperationDisplay{ - // Description: to.Ptr("tcgposapyblnjwnjzxalhluz"), - // Operation: to.Ptr("av"), - // Provider: to.Ptr("a"), - // Resource: to.Ptr("ogccssxg"), - // }, - // IsDataAction: to.Ptr(true), - // Origin: to.Ptr(arminformaticadatamgmt.OriginUser), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/Informatica.DataManagement/stable/2024-05-08/examples/Operations_List_MinimumSet_Gen.json -func ExampleOperationsClient_NewListPager_operationsListMin() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := arminformaticadatamgmt.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 = arminformaticadatamgmt.OperationListResult{ - // } - } -} diff --git a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/options.go b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/options.go index c7a9d5039287..12f4aabf8b2f 100644 --- a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/options.go +++ b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/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. @@ -16,13 +13,13 @@ type OperationsClientListOptions struct { // OrganizationsClientBeginCreateOrUpdateOptions contains the optional parameters for the OrganizationsClient.BeginCreateOrUpdate // method. type OrganizationsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // OrganizationsClientBeginDeleteOptions contains the optional parameters for the OrganizationsClient.BeginDelete method. type OrganizationsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -63,14 +60,14 @@ type OrganizationsClientUpdateOptions struct { // ServerlessRuntimesClientBeginCreateOrUpdateOptions contains the optional parameters for the ServerlessRuntimesClient.BeginCreateOrUpdate // method. type ServerlessRuntimesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ServerlessRuntimesClientBeginDeleteOptions contains the optional parameters for the ServerlessRuntimesClient.BeginDelete // method. type ServerlessRuntimesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } diff --git a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/organizations_client.go b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/organizations_client.go index f97b404ff86d..a5d41b1bdff0 100644 --- a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/organizations_client.go +++ b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/organizations_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. @@ -96,7 +93,7 @@ func (client *OrganizationsClient) createOrUpdate(ctx context.Context, resourceG } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *OrganizationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, resource InformaticaOrganizationResource, options *OrganizationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *OrganizationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, resource InformaticaOrganizationResource, _ *OrganizationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Informatica.DataManagement/organizations/{organizationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -176,7 +173,7 @@ func (client *OrganizationsClient) deleteOperation(ctx context.Context, resource } // deleteCreateRequest creates the Delete request. -func (client *OrganizationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, options *OrganizationsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *OrganizationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, _ *OrganizationsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Informatica.DataManagement/organizations/{organizationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -231,7 +228,7 @@ func (client *OrganizationsClient) Get(ctx context.Context, resourceGroupName st } // getCreateRequest creates the Get request. -func (client *OrganizationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, options *OrganizationsClientGetOptions) (*policy.Request, error) { +func (client *OrganizationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, _ *OrganizationsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Informatica.DataManagement/organizations/{organizationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -296,7 +293,7 @@ func (client *OrganizationsClient) GetAllServerlessRuntimes(ctx context.Context, } // getAllServerlessRuntimesCreateRequest creates the GetAllServerlessRuntimes request. -func (client *OrganizationsClient) getAllServerlessRuntimesCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, options *OrganizationsClientGetAllServerlessRuntimesOptions) (*policy.Request, error) { +func (client *OrganizationsClient) getAllServerlessRuntimesCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, _ *OrganizationsClientGetAllServerlessRuntimesOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Informatica.DataManagement/organizations/{organizationName}/getAllServerlessRuntimes" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -361,7 +358,7 @@ func (client *OrganizationsClient) GetServerlessMetadata(ctx context.Context, re } // getServerlessMetadataCreateRequest creates the GetServerlessMetadata request. -func (client *OrganizationsClient) getServerlessMetadataCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, options *OrganizationsClientGetServerlessMetadataOptions) (*policy.Request, error) { +func (client *OrganizationsClient) getServerlessMetadataCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, _ *OrganizationsClientGetServerlessMetadataOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Informatica.DataManagement/organizations/{organizationName}/getServerlessMetadata" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -425,7 +422,7 @@ func (client *OrganizationsClient) NewListByResourceGroupPager(resourceGroupName } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *OrganizationsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *OrganizationsClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *OrganizationsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *OrganizationsClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Informatica.DataManagement/organizations" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -484,7 +481,7 @@ func (client *OrganizationsClient) NewListBySubscriptionPager(options *Organizat } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *OrganizationsClient) listBySubscriptionCreateRequest(ctx context.Context, options *OrganizationsClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *OrganizationsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *OrganizationsClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Informatica.DataManagement/organizations" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -541,7 +538,7 @@ func (client *OrganizationsClient) Update(ctx context.Context, resourceGroupName } // updateCreateRequest creates the Update request. -func (client *OrganizationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, properties InformaticaOrganizationResourceUpdate, options *OrganizationsClientUpdateOptions) (*policy.Request, error) { +func (client *OrganizationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, properties InformaticaOrganizationResourceUpdate, _ *OrganizationsClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Informatica.DataManagement/organizations/{organizationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/organizations_client_example_test.go b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/organizations_client_example_test.go deleted file mode 100644 index c9e52d22d9d7..000000000000 --- a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/organizations_client_example_test.go +++ /dev/null @@ -1,858 +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 arminformaticadatamgmt_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/informaticadatamgmt/arminformaticadatamgmt" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/Informatica.DataManagement/stable/2024-05-08/examples/Organizations_ListBySubscription_MaximumSet_Gen.json -func ExampleOrganizationsClient_NewListBySubscriptionPager_organizationsListBySubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := arminformaticadatamgmt.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOrganizationsClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.InformaticaOrganizationResourceListResult = arminformaticadatamgmt.InformaticaOrganizationResourceListResult{ - // Value: []*arminformaticadatamgmt.InformaticaOrganizationResource{ - // { - // Name: to.Ptr("qmlpllxohjomejbeylyhlqwt"), - // Type: to.Ptr("korjyotq"), - // ID: to.Ptr("cadokiejnrth"), - // SystemData: &arminformaticadatamgmt.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-12-05T15:45:15.582Z"); return t}()), - // CreatedBy: to.Ptr("kocqbxulqrggzbfrifpvy"), - // CreatedByType: to.Ptr(arminformaticadatamgmt.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-12-05T15:45:15.582Z"); return t}()), - // LastModifiedBy: to.Ptr("lzpllqnildoamkmgf"), - // LastModifiedByType: to.Ptr(arminformaticadatamgmt.CreatedByTypeUser), - // }, - // Location: to.Ptr("pamjoudtssthlbhrnfjidr"), - // Tags: map[string]*string{ - // "key8430": to.Ptr("cagshqtjlxtqqhdwtchokvxszybp"), - // }, - // Properties: &arminformaticadatamgmt.OrganizationProperties{ - // CompanyDetails: &arminformaticadatamgmt.CompanyDetails{ - // Business: to.Ptr("pucosrtjv"), - // CompanyName: to.Ptr("xszcggknokhw"), - // Country: to.Ptr("gwkcpnwyaqc"), - // Domain: to.Ptr("utcxetzzpmbvwmjrvphqngvp"), - // NumberOfEmployees: to.Ptr[int32](25), - // OfficeAddress: to.Ptr("sbttzwyajgdbsvipuiclbzvkcvwyil"), - // }, - // InformaticaProperties: &arminformaticadatamgmt.InformaticaProperties{ - // InformaticaRegion: to.Ptr("zfqodqpbeflhedypiijdkc"), - // OrganizationID: to.Ptr("wtdmhlwhkvgqdumaehgfgiqcxgnqpx"), - // OrganizationName: to.Ptr("nomzbvwe"), - // SingleSignOnURL: to.Ptr("https://contoso.com/singlesignon"), - // }, - // LinkOrganization: &arminformaticadatamgmt.LinkOrganization{ - // Token: to.Ptr("jjfouhoqpumjvrdsfbimgcy"), - // }, - // MarketplaceDetails: &arminformaticadatamgmt.MarketplaceDetails{ - // MarketplaceSubscriptionID: to.Ptr("ovenlecocg"), - // OfferDetails: &arminformaticadatamgmt.OfferDetails{ - // OfferID: to.Ptr("cwswcfwmzhjcoksmueukegwaptvpcmbfyvixfhvgwnjyblqivqdkkwkunkgimiopwwkvgnwclmajhuty"), - // PlanID: to.Ptr("jfnemevyivtlxhectiutdavdgfyidolivuojumdzckp"), - // PlanName: to.Ptr("iaoxgaitteuoqgujkgxbdgryaobtkjjecuvchwutntrvmuorikrbqqegmelenbewhakiysprrnovjixyxrikscaptrbapbdspu"), - // PublisherID: to.Ptr("zajxpfacudwongxjvnnuhhpygmnydchgowjccyuzsjonegmqxcqqpnzafanggowfqdixnnutyfvmvwrkx"), - // TermID: to.Ptr("tcvvsxdjnjlfmjhmvwklptdmxetnzydxyuhfqchoubmtoeqbchnfxoxqzezlgpxdnzyvzgkynjxzzgetkqccxvpzahxattluqdipvbdktqmndfefitzuifqjpschzlbvixnvznkmmgjwvkplfhemnapsewgqxggdzdokryhv"), - // TermUnit: to.Ptr("gjwmgevrblbosuogsvfspsgspetbnxaygkbelvadpgwiywl"), - // }, - // }, - // ProvisioningState: to.Ptr(arminformaticadatamgmt.ProvisioningStateSucceeded), - // UserDetails: &arminformaticadatamgmt.UserDetails{ - // EmailAddress: to.Ptr("7_-46@13D--3.m-4x-.11.c-9-.DHLYFc"), - // FirstName: to.Ptr("appvdclawzfjntdfdftjevlhvzropnxqtnypid"), - // LastName: to.Ptr("nzirbvzmkxtbrlamyatlcszebxgcyncxoascojsmacwvjsjvn"), - // PhoneNumber: to.Ptr("fvcjylxlmhdnshsgywnzlyvshu"), - // Upn: to.Ptr("undljch"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/Informatica.DataManagement/stable/2024-05-08/examples/Organizations_ListBySubscription_MinimumSet_Gen.json -func ExampleOrganizationsClient_NewListBySubscriptionPager_organizationsListBySubscriptionMin() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := arminformaticadatamgmt.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOrganizationsClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.InformaticaOrganizationResourceListResult = arminformaticadatamgmt.InformaticaOrganizationResourceListResult{ - // Value: []*arminformaticadatamgmt.InformaticaOrganizationResource{ - // { - // ID: to.Ptr("cadokiejnrth"), - // Location: to.Ptr("pamjoudtssthlbhrnfjidr"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/Informatica.DataManagement/stable/2024-05-08/examples/Organizations_ListByResourceGroup_MaximumSet_Gen.json -func ExampleOrganizationsClient_NewListByResourceGroupPager_organizationsListByResourceGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := arminformaticadatamgmt.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOrganizationsClient().NewListByResourceGroupPager("rgopenapi", 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.InformaticaOrganizationResourceListResult = arminformaticadatamgmt.InformaticaOrganizationResourceListResult{ - // Value: []*arminformaticadatamgmt.InformaticaOrganizationResource{ - // { - // Name: to.Ptr("qmlpllxohjomejbeylyhlqwt"), - // Type: to.Ptr("korjyotq"), - // ID: to.Ptr("cadokiejnrth"), - // SystemData: &arminformaticadatamgmt.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-12-05T15:45:15.582Z"); return t}()), - // CreatedBy: to.Ptr("kocqbxulqrggzbfrifpvy"), - // CreatedByType: to.Ptr(arminformaticadatamgmt.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-12-05T15:45:15.582Z"); return t}()), - // LastModifiedBy: to.Ptr("lzpllqnildoamkmgf"), - // LastModifiedByType: to.Ptr(arminformaticadatamgmt.CreatedByTypeUser), - // }, - // Location: to.Ptr("pamjoudtssthlbhrnfjidr"), - // Tags: map[string]*string{ - // "key8430": to.Ptr("cagshqtjlxtqqhdwtchokvxszybp"), - // }, - // Properties: &arminformaticadatamgmt.OrganizationProperties{ - // CompanyDetails: &arminformaticadatamgmt.CompanyDetails{ - // Business: to.Ptr("pucosrtjv"), - // CompanyName: to.Ptr("xszcggknokhw"), - // Country: to.Ptr("gwkcpnwyaqc"), - // Domain: to.Ptr("utcxetzzpmbvwmjrvphqngvp"), - // NumberOfEmployees: to.Ptr[int32](25), - // OfficeAddress: to.Ptr("sbttzwyajgdbsvipuiclbzvkcvwyil"), - // }, - // InformaticaProperties: &arminformaticadatamgmt.InformaticaProperties{ - // InformaticaRegion: to.Ptr("zfqodqpbeflhedypiijdkc"), - // OrganizationID: to.Ptr("wtdmhlwhkvgqdumaehgfgiqcxgnqpx"), - // OrganizationName: to.Ptr("nomzbvwe"), - // SingleSignOnURL: to.Ptr("https://contoso.com/singlesignon"), - // }, - // LinkOrganization: &arminformaticadatamgmt.LinkOrganization{ - // Token: to.Ptr("jjfouhoqpumjvrdsfbimgcy"), - // }, - // MarketplaceDetails: &arminformaticadatamgmt.MarketplaceDetails{ - // MarketplaceSubscriptionID: to.Ptr("ovenlecocg"), - // OfferDetails: &arminformaticadatamgmt.OfferDetails{ - // OfferID: to.Ptr("cwswcfwmzhjcoksmueukegwaptvpcmbfyvixfhvgwnjyblqivqdkkwkunkgimiopwwkvgnwclmajhuty"), - // PlanID: to.Ptr("jfnemevyivtlxhectiutdavdgfyidolivuojumdzckp"), - // PlanName: to.Ptr("iaoxgaitteuoqgujkgxbdgryaobtkjjecuvchwutntrvmuorikrbqqegmelenbewhakiysprrnovjixyxrikscaptrbapbdspu"), - // PublisherID: to.Ptr("zajxpfacudwongxjvnnuhhpygmnydchgowjccyuzsjonegmqxcqqpnzafanggowfqdixnnutyfvmvwrkx"), - // TermID: to.Ptr("tcvvsxdjnjlfmjhmvwklptdmxetnzydxyuhfqchoubmtoeqbchnfxoxqzezlgpxdnzyvzgkynjxzzgetkqccxvpzahxattluqdipvbdktqmndfefitzuifqjpschzlbvixnvznkmmgjwvkplfhemnapsewgqxggdzdokryhv"), - // TermUnit: to.Ptr("gjwmgevrblbosuogsvfspsgspetbnxaygkbelvadpgwiywl"), - // }, - // }, - // ProvisioningState: to.Ptr(arminformaticadatamgmt.ProvisioningStateSucceeded), - // UserDetails: &arminformaticadatamgmt.UserDetails{ - // EmailAddress: to.Ptr("7_-46@13D--3.m-4x-.11.c-9-.DHLYFc"), - // FirstName: to.Ptr("appvdclawzfjntdfdftjevlhvzropnxqtnypid"), - // LastName: to.Ptr("nzirbvzmkxtbrlamyatlcszebxgcyncxoascojsmacwvjsjvn"), - // PhoneNumber: to.Ptr("fvcjylxlmhdnshsgywnzlyvshu"), - // Upn: to.Ptr("undljch"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/Informatica.DataManagement/stable/2024-05-08/examples/Organizations_ListByResourceGroup_MinimumSet_Gen.json -func ExampleOrganizationsClient_NewListByResourceGroupPager_organizationsListByResourceGroupMin() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := arminformaticadatamgmt.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOrganizationsClient().NewListByResourceGroupPager("rgopenapi", 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.InformaticaOrganizationResourceListResult = arminformaticadatamgmt.InformaticaOrganizationResourceListResult{ - // Value: []*arminformaticadatamgmt.InformaticaOrganizationResource{ - // { - // ID: to.Ptr("cadokiejnrth"), - // Location: to.Ptr("pamjoudtssthlbhrnfjidr"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/Informatica.DataManagement/stable/2024-05-08/examples/Organizations_Get_MaximumSet_Gen.json -func ExampleOrganizationsClient_Get_organizationsGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := arminformaticadatamgmt.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOrganizationsClient().Get(ctx, "rgopenapi", "Sg", 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.InformaticaOrganizationResource = arminformaticadatamgmt.InformaticaOrganizationResource{ - // Name: to.Ptr("qmlpllxohjomejbeylyhlqwt"), - // Type: to.Ptr("korjyotq"), - // ID: to.Ptr("cadokiejnrth"), - // SystemData: &arminformaticadatamgmt.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-12-05T15:45:15.582Z"); return t}()), - // CreatedBy: to.Ptr("kocqbxulqrggzbfrifpvy"), - // CreatedByType: to.Ptr(arminformaticadatamgmt.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-12-05T15:45:15.582Z"); return t}()), - // LastModifiedBy: to.Ptr("lzpllqnildoamkmgf"), - // LastModifiedByType: to.Ptr(arminformaticadatamgmt.CreatedByTypeUser), - // }, - // Location: to.Ptr("pamjoudtssthlbhrnfjidr"), - // Tags: map[string]*string{ - // "key8430": to.Ptr("cagshqtjlxtqqhdwtchokvxszybp"), - // }, - // Properties: &arminformaticadatamgmt.OrganizationProperties{ - // CompanyDetails: &arminformaticadatamgmt.CompanyDetails{ - // Business: to.Ptr("pucosrtjv"), - // CompanyName: to.Ptr("xszcggknokhw"), - // Country: to.Ptr("gwkcpnwyaqc"), - // Domain: to.Ptr("utcxetzzpmbvwmjrvphqngvp"), - // NumberOfEmployees: to.Ptr[int32](25), - // OfficeAddress: to.Ptr("sbttzwyajgdbsvipuiclbzvkcvwyil"), - // }, - // InformaticaProperties: &arminformaticadatamgmt.InformaticaProperties{ - // InformaticaRegion: to.Ptr("zfqodqpbeflhedypiijdkc"), - // OrganizationID: to.Ptr("wtdmhlwhkvgqdumaehgfgiqcxgnqpx"), - // OrganizationName: to.Ptr("nomzbvwe"), - // SingleSignOnURL: to.Ptr("https://contoso.com/singlesignon"), - // }, - // LinkOrganization: &arminformaticadatamgmt.LinkOrganization{ - // Token: to.Ptr("jjfouhoqpumjvrdsfbimgcy"), - // }, - // MarketplaceDetails: &arminformaticadatamgmt.MarketplaceDetails{ - // MarketplaceSubscriptionID: to.Ptr("ovenlecocg"), - // OfferDetails: &arminformaticadatamgmt.OfferDetails{ - // OfferID: to.Ptr("cwswcfwmzhjcoksmueukegwaptvpcmbfyvixfhvgwnjyblqivqdkkwkunkgimiopwwkvgnwclmajhuty"), - // PlanID: to.Ptr("jfnemevyivtlxhectiutdavdgfyidolivuojumdzckp"), - // PlanName: to.Ptr("iaoxgaitteuoqgujkgxbdgryaobtkjjecuvchwutntrvmuorikrbqqegmelenbewhakiysprrnovjixyxrikscaptrbapbdspu"), - // PublisherID: to.Ptr("zajxpfacudwongxjvnnuhhpygmnydchgowjccyuzsjonegmqxcqqpnzafanggowfqdixnnutyfvmvwrkx"), - // TermID: to.Ptr("tcvvsxdjnjlfmjhmvwklptdmxetnzydxyuhfqchoubmtoeqbchnfxoxqzezlgpxdnzyvzgkynjxzzgetkqccxvpzahxattluqdipvbdktqmndfefitzuifqjpschzlbvixnvznkmmgjwvkplfhemnapsewgqxggdzdokryhv"), - // TermUnit: to.Ptr("gjwmgevrblbosuogsvfspsgspetbnxaygkbelvadpgwiywl"), - // }, - // }, - // ProvisioningState: to.Ptr(arminformaticadatamgmt.ProvisioningStateSucceeded), - // UserDetails: &arminformaticadatamgmt.UserDetails{ - // EmailAddress: to.Ptr("7_-46@13D--3.m-4x-.11.c-9-.DHLYFc"), - // FirstName: to.Ptr("appvdclawzfjntdfdftjevlhvzropnxqtnypid"), - // LastName: to.Ptr("nzirbvzmkxtbrlamyatlcszebxgcyncxoascojsmacwvjsjvn"), - // PhoneNumber: to.Ptr("fvcjylxlmhdnshsgywnzlyvshu"), - // Upn: to.Ptr("undljch"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/Informatica.DataManagement/stable/2024-05-08/examples/Organizations_Get_MinimumSet_Gen.json -func ExampleOrganizationsClient_Get_organizationsGetMin() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := arminformaticadatamgmt.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOrganizationsClient().Get(ctx, "rgopenapi", "q", 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.InformaticaOrganizationResource = arminformaticadatamgmt.InformaticaOrganizationResource{ - // ID: to.Ptr("cadokiejnrth"), - // Location: to.Ptr("pamjoudtssthlbhrnfjidr"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/Informatica.DataManagement/stable/2024-05-08/examples/Organizations_CreateOrUpdate_MaximumSet_Gen.json -func ExampleOrganizationsClient_BeginCreateOrUpdate_organizationsCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := arminformaticadatamgmt.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewOrganizationsClient().BeginCreateOrUpdate(ctx, "rgopenapi", "C", arminformaticadatamgmt.InformaticaOrganizationResource{ - Location: to.Ptr("pamjoudtssthlbhrnfjidr"), - Tags: map[string]*string{ - "key8430": to.Ptr("cagshqtjlxtqqhdwtchokvxszybp"), - }, - Properties: &arminformaticadatamgmt.OrganizationProperties{ - CompanyDetails: &arminformaticadatamgmt.CompanyDetails{ - Business: to.Ptr("pucosrtjv"), - CompanyName: to.Ptr("xszcggknokhw"), - Country: to.Ptr("gwkcpnwyaqc"), - Domain: to.Ptr("utcxetzzpmbvwmjrvphqngvp"), - NumberOfEmployees: to.Ptr[int32](25), - OfficeAddress: to.Ptr("sbttzwyajgdbsvipuiclbzvkcvwyil"), - }, - InformaticaProperties: &arminformaticadatamgmt.InformaticaProperties{ - InformaticaRegion: to.Ptr("zfqodqpbeflhedypiijdkc"), - OrganizationID: to.Ptr("wtdmhlwhkvgqdumaehgfgiqcxgnqpx"), - OrganizationName: to.Ptr("nomzbvwe"), - SingleSignOnURL: to.Ptr("https://contoso.com/singlesignon"), - }, - LinkOrganization: &arminformaticadatamgmt.LinkOrganization{ - Token: to.Ptr("jjfouhoqpumjvrdsfbimgcy"), - }, - MarketplaceDetails: &arminformaticadatamgmt.MarketplaceDetails{ - MarketplaceSubscriptionID: to.Ptr("ovenlecocg"), - OfferDetails: &arminformaticadatamgmt.OfferDetails{ - OfferID: to.Ptr("cwswcfwmzhjcoksmueukegwaptvpcmbfyvixfhvgwnjyblqivqdkkwkunkgimiopwwkvgnwclmajhuty"), - PlanID: to.Ptr("jfnemevyivtlxhectiutdavdgfyidolivuojumdzckp"), - PlanName: to.Ptr("iaoxgaitteuoqgujkgxbdgryaobtkjjecuvchwutntrvmuorikrbqqegmelenbewhakiysprrnovjixyxrikscaptrbapbdspu"), - PublisherID: to.Ptr("zajxpfacudwongxjvnnuhhpygmnydchgowjccyuzsjonegmqxcqqpnzafanggowfqdixnnutyfvmvwrkx"), - TermID: to.Ptr("tcvvsxdjnjlfmjhmvwklptdmxetnzydxyuhfqchoubmtoeqbchnfxoxqzezlgpxdnzyvzgkynjxzzgetkqccxvpzahxattluqdipvbdktqmndfefitzuifqjpschzlbvixnvznkmmgjwvkplfhemnapsewgqxggdzdokryhv"), - TermUnit: to.Ptr("gjwmgevrblbosuogsvfspsgspetbnxaygkbelvadpgwiywl"), - }, - }, - ProvisioningState: to.Ptr(arminformaticadatamgmt.ProvisioningStateAccepted), - UserDetails: &arminformaticadatamgmt.UserDetails{ - EmailAddress: to.Ptr("7_-46@13D--3.m-4x-.11.c-9-.DHLYFc"), - FirstName: to.Ptr("appvdclawzfjntdfdftjevlhvzropnxqtnypid"), - LastName: to.Ptr("nzirbvzmkxtbrlamyatlcszebxgcyncxoascojsmacwvjsjvn"), - PhoneNumber: to.Ptr("fvcjylxlmhdnshsgywnzlyvshu"), - Upn: to.Ptr("undljch"), - }, - }, - }, 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.InformaticaOrganizationResource = arminformaticadatamgmt.InformaticaOrganizationResource{ - // Name: to.Ptr("qmlpllxohjomejbeylyhlqwt"), - // Type: to.Ptr("korjyotq"), - // ID: to.Ptr("cadokiejnrth"), - // SystemData: &arminformaticadatamgmt.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-12-05T15:45:15.582Z"); return t}()), - // CreatedBy: to.Ptr("kocqbxulqrggzbfrifpvy"), - // CreatedByType: to.Ptr(arminformaticadatamgmt.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-12-05T15:45:15.582Z"); return t}()), - // LastModifiedBy: to.Ptr("lzpllqnildoamkmgf"), - // LastModifiedByType: to.Ptr(arminformaticadatamgmt.CreatedByTypeUser), - // }, - // Location: to.Ptr("pamjoudtssthlbhrnfjidr"), - // Tags: map[string]*string{ - // "key8430": to.Ptr("cagshqtjlxtqqhdwtchokvxszybp"), - // }, - // Properties: &arminformaticadatamgmt.OrganizationProperties{ - // CompanyDetails: &arminformaticadatamgmt.CompanyDetails{ - // Business: to.Ptr("pucosrtjv"), - // CompanyName: to.Ptr("xszcggknokhw"), - // Country: to.Ptr("gwkcpnwyaqc"), - // Domain: to.Ptr("utcxetzzpmbvwmjrvphqngvp"), - // NumberOfEmployees: to.Ptr[int32](25), - // OfficeAddress: to.Ptr("sbttzwyajgdbsvipuiclbzvkcvwyil"), - // }, - // InformaticaProperties: &arminformaticadatamgmt.InformaticaProperties{ - // InformaticaRegion: to.Ptr("zfqodqpbeflhedypiijdkc"), - // OrganizationID: to.Ptr("wtdmhlwhkvgqdumaehgfgiqcxgnqpx"), - // OrganizationName: to.Ptr("nomzbvwe"), - // SingleSignOnURL: to.Ptr("https://contoso.com/singlesignon"), - // }, - // LinkOrganization: &arminformaticadatamgmt.LinkOrganization{ - // Token: to.Ptr("jjfouhoqpumjvrdsfbimgcy"), - // }, - // MarketplaceDetails: &arminformaticadatamgmt.MarketplaceDetails{ - // MarketplaceSubscriptionID: to.Ptr("ovenlecocg"), - // OfferDetails: &arminformaticadatamgmt.OfferDetails{ - // OfferID: to.Ptr("cwswcfwmzhjcoksmueukegwaptvpcmbfyvixfhvgwnjyblqivqdkkwkunkgimiopwwkvgnwclmajhuty"), - // PlanID: to.Ptr("jfnemevyivtlxhectiutdavdgfyidolivuojumdzckp"), - // PlanName: to.Ptr("iaoxgaitteuoqgujkgxbdgryaobtkjjecuvchwutntrvmuorikrbqqegmelenbewhakiysprrnovjixyxrikscaptrbapbdspu"), - // PublisherID: to.Ptr("zajxpfacudwongxjvnnuhhpygmnydchgowjccyuzsjonegmqxcqqpnzafanggowfqdixnnutyfvmvwrkx"), - // TermID: to.Ptr("tcvvsxdjnjlfmjhmvwklptdmxetnzydxyuhfqchoubmtoeqbchnfxoxqzezlgpxdnzyvzgkynjxzzgetkqccxvpzahxattluqdipvbdktqmndfefitzuifqjpschzlbvixnvznkmmgjwvkplfhemnapsewgqxggdzdokryhv"), - // TermUnit: to.Ptr("gjwmgevrblbosuogsvfspsgspetbnxaygkbelvadpgwiywl"), - // }, - // }, - // ProvisioningState: to.Ptr(arminformaticadatamgmt.ProvisioningStateSucceeded), - // UserDetails: &arminformaticadatamgmt.UserDetails{ - // EmailAddress: to.Ptr("7_-46@13D--3.m-4x-.11.c-9-.DHLYFc"), - // FirstName: to.Ptr("appvdclawzfjntdfdftjevlhvzropnxqtnypid"), - // LastName: to.Ptr("nzirbvzmkxtbrlamyatlcszebxgcyncxoascojsmacwvjsjvn"), - // PhoneNumber: to.Ptr("fvcjylxlmhdnshsgywnzlyvshu"), - // Upn: to.Ptr("undljch"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/Informatica.DataManagement/stable/2024-05-08/examples/Organizations_CreateOrUpdate_MinimumSet_Gen.json -func ExampleOrganizationsClient_BeginCreateOrUpdate_organizationsCreateOrUpdateMin() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := arminformaticadatamgmt.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewOrganizationsClient().BeginCreateOrUpdate(ctx, "rgopenapi", "n6v", arminformaticadatamgmt.InformaticaOrganizationResource{ - Location: to.Ptr("pamjoudtssthlbhrnfjidr"), - }, 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.InformaticaOrganizationResource = arminformaticadatamgmt.InformaticaOrganizationResource{ - // ID: to.Ptr("cadokiejnrth"), - // Location: to.Ptr("pamjoudtssthlbhrnfjidr"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/Informatica.DataManagement/stable/2024-05-08/examples/Organizations_Update_MaximumSet_Gen.json -func ExampleOrganizationsClient_Update_organizationsUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := arminformaticadatamgmt.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOrganizationsClient().Update(ctx, "rgopenapi", "_-", arminformaticadatamgmt.InformaticaOrganizationResourceUpdate{ - Properties: &arminformaticadatamgmt.OrganizationPropertiesCustomUpdate{ - CompanyDetails: &arminformaticadatamgmt.CompanyDetailsUpdate{ - Business: to.Ptr("mwqblnruflwpolgbxpqbqneve"), - CompanyName: to.Ptr("xkrvbozrjcvappqeeyt"), - Country: to.Ptr("rvlzppgvopcw"), - Domain: to.Ptr("dponvwnrdrnzahcurqssesukbsokdd"), - NumberOfEmployees: to.Ptr[int32](22), - OfficeAddress: to.Ptr("sfcx"), - }, - ExistingResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Informatica.DataManagement/organizations/org1/serverlessRuntimes/serverlessRuntimeName"), - MarketplaceDetails: &arminformaticadatamgmt.MarketplaceDetailsUpdate{ - MarketplaceSubscriptionID: to.Ptr("szhyxzgjtssjmlguivepc"), - OfferDetails: &arminformaticadatamgmt.OfferDetailsUpdate{ - OfferID: to.Ptr("idaxbflabvjsippplyenvrpgeydsjxcmyubgukffkcdvlvrtwpdhnvdblxjsldiuswrchsibk"), - PlanID: to.Ptr("giihvvnwdwzkfqrhkpqzbgfotzyixnsvmxzauseebillhslauglzfxzvzvts"), - PlanName: to.Ptr("tfqjenotaewzdeerliteqxdawuqxhwdzbtiiimsaedrlsnbdoonnloakjtvnwhhrcyxxsgoachguthqvlahpjyofpoqpfacfmiaauawazkmxkjgvktbptojknzojtjrfzvbbjjkvstabqyaczxinijhoxrjukftsagpwgsvpmczopztmplipyufhuaumfx"), - PublisherID: to.Ptr("ktzfghsyjqbsswhltoaemgotmnorhdogvkaxplutbjjqzuepxizliynyakersobagvpwvpzwjtjjxigsqgcyqaahaxdijghnexliofhfjlqzjmmbvrhcvjxdodnexxizbgfhjopbwzjojxsluasnwwsgcajefglbcvzpaeblanhmurcculndtfwnfjyxol"), - TermID: to.Ptr("eolmwogtgpdncqoigqcdomupwummaicwvdxgbskpdsmjizdfbdgbxbuekcpwmenqzbhqxpdnjtup"), - TermUnit: to.Ptr("nykqoplazujcwmfldntifjqrnx"), - }, - }, - UserDetails: &arminformaticadatamgmt.UserDetailsUpdate{ - EmailAddress: to.Ptr("7_-46@13D--3.m-4x-.11.c-9-.DHLYFc"), - FirstName: to.Ptr("qguqrmanyupoi"), - LastName: to.Ptr("ugzg"), - PhoneNumber: to.Ptr("uxa"), - Upn: to.Ptr("viwjrkn"), - }, - }, - Tags: map[string]*string{ - "key1918": to.Ptr("fbjvtuvzsghpl"), - }, - }, 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.InformaticaOrganizationResource = arminformaticadatamgmt.InformaticaOrganizationResource{ - // Name: to.Ptr("qmlpllxohjomejbeylyhlqwt"), - // Type: to.Ptr("korjyotq"), - // ID: to.Ptr("cadokiejnrth"), - // SystemData: &arminformaticadatamgmt.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-12-05T15:45:15.582Z"); return t}()), - // CreatedBy: to.Ptr("kocqbxulqrggzbfrifpvy"), - // CreatedByType: to.Ptr(arminformaticadatamgmt.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-12-05T15:45:15.582Z"); return t}()), - // LastModifiedBy: to.Ptr("lzpllqnildoamkmgf"), - // LastModifiedByType: to.Ptr(arminformaticadatamgmt.CreatedByTypeUser), - // }, - // Location: to.Ptr("pamjoudtssthlbhrnfjidr"), - // Tags: map[string]*string{ - // "key8430": to.Ptr("cagshqtjlxtqqhdwtchokvxszybp"), - // }, - // Properties: &arminformaticadatamgmt.OrganizationProperties{ - // CompanyDetails: &arminformaticadatamgmt.CompanyDetails{ - // Business: to.Ptr("mwqblnruflwpolgbxpqbqneve"), - // CompanyName: to.Ptr("xkrvbozrjcvappqeeyt"), - // Country: to.Ptr("rvlzppgvopcw"), - // Domain: to.Ptr("dponvwnrdrnzahcurqssesukbsokdd"), - // NumberOfEmployees: to.Ptr[int32](22), - // OfficeAddress: to.Ptr("sfcx"), - // }, - // InformaticaProperties: &arminformaticadatamgmt.InformaticaProperties{ - // InformaticaRegion: to.Ptr("zfqodqpbeflhedypiijdkc"), - // OrganizationID: to.Ptr("wtdmhlwhkvgqdumaehgfgiqcxgnqpx"), - // OrganizationName: to.Ptr("nomzbvwe"), - // SingleSignOnURL: to.Ptr("https://contoso.com/singlesignon"), - // }, - // LinkOrganization: &arminformaticadatamgmt.LinkOrganization{ - // Token: to.Ptr("jjfouhoqpumjvrdsfbimgcy"), - // }, - // MarketplaceDetails: &arminformaticadatamgmt.MarketplaceDetails{ - // MarketplaceSubscriptionID: to.Ptr("szhyxzgjtssjmlguivepc"), - // OfferDetails: &arminformaticadatamgmt.OfferDetails{ - // OfferID: to.Ptr("idaxbflabvjsippplyenvrpgeydsjxcmyubgukffkcdvlvrtwpdhnvdblxjsldiuswrchsibk"), - // PlanID: to.Ptr("giihvvnwdwzkfqrhkpqzbgfotzyixnsvmxzauseebillhslauglzfxzvzvts"), - // PlanName: to.Ptr("tfqjenotaewzdeerliteqxdawuqxhwdzbtiiimsaedrlsnbdoonnloakjtvnwhhrcyxxsgoachguthqvlahpjyofpoqpfacfmiaauawazkmxkjgvktbptojknzojtjrfzvbbjjkvstabqyaczxinijhoxrjukftsagpwgsvpmczopztmplipyufhuaumfx"), - // PublisherID: to.Ptr("ktzfghsyjqbsswhltoaemgotmnorhdogvkaxplutbjjqzuepxizliynyakersobagvpwvpzwjtjjxigsqgcyqaahaxdijghnexliofhfjlqzjmmbvrhcvjxdodnexxizbgfhjopbwzjojxsluasnwwsgcajefglbcvzpaeblanhmurcculndtfwnfjyxol"), - // TermID: to.Ptr("eolmwogtgpdncqoigqcdomupwummaicwvdxgbskpdsmjizdfbdgbxbuekcpwmenqzbhqxpdnjtup"), - // TermUnit: to.Ptr("nykqoplazujcwmfldntifjqrnx"), - // }, - // }, - // ProvisioningState: to.Ptr(arminformaticadatamgmt.ProvisioningStateSucceeded), - // UserDetails: &arminformaticadatamgmt.UserDetails{ - // EmailAddress: to.Ptr("7_-46@13D--3.m-4x-.11.c-9-.DHLYFc"), - // FirstName: to.Ptr("qguqrmanyupoi"), - // LastName: to.Ptr("ugzg"), - // PhoneNumber: to.Ptr("uxa"), - // Upn: to.Ptr("viwjrkn"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/Informatica.DataManagement/stable/2024-05-08/examples/Organizations_Update_MinimumSet_Gen.json -func ExampleOrganizationsClient_Update_organizationsUpdateMin() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := arminformaticadatamgmt.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOrganizationsClient().Update(ctx, "rgopenapi", "-", arminformaticadatamgmt.InformaticaOrganizationResourceUpdate{}, 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.InformaticaOrganizationResource = arminformaticadatamgmt.InformaticaOrganizationResource{ - // ID: to.Ptr("cadokiejnrth"), - // Location: to.Ptr("pamjoudtssthlbhrnfjidr"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/Informatica.DataManagement/stable/2024-05-08/examples/Organizations_Delete_MaximumSet_Gen.json -func ExampleOrganizationsClient_BeginDelete_organizationsDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := arminformaticadatamgmt.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewOrganizationsClient().BeginDelete(ctx, "rgopenapi", "_", 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/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/Informatica.DataManagement/stable/2024-05-08/examples/Organizations_Delete_MinimumSet_Gen.json -func ExampleOrganizationsClient_BeginDelete_organizationsDeleteMin() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := arminformaticadatamgmt.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewOrganizationsClient().BeginDelete(ctx, "rgopenapi", "_-", 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/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/Informatica.DataManagement/stable/2024-05-08/examples/Organizations_GetAllServerlessRuntimes_MaximumSet_Gen.json -func ExampleOrganizationsClient_GetAllServerlessRuntimes_organizationsGetAllServerlessRuntimes() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := arminformaticadatamgmt.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOrganizationsClient().GetAllServerlessRuntimes(ctx, "rgopenapi", "t", 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.InformaticaServerlessRuntimeResourceList = arminformaticadatamgmt.InformaticaServerlessRuntimeResourceList{ - // InformaticaRuntimeResources: []*arminformaticadatamgmt.InfaRuntimeResourceFetchMetaData{ - // { - // Name: to.Ptr("wwhnptecwbip"), - // Type: to.Ptr(arminformaticadatamgmt.RuntimeTypeSERVERLESS), - // Description: to.Ptr("kozzyfee"), - // CreatedBy: to.Ptr("sxizcppjasypefvhacvzfhzn"), - // CreatedTime: to.Ptr("wfbezwbdyszdvwlzvthrxi"), - // ID: to.Ptr("hgnqusidmutarhmwnswhalpjzievdm"), - // ServerlessConfigProperties: &arminformaticadatamgmt.InfaServerlessFetchConfigProperties{ - // AdvancedCustomProperties: to.Ptr("pvusvtqtkhozfuqtokw"), - // ApplicationType: to.Ptr("qnrsngoycualsvmmsu"), - // ComputeUnits: to.Ptr("ao"), - // ExecutionTimeout: to.Ptr("pbnxiricrjifreoiazmzeqiwu"), - // Platform: to.Ptr("p"), - // Region: to.Ptr("lrudpuvzcuh"), - // ResourceGroupName: to.Ptr("ly"), - // ServerlessArmResourceID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Informatica.DataManagement/organizations/org1/serverlessRuntimes/serverlessRuntimeName"), - // Subnet: to.Ptr("mmhpqazmxniguwzmqiu"), - // SubscriptionID: to.Ptr("zl"), - // SupplementaryFileLocation: to.Ptr("wylmhc"), - // Tags: to.Ptr("tevuusglxuivd"), - // TenantID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // Vnet: to.Ptr("vvs"), - // }, - // Status: to.Ptr("exvtblad"), - // StatusLocalized: to.Ptr("otg"), - // StatusMessage: to.Ptr("bnosdq"), - // UpdatedBy: to.Ptr("uhsmrmagqrtfd"), - // UpdatedTime: to.Ptr("mjiscnhzzutsrsffhdqsl"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/Informatica.DataManagement/stable/2024-05-08/examples/Organizations_GetAllServerlessRuntimes_MinimumSet_Gen.json -func ExampleOrganizationsClient_GetAllServerlessRuntimes_organizationsGetAllServerlessRuntimesMin() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := arminformaticadatamgmt.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOrganizationsClient().GetAllServerlessRuntimes(ctx, "rgopenapi", "0", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.InformaticaServerlessRuntimeResourceList = arminformaticadatamgmt.InformaticaServerlessRuntimeResourceList{ - // InformaticaRuntimeResources: []*arminformaticadatamgmt.InfaRuntimeResourceFetchMetaData{ - // { - // Name: to.Ptr("wwhnptecwbip"), - // Type: to.Ptr(arminformaticadatamgmt.RuntimeTypeSERVERLESS), - // CreatedBy: to.Ptr("sxizcppjasypefvhacvzfhzn"), - // CreatedTime: to.Ptr("wfbezwbdyszdvwlzvthrxi"), - // ID: to.Ptr("hgnqusidmutarhmwnswhalpjzievdm"), - // ServerlessConfigProperties: &arminformaticadatamgmt.InfaServerlessFetchConfigProperties{ - // }, - // Status: to.Ptr("exvtblad"), - // StatusLocalized: to.Ptr("otg"), - // StatusMessage: to.Ptr("bnosdq"), - // UpdatedBy: to.Ptr("uhsmrmagqrtfd"), - // UpdatedTime: to.Ptr("mjiscnhzzutsrsffhdqsl"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/Informatica.DataManagement/stable/2024-05-08/examples/Organizations_GetServerlessMetadata_MaximumSet_Gen.json -func ExampleOrganizationsClient_GetServerlessMetadata_organizationsGetServerlessMetadata() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := arminformaticadatamgmt.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOrganizationsClient().GetServerlessMetadata(ctx, "rgopenapi", "3_UC", 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.ServerlessMetadataResponse = arminformaticadatamgmt.ServerlessMetadataResponse{ - // Type: to.Ptr(arminformaticadatamgmt.RuntimeTypeSERVERLESS), - // ServerlessConfigProperties: &arminformaticadatamgmt.ServerlessConfigProperties{ - // ApplicationTypes: []*arminformaticadatamgmt.ApplicationTypeMetadata{ - // { - // Name: to.Ptr("kdbgedaiazvoakoheguldnmhadcs"), - // Value: to.Ptr("ipbrpyvxilvqfnwktnq"), - // }}, - // ComputeUnits: []*arminformaticadatamgmt.ComputeUnitsMetadata{ - // { - // Name: to.Ptr("dvvnxwibhl"), - // Value: []*string{ - // to.Ptr("msdbcuekw")}, - // }}, - // ExecutionTimeout: to.Ptr("zmypifivoqmdpzfjhtpqzvlxol"), - // Platform: to.Ptr(arminformaticadatamgmt.PlatformTypeAZURE), - // Regions: []*arminformaticadatamgmt.RegionsMetadata{ - // { - // Name: to.Ptr("wwnertzjidsshgoesojbnaopb"), - // ID: to.Ptr("mqkbutwvzbnnisnen"), - // }}, - // }, - // ServerlessRuntimeConfigProperties: &arminformaticadatamgmt.ServerlessRuntimeConfigProperties{ - // CdiConfigProps: []*arminformaticadatamgmt.CdiConfigProps{ - // { - // ApplicationConfigs: []*arminformaticadatamgmt.ApplicationConfigs{ - // { - // Name: to.Ptr("upfvjrqcrwwedfujkmsodeinw"), - // Type: to.Ptr("lw"), - // Customized: to.Ptr("j"), - // DefaultValue: to.Ptr("zvgkqwmi"), - // Platform: to.Ptr("dixfyeobngivyvf"), - // Value: to.Ptr("mozgsetpwjmtyl"), - // }}, - // EngineName: to.Ptr("hngsdqvtjdhwqlbqfotipaiwjuys"), - // EngineVersion: to.Ptr("zlrlbg"), - // }}, - // CdieConfigProps: []*arminformaticadatamgmt.CdiConfigProps{ - // { - // ApplicationConfigs: []*arminformaticadatamgmt.ApplicationConfigs{ - // { - // Name: to.Ptr("upfvjrqcrwwedfujkmsodeinw"), - // Type: to.Ptr("lw"), - // Customized: to.Ptr("j"), - // DefaultValue: to.Ptr("zvgkqwmi"), - // Platform: to.Ptr("dixfyeobngivyvf"), - // Value: to.Ptr("mozgsetpwjmtyl"), - // }}, - // EngineName: to.Ptr("hngsdqvtjdhwqlbqfotipaiwjuys"), - // EngineVersion: to.Ptr("zlrlbg"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/Informatica.DataManagement/stable/2024-05-08/examples/Organizations_GetServerlessMetadata_MinimumSet_Gen.json -func ExampleOrganizationsClient_GetServerlessMetadata_organizationsGetServerlessMetadataMin() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := arminformaticadatamgmt.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOrganizationsClient().GetServerlessMetadata(ctx, "rgopenapi", "A", 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.ServerlessMetadataResponse = arminformaticadatamgmt.ServerlessMetadataResponse{ - // } -} diff --git a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/responses.go b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/responses.go index f2b16b344085..071b9766d75f 100644 --- a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/responses.go +++ b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/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. diff --git a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/serverlessruntimes_client.go b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/serverlessruntimes_client.go index c4143463c8b8..ec8047e752c4 100644 --- a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/serverlessruntimes_client.go +++ b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/serverlessruntimes_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. @@ -75,7 +72,7 @@ func (client *ServerlessRuntimesClient) CheckDependencies(ctx context.Context, r } // checkDependenciesCreateRequest creates the CheckDependencies request. -func (client *ServerlessRuntimesClient) checkDependenciesCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, serverlessRuntimeName string, options *ServerlessRuntimesClientCheckDependenciesOptions) (*policy.Request, error) { +func (client *ServerlessRuntimesClient) checkDependenciesCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, serverlessRuntimeName string, _ *ServerlessRuntimesClientCheckDependenciesOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Informatica.DataManagement/organizations/{organizationName}/serverlessRuntimes/{serverlessRuntimeName}/checkDependencies" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -167,7 +164,7 @@ func (client *ServerlessRuntimesClient) createOrUpdate(ctx context.Context, reso } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ServerlessRuntimesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, serverlessRuntimeName string, resource InformaticaServerlessRuntimeResource, options *ServerlessRuntimesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ServerlessRuntimesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, serverlessRuntimeName string, resource InformaticaServerlessRuntimeResource, _ *ServerlessRuntimesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Informatica.DataManagement/organizations/{organizationName}/serverlessRuntimes/{serverlessRuntimeName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -252,7 +249,7 @@ func (client *ServerlessRuntimesClient) deleteOperation(ctx context.Context, res } // deleteCreateRequest creates the Delete request. -func (client *ServerlessRuntimesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, serverlessRuntimeName string, options *ServerlessRuntimesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ServerlessRuntimesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, serverlessRuntimeName string, _ *ServerlessRuntimesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Informatica.DataManagement/organizations/{organizationName}/serverlessRuntimes/{serverlessRuntimeName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -312,7 +309,7 @@ func (client *ServerlessRuntimesClient) Get(ctx context.Context, resourceGroupNa } // getCreateRequest creates the Get request. -func (client *ServerlessRuntimesClient) getCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, serverlessRuntimeName string, options *ServerlessRuntimesClientGetOptions) (*policy.Request, error) { +func (client *ServerlessRuntimesClient) getCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, serverlessRuntimeName string, _ *ServerlessRuntimesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Informatica.DataManagement/organizations/{organizationName}/serverlessRuntimes/{serverlessRuntimeName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -381,7 +378,7 @@ func (client *ServerlessRuntimesClient) NewListByInformaticaOrganizationResource } // listByInformaticaOrganizationResourceCreateRequest creates the ListByInformaticaOrganizationResource request. -func (client *ServerlessRuntimesClient) listByInformaticaOrganizationResourceCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, options *ServerlessRuntimesClientListByInformaticaOrganizationResourceOptions) (*policy.Request, error) { +func (client *ServerlessRuntimesClient) listByInformaticaOrganizationResourceCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, _ *ServerlessRuntimesClientListByInformaticaOrganizationResourceOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Informatica.DataManagement/organizations/{organizationName}/serverlessRuntimes" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -447,7 +444,7 @@ func (client *ServerlessRuntimesClient) ServerlessResourceByID(ctx context.Conte } // serverlessResourceByIDCreateRequest creates the ServerlessResourceByID request. -func (client *ServerlessRuntimesClient) serverlessResourceByIDCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, serverlessRuntimeName string, options *ServerlessRuntimesClientServerlessResourceByIDOptions) (*policy.Request, error) { +func (client *ServerlessRuntimesClient) serverlessResourceByIDCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, serverlessRuntimeName string, _ *ServerlessRuntimesClientServerlessResourceByIDOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Informatica.DataManagement/organizations/{organizationName}/serverlessRuntimes/{serverlessRuntimeName}/serverlessResourceById" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -516,7 +513,7 @@ func (client *ServerlessRuntimesClient) StartFailedServerlessRuntime(ctx context } // startFailedServerlessRuntimeCreateRequest creates the StartFailedServerlessRuntime request. -func (client *ServerlessRuntimesClient) startFailedServerlessRuntimeCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, serverlessRuntimeName string, options *ServerlessRuntimesClientStartFailedServerlessRuntimeOptions) (*policy.Request, error) { +func (client *ServerlessRuntimesClient) startFailedServerlessRuntimeCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, serverlessRuntimeName string, _ *ServerlessRuntimesClientStartFailedServerlessRuntimeOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Informatica.DataManagement/organizations/{organizationName}/serverlessRuntimes/{serverlessRuntimeName}/startFailedServerlessRuntime" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -578,7 +575,7 @@ func (client *ServerlessRuntimesClient) Update(ctx context.Context, resourceGrou } // updateCreateRequest creates the Update request. -func (client *ServerlessRuntimesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, serverlessRuntimeName string, properties InformaticaServerlessRuntimeResourceUpdate, options *ServerlessRuntimesClientUpdateOptions) (*policy.Request, error) { +func (client *ServerlessRuntimesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, serverlessRuntimeName string, properties InformaticaServerlessRuntimeResourceUpdate, _ *ServerlessRuntimesClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Informatica.DataManagement/organizations/{organizationName}/serverlessRuntimes/{serverlessRuntimeName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/serverlessruntimes_client_example_test.go b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/serverlessruntimes_client_example_test.go deleted file mode 100644 index 8452879aab11..000000000000 --- a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/serverlessruntimes_client_example_test.go +++ /dev/null @@ -1,793 +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 arminformaticadatamgmt_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/informaticadatamgmt/arminformaticadatamgmt" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/Informatica.DataManagement/stable/2024-05-08/examples/ServerlessRuntimes_ListByInformaticaOrganizationResource_MaximumSet_Gen.json -func ExampleServerlessRuntimesClient_NewListByInformaticaOrganizationResourcePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := arminformaticadatamgmt.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewServerlessRuntimesClient().NewListByInformaticaOrganizationResourcePager("rgopenapi", "orgName", 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.InformaticaServerlessRuntimeResourceListResult = arminformaticadatamgmt.InformaticaServerlessRuntimeResourceListResult{ - // Value: []*arminformaticadatamgmt.InformaticaServerlessRuntimeResource{ - // { - // Name: to.Ptr("byzccgftqjthb"), - // Type: to.Ptr("due"), - // ID: to.Ptr("vcdjzfgqjv"), - // SystemData: &arminformaticadatamgmt.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-12-05T15:45:15.582Z"); return t}()), - // CreatedBy: to.Ptr("kocqbxulqrggzbfrifpvy"), - // CreatedByType: to.Ptr(arminformaticadatamgmt.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-12-05T15:45:15.582Z"); return t}()), - // LastModifiedBy: to.Ptr("lzpllqnildoamkmgf"), - // LastModifiedByType: to.Ptr(arminformaticadatamgmt.CreatedByTypeUser), - // }, - // Properties: &arminformaticadatamgmt.InformaticaServerlessRuntimeProperties{ - // Description: to.Ptr("mqkaenjmxakvzrwmirelmhgiedto"), - // AdvancedCustomProperties: []*arminformaticadatamgmt.AdvancedCustomProperties{ - // { - // Key: to.Ptr("qcmc"), - // Value: to.Ptr("unraxmnohdmvutt"), - // }}, - // ApplicationType: to.Ptr(arminformaticadatamgmt.ApplicationTypeCDI), - // ComputeUnits: to.Ptr("bsctukmndvowse"), - // ExecutionTimeout: to.Ptr("ruiougpypny"), - // Platform: to.Ptr(arminformaticadatamgmt.PlatformTypeAZURE), - // ProvisioningState: to.Ptr(arminformaticadatamgmt.ProvisioningStateSucceeded), - // ServerlessAccountLocation: to.Ptr("bkxdfopapbqucyhduewrubjpaei"), - // ServerlessRuntimeConfig: &arminformaticadatamgmt.ServerlessRuntimeConfigProperties{ - // CdiConfigProps: []*arminformaticadatamgmt.CdiConfigProps{ - // { - // ApplicationConfigs: []*arminformaticadatamgmt.ApplicationConfigs{ - // { - // Name: to.Ptr("upfvjrqcrwwedfujkmsodeinw"), - // Type: to.Ptr("lw"), - // Customized: to.Ptr("j"), - // DefaultValue: to.Ptr("zvgkqwmi"), - // Platform: to.Ptr("dixfyeobngivyvf"), - // Value: to.Ptr("mozgsetpwjmtyl"), - // }}, - // EngineName: to.Ptr("hngsdqvtjdhwqlbqfotipaiwjuys"), - // EngineVersion: to.Ptr("zlrlbg"), - // }}, - // CdieConfigProps: []*arminformaticadatamgmt.CdiConfigProps{ - // { - // ApplicationConfigs: []*arminformaticadatamgmt.ApplicationConfigs{ - // { - // Name: to.Ptr("upfvjrqcrwwedfujkmsodeinw"), - // Type: to.Ptr("lw"), - // Customized: to.Ptr("j"), - // DefaultValue: to.Ptr("zvgkqwmi"), - // Platform: to.Ptr("dixfyeobngivyvf"), - // Value: to.Ptr("mozgsetpwjmtyl"), - // }}, - // EngineName: to.Ptr("hngsdqvtjdhwqlbqfotipaiwjuys"), - // EngineVersion: to.Ptr("zlrlbg"), - // }}, - // }, - // ServerlessRuntimeNetworkProfile: &arminformaticadatamgmt.ServerlessRuntimeNetworkProfile{ - // NetworkInterfaceConfiguration: &arminformaticadatamgmt.NetworkInterfaceConfiguration{ - // SubnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/subnet1"), - // VnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/HypernetVnet1"), - // }, - // }, - // ServerlessRuntimeTags: []*arminformaticadatamgmt.ServerlessRuntimeTag{ - // { - // Name: to.Ptr("korveuycuwhs"), - // Value: to.Ptr("uyiuegxnkgp"), - // }}, - // ServerlessRuntimeUserContextProperties: &arminformaticadatamgmt.ServerlessRuntimeUserContextProperties{ - // UserContextToken: to.Ptr("oludf"), - // }, - // SupplementaryFileLocation: to.Ptr("zmlqtkncwgqhhupsnqluumz"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/Informatica.DataManagement/stable/2024-05-08/examples/ServerlessRuntimes_Get_MaximumSet_Gen.json -func ExampleServerlessRuntimesClient_Get_serverlessRuntimesGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := arminformaticadatamgmt.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerlessRuntimesClient().Get(ctx, "rgopenapi", "e3Y", "48-", 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.InformaticaServerlessRuntimeResource = arminformaticadatamgmt.InformaticaServerlessRuntimeResource{ - // Name: to.Ptr("byzccgftqjthb"), - // Type: to.Ptr("due"), - // ID: to.Ptr("vcdjzfgqjv"), - // SystemData: &arminformaticadatamgmt.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-12-05T15:45:15.582Z"); return t}()), - // CreatedBy: to.Ptr("kocqbxulqrggzbfrifpvy"), - // CreatedByType: to.Ptr(arminformaticadatamgmt.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-12-05T15:45:15.582Z"); return t}()), - // LastModifiedBy: to.Ptr("lzpllqnildoamkmgf"), - // LastModifiedByType: to.Ptr(arminformaticadatamgmt.CreatedByTypeUser), - // }, - // Properties: &arminformaticadatamgmt.InformaticaServerlessRuntimeProperties{ - // Description: to.Ptr("mqkaenjmxakvzrwmirelmhgiedto"), - // AdvancedCustomProperties: []*arminformaticadatamgmt.AdvancedCustomProperties{ - // { - // Key: to.Ptr("qcmc"), - // Value: to.Ptr("unraxmnohdmvutt"), - // }}, - // ApplicationType: to.Ptr(arminformaticadatamgmt.ApplicationTypeCDI), - // ComputeUnits: to.Ptr("bsctukmndvowse"), - // ExecutionTimeout: to.Ptr("ruiougpypny"), - // Platform: to.Ptr(arminformaticadatamgmt.PlatformTypeAZURE), - // ProvisioningState: to.Ptr(arminformaticadatamgmt.ProvisioningStateSucceeded), - // ServerlessAccountLocation: to.Ptr("bkxdfopapbqucyhduewrubjpaei"), - // ServerlessRuntimeConfig: &arminformaticadatamgmt.ServerlessRuntimeConfigProperties{ - // CdiConfigProps: []*arminformaticadatamgmt.CdiConfigProps{ - // { - // ApplicationConfigs: []*arminformaticadatamgmt.ApplicationConfigs{ - // { - // Name: to.Ptr("upfvjrqcrwwedfujkmsodeinw"), - // Type: to.Ptr("lw"), - // Customized: to.Ptr("j"), - // DefaultValue: to.Ptr("zvgkqwmi"), - // Platform: to.Ptr("dixfyeobngivyvf"), - // Value: to.Ptr("mozgsetpwjmtyl"), - // }}, - // EngineName: to.Ptr("hngsdqvtjdhwqlbqfotipaiwjuys"), - // EngineVersion: to.Ptr("zlrlbg"), - // }}, - // CdieConfigProps: []*arminformaticadatamgmt.CdiConfigProps{ - // { - // ApplicationConfigs: []*arminformaticadatamgmt.ApplicationConfigs{ - // { - // Name: to.Ptr("upfvjrqcrwwedfujkmsodeinw"), - // Type: to.Ptr("lw"), - // Customized: to.Ptr("j"), - // DefaultValue: to.Ptr("zvgkqwmi"), - // Platform: to.Ptr("dixfyeobngivyvf"), - // Value: to.Ptr("mozgsetpwjmtyl"), - // }}, - // EngineName: to.Ptr("hngsdqvtjdhwqlbqfotipaiwjuys"), - // EngineVersion: to.Ptr("zlrlbg"), - // }}, - // }, - // ServerlessRuntimeNetworkProfile: &arminformaticadatamgmt.ServerlessRuntimeNetworkProfile{ - // NetworkInterfaceConfiguration: &arminformaticadatamgmt.NetworkInterfaceConfiguration{ - // SubnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/subnet1"), - // VnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/HypernetVnet1"), - // VnetResourceGUID: to.Ptr("5328d299-1462-4be0-bef1-303a28e556a0"), - // }, - // }, - // ServerlessRuntimeTags: []*arminformaticadatamgmt.ServerlessRuntimeTag{ - // { - // Name: to.Ptr("korveuycuwhs"), - // Value: to.Ptr("uyiuegxnkgp"), - // }}, - // ServerlessRuntimeUserContextProperties: &arminformaticadatamgmt.ServerlessRuntimeUserContextProperties{ - // UserContextToken: to.Ptr("oludf"), - // }, - // SupplementaryFileLocation: to.Ptr("zmlqtkncwgqhhupsnqluumz"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/Informatica.DataManagement/stable/2024-05-08/examples/ServerlessRuntimes_Get_MinimumSet_Gen.json -func ExampleServerlessRuntimesClient_Get_serverlessRuntimesGetMin() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := arminformaticadatamgmt.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerlessRuntimesClient().Get(ctx, "rgopenapi", "YC", "___", 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.InformaticaServerlessRuntimeResource = arminformaticadatamgmt.InformaticaServerlessRuntimeResource{ - // ID: to.Ptr("cadokiejnrth"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/Informatica.DataManagement/stable/2024-05-08/examples/ServerlessRuntimes_CreateOrUpdate_MaximumSet_Gen.json -func ExampleServerlessRuntimesClient_BeginCreateOrUpdate_serverlessRuntimesCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := arminformaticadatamgmt.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerlessRuntimesClient().BeginCreateOrUpdate(ctx, "rgopenapi", "__C", "0j-__", arminformaticadatamgmt.InformaticaServerlessRuntimeResource{ - Properties: &arminformaticadatamgmt.InformaticaServerlessRuntimeProperties{ - Description: to.Ptr("mqkaenjmxakvzrwmirelmhgiedto"), - AdvancedCustomProperties: []*arminformaticadatamgmt.AdvancedCustomProperties{ - { - Key: to.Ptr("qcmc"), - Value: to.Ptr("unraxmnohdmvutt"), - }}, - ApplicationType: to.Ptr(arminformaticadatamgmt.ApplicationTypeCDI), - ComputeUnits: to.Ptr("bsctukmndvowse"), - ExecutionTimeout: to.Ptr("ruiougpypny"), - Platform: to.Ptr(arminformaticadatamgmt.PlatformTypeAZURE), - ProvisioningState: to.Ptr(arminformaticadatamgmt.ProvisioningStateAccepted), - ServerlessAccountLocation: to.Ptr("bkxdfopapbqucyhduewrubjpaei"), - ServerlessRuntimeConfig: &arminformaticadatamgmt.ServerlessRuntimeConfigProperties{ - CdiConfigProps: []*arminformaticadatamgmt.CdiConfigProps{ - { - ApplicationConfigs: []*arminformaticadatamgmt.ApplicationConfigs{ - { - Name: to.Ptr("upfvjrqcrwwedfujkmsodeinw"), - Type: to.Ptr("lw"), - Customized: to.Ptr("j"), - DefaultValue: to.Ptr("zvgkqwmi"), - Platform: to.Ptr("dixfyeobngivyvf"), - Value: to.Ptr("mozgsetpwjmtyl"), - }}, - EngineName: to.Ptr("hngsdqvtjdhwqlbqfotipaiwjuys"), - EngineVersion: to.Ptr("zlrlbg"), - }}, - CdieConfigProps: []*arminformaticadatamgmt.CdiConfigProps{ - { - ApplicationConfigs: []*arminformaticadatamgmt.ApplicationConfigs{ - { - Name: to.Ptr("upfvjrqcrwwedfujkmsodeinw"), - Type: to.Ptr("lw"), - Customized: to.Ptr("j"), - DefaultValue: to.Ptr("zvgkqwmi"), - Platform: to.Ptr("dixfyeobngivyvf"), - Value: to.Ptr("mozgsetpwjmtyl"), - }}, - EngineName: to.Ptr("hngsdqvtjdhwqlbqfotipaiwjuys"), - EngineVersion: to.Ptr("zlrlbg"), - }}, - }, - ServerlessRuntimeNetworkProfile: &arminformaticadatamgmt.ServerlessRuntimeNetworkProfile{ - NetworkInterfaceConfiguration: &arminformaticadatamgmt.NetworkInterfaceConfiguration{ - SubnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/subnet1"), - VnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/HypernetVnet1"), - VnetResourceGUID: to.Ptr("5328d299-1462-4be0-bef1-303a28e556a0"), - }, - }, - ServerlessRuntimeTags: []*arminformaticadatamgmt.ServerlessRuntimeTag{ - { - Name: to.Ptr("korveuycuwhs"), - Value: to.Ptr("uyiuegxnkgp"), - }}, - ServerlessRuntimeUserContextProperties: &arminformaticadatamgmt.ServerlessRuntimeUserContextProperties{ - UserContextToken: to.Ptr("oludf"), - }, - SupplementaryFileLocation: to.Ptr("zmlqtkncwgqhhupsnqluumz"), - }, - }, 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.InformaticaServerlessRuntimeResource = arminformaticadatamgmt.InformaticaServerlessRuntimeResource{ - // Name: to.Ptr("byzccgftqjthb"), - // Type: to.Ptr("due"), - // ID: to.Ptr("vcdjzfgqjv"), - // SystemData: &arminformaticadatamgmt.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-12-05T15:45:15.582Z"); return t}()), - // CreatedBy: to.Ptr("kocqbxulqrggzbfrifpvy"), - // CreatedByType: to.Ptr(arminformaticadatamgmt.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-12-05T15:45:15.582Z"); return t}()), - // LastModifiedBy: to.Ptr("lzpllqnildoamkmgf"), - // LastModifiedByType: to.Ptr(arminformaticadatamgmt.CreatedByTypeUser), - // }, - // Properties: &arminformaticadatamgmt.InformaticaServerlessRuntimeProperties{ - // Description: to.Ptr("mqkaenjmxakvzrwmirelmhgiedto"), - // AdvancedCustomProperties: []*arminformaticadatamgmt.AdvancedCustomProperties{ - // { - // Key: to.Ptr("qcmc"), - // Value: to.Ptr("unraxmnohdmvutt"), - // }}, - // ApplicationType: to.Ptr(arminformaticadatamgmt.ApplicationTypeCDI), - // ComputeUnits: to.Ptr("bsctukmndvowse"), - // ExecutionTimeout: to.Ptr("ruiougpypny"), - // Platform: to.Ptr(arminformaticadatamgmt.PlatformTypeAZURE), - // ProvisioningState: to.Ptr(arminformaticadatamgmt.ProvisioningStateSucceeded), - // ServerlessAccountLocation: to.Ptr("bkxdfopapbqucyhduewrubjpaei"), - // ServerlessRuntimeConfig: &arminformaticadatamgmt.ServerlessRuntimeConfigProperties{ - // CdiConfigProps: []*arminformaticadatamgmt.CdiConfigProps{ - // { - // ApplicationConfigs: []*arminformaticadatamgmt.ApplicationConfigs{ - // { - // Name: to.Ptr("upfvjrqcrwwedfujkmsodeinw"), - // Type: to.Ptr("lw"), - // Customized: to.Ptr("j"), - // DefaultValue: to.Ptr("zvgkqwmi"), - // Platform: to.Ptr("dixfyeobngivyvf"), - // Value: to.Ptr("mozgsetpwjmtyl"), - // }}, - // EngineName: to.Ptr("hngsdqvtjdhwqlbqfotipaiwjuys"), - // EngineVersion: to.Ptr("zlrlbg"), - // }}, - // CdieConfigProps: []*arminformaticadatamgmt.CdiConfigProps{ - // { - // ApplicationConfigs: []*arminformaticadatamgmt.ApplicationConfigs{ - // { - // Name: to.Ptr("upfvjrqcrwwedfujkmsodeinw"), - // Type: to.Ptr("lw"), - // Customized: to.Ptr("j"), - // DefaultValue: to.Ptr("zvgkqwmi"), - // Platform: to.Ptr("dixfyeobngivyvf"), - // Value: to.Ptr("mozgsetpwjmtyl"), - // }}, - // EngineName: to.Ptr("hngsdqvtjdhwqlbqfotipaiwjuys"), - // EngineVersion: to.Ptr("zlrlbg"), - // }}, - // }, - // ServerlessRuntimeNetworkProfile: &arminformaticadatamgmt.ServerlessRuntimeNetworkProfile{ - // NetworkInterfaceConfiguration: &arminformaticadatamgmt.NetworkInterfaceConfiguration{ - // SubnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/subnet1"), - // VnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/HypernetVnet1"), - // VnetResourceGUID: to.Ptr("5328d299-1462-4be0-bef1-303a28e556a0"), - // }, - // }, - // ServerlessRuntimeTags: []*arminformaticadatamgmt.ServerlessRuntimeTag{ - // { - // Name: to.Ptr("korveuycuwhs"), - // Value: to.Ptr("uyiuegxnkgp"), - // }}, - // ServerlessRuntimeUserContextProperties: &arminformaticadatamgmt.ServerlessRuntimeUserContextProperties{ - // UserContextToken: to.Ptr("oludf"), - // }, - // SupplementaryFileLocation: to.Ptr("zmlqtkncwgqhhupsnqluumz"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/Informatica.DataManagement/stable/2024-05-08/examples/ServerlessRuntimes_CreateOrUpdate_MinimumSet_Gen.json -func ExampleServerlessRuntimesClient_BeginCreateOrUpdate_serverlessRuntimesCreateOrUpdateMin() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := arminformaticadatamgmt.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerlessRuntimesClient().BeginCreateOrUpdate(ctx, "rgopenapi", "-4Z__7", "J", arminformaticadatamgmt.InformaticaServerlessRuntimeResource{}, 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.InformaticaServerlessRuntimeResource = arminformaticadatamgmt.InformaticaServerlessRuntimeResource{ - // ID: to.Ptr("cadokiejnrth"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/Informatica.DataManagement/stable/2024-05-08/examples/ServerlessRuntimes_Update_MaximumSet_Gen.json -func ExampleServerlessRuntimesClient_Update_serverlessRuntimesUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := arminformaticadatamgmt.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerlessRuntimesClient().Update(ctx, "rgopenapi", "W5", "t_", arminformaticadatamgmt.InformaticaServerlessRuntimeResourceUpdate{ - Properties: &arminformaticadatamgmt.ServerlessRuntimePropertiesCustomUpdate{ - Description: to.Ptr("ocprslpljoikxyduackzqnkuhyzrh"), - AdvancedCustomProperties: []*arminformaticadatamgmt.AdvancedCustomProperties{ - { - Key: to.Ptr("qcmc"), - Value: to.Ptr("unraxmnohdmvutt"), - }}, - ApplicationType: to.Ptr(arminformaticadatamgmt.ApplicationTypeCDI), - ComputeUnits: to.Ptr("uncwbpu"), - ExecutionTimeout: to.Ptr("tjyfytuywriabt"), - Platform: to.Ptr(arminformaticadatamgmt.PlatformTypeAZURE), - ServerlessAccountLocation: to.Ptr("goaugkyfanqfnvcmntreibqrswfpis"), - ServerlessRuntimeConfig: &arminformaticadatamgmt.ServerlessRuntimeConfigPropertiesUpdate{ - CdiConfigProps: []*arminformaticadatamgmt.CdiConfigProps{ - { - ApplicationConfigs: []*arminformaticadatamgmt.ApplicationConfigs{ - { - Name: to.Ptr("upfvjrqcrwwedfujkmsodeinw"), - Type: to.Ptr("lw"), - Customized: to.Ptr("j"), - DefaultValue: to.Ptr("zvgkqwmi"), - Platform: to.Ptr("dixfyeobngivyvf"), - Value: to.Ptr("mozgsetpwjmtyl"), - }}, - EngineName: to.Ptr("hngsdqvtjdhwqlbqfotipaiwjuys"), - EngineVersion: to.Ptr("zlrlbg"), - }}, - CdieConfigProps: []*arminformaticadatamgmt.CdiConfigProps{ - { - ApplicationConfigs: []*arminformaticadatamgmt.ApplicationConfigs{ - { - Name: to.Ptr("upfvjrqcrwwedfujkmsodeinw"), - Type: to.Ptr("lw"), - Customized: to.Ptr("j"), - DefaultValue: to.Ptr("zvgkqwmi"), - Platform: to.Ptr("dixfyeobngivyvf"), - Value: to.Ptr("mozgsetpwjmtyl"), - }}, - EngineName: to.Ptr("hngsdqvtjdhwqlbqfotipaiwjuys"), - EngineVersion: to.Ptr("zlrlbg"), - }}, - }, - ServerlessRuntimeNetworkProfile: &arminformaticadatamgmt.ServerlessRuntimeNetworkProfileUpdate{ - NetworkInterfaceConfiguration: &arminformaticadatamgmt.NetworkInterfaceConfigurationUpdate{ - SubnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/subnet1"), - VnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/HypernetVnet1"), - VnetResourceGUID: to.Ptr("5328d299-1462-4be0-bef1-303a28e556a0"), - }, - }, - ServerlessRuntimeTags: []*arminformaticadatamgmt.ServerlessRuntimeTag{ - { - Name: to.Ptr("korveuycuwhs"), - Value: to.Ptr("uyiuegxnkgp"), - }}, - ServerlessRuntimeUserContextProperties: &arminformaticadatamgmt.ServerlessRuntimeUserContextPropertiesUpdate{ - UserContextToken: to.Ptr("ctgebtvjhwh"), - }, - SupplementaryFileLocation: to.Ptr("csxaqzpxu"), - }, - }, 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.InformaticaServerlessRuntimeResource = arminformaticadatamgmt.InformaticaServerlessRuntimeResource{ - // Name: to.Ptr("byzccgftqjthb"), - // Type: to.Ptr("due"), - // ID: to.Ptr("vcdjzfgqjv"), - // SystemData: &arminformaticadatamgmt.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-12-05T15:45:15.582Z"); return t}()), - // CreatedBy: to.Ptr("kocqbxulqrggzbfrifpvy"), - // CreatedByType: to.Ptr(arminformaticadatamgmt.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-12-05T15:45:15.582Z"); return t}()), - // LastModifiedBy: to.Ptr("lzpllqnildoamkmgf"), - // LastModifiedByType: to.Ptr(arminformaticadatamgmt.CreatedByTypeUser), - // }, - // Properties: &arminformaticadatamgmt.InformaticaServerlessRuntimeProperties{ - // Description: to.Ptr("mqkaenjmxakvzrwmirelmhgiedto"), - // AdvancedCustomProperties: []*arminformaticadatamgmt.AdvancedCustomProperties{ - // { - // Key: to.Ptr("qcmc"), - // Value: to.Ptr("unraxmnohdmvutt"), - // }}, - // ApplicationType: to.Ptr(arminformaticadatamgmt.ApplicationTypeCDI), - // ComputeUnits: to.Ptr("bsctukmndvowse"), - // ExecutionTimeout: to.Ptr("ruiougpypny"), - // Platform: to.Ptr(arminformaticadatamgmt.PlatformTypeAZURE), - // ProvisioningState: to.Ptr(arminformaticadatamgmt.ProvisioningStateSucceeded), - // ServerlessAccountLocation: to.Ptr("bkxdfopapbqucyhduewrubjpaei"), - // ServerlessRuntimeConfig: &arminformaticadatamgmt.ServerlessRuntimeConfigProperties{ - // CdiConfigProps: []*arminformaticadatamgmt.CdiConfigProps{ - // { - // ApplicationConfigs: []*arminformaticadatamgmt.ApplicationConfigs{ - // { - // Name: to.Ptr("upfvjrqcrwwedfujkmsodeinw"), - // Type: to.Ptr("lw"), - // Customized: to.Ptr("j"), - // DefaultValue: to.Ptr("zvgkqwmi"), - // Platform: to.Ptr("dixfyeobngivyvf"), - // Value: to.Ptr("mozgsetpwjmtyl"), - // }}, - // EngineName: to.Ptr("hngsdqvtjdhwqlbqfotipaiwjuys"), - // EngineVersion: to.Ptr("zlrlbg"), - // }}, - // CdieConfigProps: []*arminformaticadatamgmt.CdiConfigProps{ - // { - // ApplicationConfigs: []*arminformaticadatamgmt.ApplicationConfigs{ - // { - // Name: to.Ptr("upfvjrqcrwwedfujkmsodeinw"), - // Type: to.Ptr("lw"), - // Customized: to.Ptr("j"), - // DefaultValue: to.Ptr("zvgkqwmi"), - // Platform: to.Ptr("dixfyeobngivyvf"), - // Value: to.Ptr("mozgsetpwjmtyl"), - // }}, - // EngineName: to.Ptr("hngsdqvtjdhwqlbqfotipaiwjuys"), - // EngineVersion: to.Ptr("zlrlbg"), - // }}, - // }, - // ServerlessRuntimeNetworkProfile: &arminformaticadatamgmt.ServerlessRuntimeNetworkProfile{ - // NetworkInterfaceConfiguration: &arminformaticadatamgmt.NetworkInterfaceConfiguration{ - // SubnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/subnet1"), - // VnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/HypernetVnet1"), - // VnetResourceGUID: to.Ptr("5328d299-1462-4be0-bef1-303a28e556a0"), - // }, - // }, - // ServerlessRuntimeTags: []*arminformaticadatamgmt.ServerlessRuntimeTag{ - // { - // Name: to.Ptr("korveuycuwhs"), - // Value: to.Ptr("uyiuegxnkgp"), - // }}, - // ServerlessRuntimeUserContextProperties: &arminformaticadatamgmt.ServerlessRuntimeUserContextProperties{ - // UserContextToken: to.Ptr("ctgebtvjhwh"), - // }, - // SupplementaryFileLocation: to.Ptr("zmlqtkncwgqhhupsnqluumz"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/Informatica.DataManagement/stable/2024-05-08/examples/ServerlessRuntimes_Update_MinimumSet_Gen.json -func ExampleServerlessRuntimesClient_Update_serverlessRuntimesUpdateMin() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := arminformaticadatamgmt.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerlessRuntimesClient().Update(ctx, "rgopenapi", "_f--", "8Zr__", arminformaticadatamgmt.InformaticaServerlessRuntimeResourceUpdate{}, 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.InformaticaServerlessRuntimeResource = arminformaticadatamgmt.InformaticaServerlessRuntimeResource{ - // ID: to.Ptr("cadokiejnrth"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/Informatica.DataManagement/stable/2024-05-08/examples/ServerlessRuntimes_Delete_MaximumSet_Gen.json -func ExampleServerlessRuntimesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := arminformaticadatamgmt.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewServerlessRuntimesClient().BeginDelete(ctx, "rgopenapi", "orgName", "serverlessRuntimeName", 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/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/Informatica.DataManagement/stable/2024-05-08/examples/ServerlessRuntimes_CheckDependencies_MaximumSet_Gen.json -func ExampleServerlessRuntimesClient_CheckDependencies_serverlessRuntimesCheckDependencies() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := arminformaticadatamgmt.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerlessRuntimesClient().CheckDependencies(ctx, "rgopenapi", "3P", "M", 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.CheckDependenciesResponse = arminformaticadatamgmt.CheckDependenciesResponse{ - // Count: to.Ptr[int32](28), - // ID: to.Ptr("uwjsqpxr"), - // References: []*arminformaticadatamgmt.ServerlessRuntimeDependency{ - // { - // Path: to.Ptr("yxbpmcmfhhtht"), - // Description: to.Ptr("vlkyqkevlrpge"), - // AppContextID: to.Ptr("t"), - // DocumentType: to.Ptr("jpcz"), - // ID: to.Ptr("uzp"), - // LastUpdatedTime: to.Ptr("yyf"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/Informatica.DataManagement/stable/2024-05-08/examples/ServerlessRuntimes_CheckDependencies_MinimumSet_Gen.json -func ExampleServerlessRuntimesClient_CheckDependencies_serverlessRuntimesCheckDependenciesMin() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := arminformaticadatamgmt.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerlessRuntimesClient().CheckDependencies(ctx, "rgopenapi", "_-", "_2_", 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.CheckDependenciesResponse = arminformaticadatamgmt.CheckDependenciesResponse{ - // Count: to.Ptr[int32](28), - // ID: to.Ptr("uwjsqpxr"), - // References: []*arminformaticadatamgmt.ServerlessRuntimeDependency{ - // { - // Path: to.Ptr("yxbpmcmfhhtht"), - // Description: to.Ptr("vlkyqkevlrpge"), - // AppContextID: to.Ptr("t"), - // DocumentType: to.Ptr("jpcz"), - // ID: to.Ptr("uzp"), - // LastUpdatedTime: to.Ptr("yyf"), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/Informatica.DataManagement/stable/2024-05-08/examples/ServerlessRuntimes_ServerlessResourceById_MaximumSet_Gen.json -func ExampleServerlessRuntimesClient_ServerlessResourceByID() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := arminformaticadatamgmt.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewServerlessRuntimesClient().ServerlessResourceByID(ctx, "rgopenapi", "_RD_R", "serverlessRuntimeName159", 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.InformaticaServerlessRuntimeResource = arminformaticadatamgmt.InformaticaServerlessRuntimeResource{ - // Name: to.Ptr("byzccgftqjthb"), - // Type: to.Ptr("due"), - // ID: to.Ptr("vcdjzfgqjv"), - // SystemData: &arminformaticadatamgmt.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-12-05T15:45:15.582Z"); return t}()), - // CreatedBy: to.Ptr("kocqbxulqrggzbfrifpvy"), - // CreatedByType: to.Ptr(arminformaticadatamgmt.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-12-05T15:45:15.582Z"); return t}()), - // LastModifiedBy: to.Ptr("lzpllqnildoamkmgf"), - // LastModifiedByType: to.Ptr(arminformaticadatamgmt.CreatedByTypeUser), - // }, - // Properties: &arminformaticadatamgmt.InformaticaServerlessRuntimeProperties{ - // Description: to.Ptr("mqkaenjmxakvzrwmirelmhgiedto"), - // AdvancedCustomProperties: []*arminformaticadatamgmt.AdvancedCustomProperties{ - // { - // Key: to.Ptr("qcmc"), - // Value: to.Ptr("unraxmnohdmvutt"), - // }}, - // ApplicationType: to.Ptr(arminformaticadatamgmt.ApplicationTypeCDI), - // ComputeUnits: to.Ptr("bsctukmndvowse"), - // ExecutionTimeout: to.Ptr("ruiougpypny"), - // Platform: to.Ptr(arminformaticadatamgmt.PlatformTypeAZURE), - // ProvisioningState: to.Ptr(arminformaticadatamgmt.ProvisioningStateSucceeded), - // ServerlessAccountLocation: to.Ptr("bkxdfopapbqucyhduewrubjpaei"), - // ServerlessRuntimeConfig: &arminformaticadatamgmt.ServerlessRuntimeConfigProperties{ - // CdiConfigProps: []*arminformaticadatamgmt.CdiConfigProps{ - // { - // ApplicationConfigs: []*arminformaticadatamgmt.ApplicationConfigs{ - // { - // Name: to.Ptr("upfvjrqcrwwedfujkmsodeinw"), - // Type: to.Ptr("lw"), - // Customized: to.Ptr("j"), - // DefaultValue: to.Ptr("zvgkqwmi"), - // Platform: to.Ptr("dixfyeobngivyvf"), - // Value: to.Ptr("mozgsetpwjmtyl"), - // }}, - // EngineName: to.Ptr("hngsdqvtjdhwqlbqfotipaiwjuys"), - // EngineVersion: to.Ptr("zlrlbg"), - // }}, - // CdieConfigProps: []*arminformaticadatamgmt.CdiConfigProps{ - // { - // ApplicationConfigs: []*arminformaticadatamgmt.ApplicationConfigs{ - // { - // Name: to.Ptr("upfvjrqcrwwedfujkmsodeinw"), - // Type: to.Ptr("lw"), - // Customized: to.Ptr("j"), - // DefaultValue: to.Ptr("zvgkqwmi"), - // Platform: to.Ptr("dixfyeobngivyvf"), - // Value: to.Ptr("mozgsetpwjmtyl"), - // }}, - // EngineName: to.Ptr("hngsdqvtjdhwqlbqfotipaiwjuys"), - // EngineVersion: to.Ptr("zlrlbg"), - // }}, - // }, - // ServerlessRuntimeNetworkProfile: &arminformaticadatamgmt.ServerlessRuntimeNetworkProfile{ - // NetworkInterfaceConfiguration: &arminformaticadatamgmt.NetworkInterfaceConfiguration{ - // SubnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Networks/virtualNetworks/test-vnet/subnets/subnet1"), - // VnetID: to.Ptr("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/HypernetVnet1"), - // VnetResourceGUID: to.Ptr("5328d299-1462-4be0-bef1-303a28e556a0"), - // }, - // }, - // ServerlessRuntimeTags: []*arminformaticadatamgmt.ServerlessRuntimeTag{ - // { - // Name: to.Ptr("korveuycuwhs"), - // Value: to.Ptr("uyiuegxnkgp"), - // }}, - // ServerlessRuntimeUserContextProperties: &arminformaticadatamgmt.ServerlessRuntimeUserContextProperties{ - // UserContextToken: to.Ptr("oludf"), - // }, - // SupplementaryFileLocation: to.Ptr("zmlqtkncwgqhhupsnqluumz"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/56537883b7cdb95618c3d1ec1c0ee37b59d88d72/specification/informatica/resource-manager/Informatica.DataManagement/stable/2024-05-08/examples/ServerlessRuntimes_StartFailedServerlessRuntime_MaximumSet_Gen.json -func ExampleServerlessRuntimesClient_StartFailedServerlessRuntime() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := arminformaticadatamgmt.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewServerlessRuntimesClient().StartFailedServerlessRuntime(ctx, "rgopenapi", "9M4", "-25-G_", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/time_rfc3339.go b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/time_rfc3339.go index 6a571a431ba2..f6599a1d4808 100644 --- a/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/time_rfc3339.go +++ b/sdk/resourcemanager/informaticadatamgmt/arminformaticadatamgmt/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. @@ -60,6 +57,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string diff --git a/sdk/resourcemanager/liftrqumulo/armqumulo/CHANGELOG.md b/sdk/resourcemanager/liftrqumulo/armqumulo/CHANGELOG.md index d9bf9ac599cf..4046e374809f 100644 --- a/sdk/resourcemanager/liftrqumulo/armqumulo/CHANGELOG.md +++ b/sdk/resourcemanager/liftrqumulo/armqumulo/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 2.0.1 (2025-04-27) +### Other Changes + + ## 2.0.0 (2024-07-31) ### Breaking Changes diff --git a/sdk/resourcemanager/liftrqumulo/armqumulo/autorest.md b/sdk/resourcemanager/liftrqumulo/armqumulo/autorest.md index 3724ed280693..dc3fee7a4f8c 100644 --- a/sdk/resourcemanager/liftrqumulo/armqumulo/autorest.md +++ b/sdk/resourcemanager/liftrqumulo/armqumulo/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/72de08114673a547de8a017c85ed89a2017a86f7/specification/liftrqumulo/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/72de08114673a547de8a017c85ed89a2017a86f7/specification/liftrqumulo/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/liftrqumulo/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/liftrqumulo/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 2.0.0 -tag: package-2024-06-19 +module-version: 2.0.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/liftrqumulo/armqumulo/client_factory.go b/sdk/resourcemanager/liftrqumulo/armqumulo/client_factory.go index 3338f400dc0b..8b033cd913d8 100644 --- a/sdk/resourcemanager/liftrqumulo/armqumulo/client_factory.go +++ b/sdk/resourcemanager/liftrqumulo/armqumulo/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. diff --git a/sdk/resourcemanager/liftrqumulo/armqumulo/constants.go b/sdk/resourcemanager/liftrqumulo/armqumulo/constants.go index 4760ab6a01bf..55a3231ab2b7 100644 --- a/sdk/resourcemanager/liftrqumulo/armqumulo/constants.go +++ b/sdk/resourcemanager/liftrqumulo/armqumulo/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 armqumulo const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/liftrqumulo/armqumulo" - moduleVersion = "v2.0.0" + moduleVersion = "v2.0.1" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/liftrqumulo/armqumulo/fake/filesystems_server.go b/sdk/resourcemanager/liftrqumulo/armqumulo/fake/filesystems_server.go index 68452c12506f..3985a4bf5421 100644 --- a/sdk/resourcemanager/liftrqumulo/armqumulo/fake/filesystems_server.go +++ b/sdk/resourcemanager/liftrqumulo/armqumulo/fake/filesystems_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. @@ -29,7 +26,7 @@ type FileSystemsServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, fileSystemName string, resource armqumulo.FileSystemResource, options *armqumulo.FileSystemsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armqumulo.FileSystemsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method FileSystemsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, fileSystemName string, options *armqumulo.FileSystemsClientBeginDeleteOptions) (resp azfake.PollerResponder[armqumulo.FileSystemsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method FileSystemsClient.Get @@ -80,31 +77,50 @@ func (f *FileSystemsServerTransport) Do(req *http.Request) (*http.Response, erro return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return f.dispatchToMethodFake(req, method) +} - switch method { - case "FileSystemsClient.BeginCreateOrUpdate": - resp, err = f.dispatchBeginCreateOrUpdate(req) - case "FileSystemsClient.BeginDelete": - resp, err = f.dispatchBeginDelete(req) - case "FileSystemsClient.Get": - resp, err = f.dispatchGet(req) - case "FileSystemsClient.NewListByResourceGroupPager": - resp, err = f.dispatchNewListByResourceGroupPager(req) - case "FileSystemsClient.NewListBySubscriptionPager": - resp, err = f.dispatchNewListBySubscriptionPager(req) - case "FileSystemsClient.Update": - resp, err = f.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (f *FileSystemsServerTransport) 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 fileSystemsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = fileSystemsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "FileSystemsClient.BeginCreateOrUpdate": + res.resp, res.err = f.dispatchBeginCreateOrUpdate(req) + case "FileSystemsClient.BeginDelete": + res.resp, res.err = f.dispatchBeginDelete(req) + case "FileSystemsClient.Get": + res.resp, res.err = f.dispatchGet(req) + case "FileSystemsClient.NewListByResourceGroupPager": + res.resp, res.err = f.dispatchNewListByResourceGroupPager(req) + case "FileSystemsClient.NewListBySubscriptionPager": + res.resp, res.err = f.dispatchNewListBySubscriptionPager(req) + case "FileSystemsClient.Update": + res.resp, res.err = f.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (f *FileSystemsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -188,9 +204,9 @@ func (f *FileSystemsServerTransport) dispatchBeginDelete(req *http.Request) (*ht return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { f.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { f.beginDelete.remove(req) @@ -338,3 +354,9 @@ func (f *FileSystemsServerTransport) dispatchUpdate(req *http.Request) (*http.Re } return resp, nil } + +// set this to conditionally intercept incoming requests to FileSystemsServerTransport +var fileSystemsServerTransportInterceptor 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/liftrqumulo/armqumulo/fake/internal.go b/sdk/resourcemanager/liftrqumulo/armqumulo/fake/internal.go index 5f75802a569e..4b65adc76adb 100644 --- a/sdk/resourcemanager/liftrqumulo/armqumulo/fake/internal.go +++ b/sdk/resourcemanager/liftrqumulo/armqumulo/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/liftrqumulo/armqumulo/fake/operations_server.go b/sdk/resourcemanager/liftrqumulo/armqumulo/fake/operations_server.go index 3af08268151c..9deced2e4750 100644 --- a/sdk/resourcemanager/liftrqumulo/armqumulo/fake/operations_server.go +++ b/sdk/resourcemanager/liftrqumulo/armqumulo/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. @@ -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/liftrqumulo/armqumulo/fake/server_factory.go b/sdk/resourcemanager/liftrqumulo/armqumulo/fake/server_factory.go index bfefcaab85d3..e93d1ce3ce54 100644 --- a/sdk/resourcemanager/liftrqumulo/armqumulo/fake/server_factory.go +++ b/sdk/resourcemanager/liftrqumulo/armqumulo/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,8 +16,11 @@ import ( // ServerFactory is a fake server for instances of the armqumulo.ClientFactory type. type ServerFactory struct { + // FileSystemsServer contains the fakes for client FileSystemsClient FileSystemsServer FileSystemsServer - OperationsServer OperationsServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. diff --git a/sdk/resourcemanager/liftrqumulo/armqumulo/fake/time_rfc3339.go b/sdk/resourcemanager/liftrqumulo/armqumulo/fake/time_rfc3339.go deleted file mode 100644 index 81f308b0d343..000000000000 --- a/sdk/resourcemanager/liftrqumulo/armqumulo/fake/time_rfc3339.go +++ /dev/null @@ -1,110 +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 ( - utcDateTime = "2006-01-02T15:04:05.999999999" - utcDateTimeJSON = `"` + utcDateTime + `"` - utcDateTimeNoT = "2006-01-02 15:04:05.999999999" - utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` - dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` - dateTimeJSON = `"` + time.RFC3339Nano + `"` - dateTimeJSONNoT = `"` + dateTimeNoT + `"` -) - -type dateTimeRFC3339 time.Time - -func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalJSON() -} - -func (t dateTimeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalText() -} - -func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = dateTimeJSON - } else if tzOffset { - layout = dateTimeJSONNoT - } else if hasT { - layout = utcDateTimeJSON - } else { - layout = utcDateTimeJSONNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = time.RFC3339Nano - } else if tzOffset { - layout = dateTimeNoT - } else if hasT { - layout = utcDateTime - } else { - layout = utcDateTimeNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = dateTimeRFC3339(p) - return err -} - -func (t dateTimeRFC3339) String() string { - return time.Time(t).Format(time.RFC3339Nano) -} - -func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*dateTimeRFC3339)(t) -} - -func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || string(data) == "null" { - return nil - } - var aux dateTimeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/liftrqumulo/armqumulo/filesystems_client.go b/sdk/resourcemanager/liftrqumulo/armqumulo/filesystems_client.go index 12bd1d3c07b6..11b1e82fb670 100644 --- a/sdk/resourcemanager/liftrqumulo/armqumulo/filesystems_client.go +++ b/sdk/resourcemanager/liftrqumulo/armqumulo/filesystems_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. @@ -96,7 +93,7 @@ func (client *FileSystemsClient) createOrUpdate(ctx context.Context, resourceGro } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *FileSystemsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, fileSystemName string, resource FileSystemResource, options *FileSystemsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *FileSystemsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, fileSystemName string, resource FileSystemResource, _ *FileSystemsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Qumulo.Storage/fileSystems/{fileSystemName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -175,7 +172,7 @@ func (client *FileSystemsClient) deleteOperation(ctx context.Context, resourceGr } // deleteCreateRequest creates the Delete request. -func (client *FileSystemsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, fileSystemName string, options *FileSystemsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *FileSystemsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, fileSystemName string, _ *FileSystemsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Qumulo.Storage/fileSystems/{fileSystemName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -230,7 +227,7 @@ func (client *FileSystemsClient) Get(ctx context.Context, resourceGroupName stri } // getCreateRequest creates the Get request. -func (client *FileSystemsClient) getCreateRequest(ctx context.Context, resourceGroupName string, fileSystemName string, options *FileSystemsClientGetOptions) (*policy.Request, error) { +func (client *FileSystemsClient) getCreateRequest(ctx context.Context, resourceGroupName string, fileSystemName string, _ *FileSystemsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Qumulo.Storage/fileSystems/{fileSystemName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -294,7 +291,7 @@ func (client *FileSystemsClient) NewListByResourceGroupPager(resourceGroupName s } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *FileSystemsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *FileSystemsClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *FileSystemsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *FileSystemsClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Qumulo.Storage/fileSystems" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -353,7 +350,7 @@ func (client *FileSystemsClient) NewListBySubscriptionPager(options *FileSystems } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *FileSystemsClient) listBySubscriptionCreateRequest(ctx context.Context, options *FileSystemsClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *FileSystemsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *FileSystemsClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Qumulo.Storage/fileSystems" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -410,7 +407,7 @@ func (client *FileSystemsClient) Update(ctx context.Context, resourceGroupName s } // updateCreateRequest creates the Update request. -func (client *FileSystemsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, fileSystemName string, properties FileSystemResourceUpdate, options *FileSystemsClientUpdateOptions) (*policy.Request, error) { +func (client *FileSystemsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, fileSystemName string, properties FileSystemResourceUpdate, _ *FileSystemsClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Qumulo.Storage/fileSystems/{fileSystemName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/liftrqumulo/armqumulo/filesystems_client_example_test.go b/sdk/resourcemanager/liftrqumulo/armqumulo/filesystems_client_example_test.go deleted file mode 100644 index 202000fee1d5..000000000000 --- a/sdk/resourcemanager/liftrqumulo/armqumulo/filesystems_client_example_test.go +++ /dev/null @@ -1,697 +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 armqumulo_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/liftrqumulo/armqumulo/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/72de08114673a547de8a017c85ed89a2017a86f7/specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2024-06-19/examples/FileSystems_ListBySubscription_MaximumSet_Gen.json -func ExampleFileSystemsClient_NewListBySubscriptionPager_fileSystemsListBySubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armqumulo.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewFileSystemsClient().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.FileSystemResourceListResult = armqumulo.FileSystemResourceListResult{ - // Value: []*armqumulo.FileSystemResource{ - // { - // Name: to.Ptr("stftolw"), - // Type: to.Ptr("wj"), - // ID: to.Ptr("rfta"), - // SystemData: &armqumulo.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-21T08:11:54.895Z"); return t}()), - // CreatedBy: to.Ptr("usnkckwkizihezb"), - // CreatedByType: to.Ptr(armqumulo.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-21T08:11:54.895Z"); return t}()), - // LastModifiedBy: to.Ptr("yjsiqdgtsmycxlncjceemlucn"), - // LastModifiedByType: to.Ptr(armqumulo.CreatedByTypeUser), - // }, - // Location: to.Ptr("pnb"), - // Tags: map[string]*string{ - // "key7090": to.Ptr("rurrdiaqp"), - // }, - // Identity: &armqumulo.ManagedServiceIdentity{ - // Type: to.Ptr(armqumulo.ManagedServiceIdentityTypeNone), - // PrincipalID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // TenantID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // UserAssignedIdentities: map[string]*armqumulo.UserAssignedIdentity{ - // "key7679": &armqumulo.UserAssignedIdentity{ - // ClientID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // PrincipalID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // }, - // }, - // }, - // Properties: &armqumulo.FileSystemResourceProperties{ - // AvailabilityZone: to.Ptr("eqdvbdiuwmhhzqzmksmwllpddqquwt"), - // ClusterLoginURL: to.Ptr("ykaynsjvhihdthkkvvodjrgc"), - // DelegatedSubnetID: to.Ptr("jykmxrf"), - // MarketplaceDetails: &armqumulo.MarketplaceDetails{ - // MarketplaceSubscriptionID: to.Ptr("xaqtkloiyovmexqhn"), - // MarketplaceSubscriptionStatus: to.Ptr(armqumulo.MarketplaceSubscriptionStatusPendingFulfillmentStart), - // OfferID: to.Ptr("s"), - // PlanID: to.Ptr("fwtpz"), - // PublisherID: to.Ptr("czxcfrwodazyaft"), - // TermUnit: to.Ptr("cfwwczmygsimcyvoclcw"), - // }, - // PrivateIPs: []*string{ - // to.Ptr("gzken")}, - // ProvisioningState: to.Ptr(armqumulo.ProvisioningStateSucceeded), - // StorageSKU: to.Ptr("yhyzby"), - // UserDetails: &armqumulo.UserDetails{ - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/72de08114673a547de8a017c85ed89a2017a86f7/specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2024-06-19/examples/FileSystems_ListBySubscription_MinimumSet_Gen.json -func ExampleFileSystemsClient_NewListBySubscriptionPager_fileSystemsListBySubscriptionMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armqumulo.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewFileSystemsClient().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.FileSystemResourceListResult = armqumulo.FileSystemResourceListResult{ - // Value: []*armqumulo.FileSystemResource{ - // { - // Name: to.Ptr("aaaaa"), - // ID: to.Ptr("aaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Properties: &armqumulo.FileSystemResourceProperties{ - // DelegatedSubnetID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // MarketplaceDetails: &armqumulo.MarketplaceDetails{ - // MarketplaceSubscriptionID: to.Ptr("aaaaaaaaaaaaaaaaa"), - // MarketplaceSubscriptionStatus: to.Ptr(armqumulo.MarketplaceSubscriptionStatusPendingFulfillmentStart), - // OfferID: to.Ptr("aaaaaaaaa"), - // PlanID: to.Ptr("aaaaaaa"), - // }, - // ProvisioningState: to.Ptr(armqumulo.ProvisioningStateSucceeded), - // StorageSKU: to.Ptr("Standard"), - // UserDetails: &armqumulo.UserDetails{ - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/72de08114673a547de8a017c85ed89a2017a86f7/specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2024-06-19/examples/FileSystems_ListByResourceGroup_MaximumSet_Gen.json -func ExampleFileSystemsClient_NewListByResourceGroupPager_fileSystemsListByResourceGroup() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armqumulo.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewFileSystemsClient().NewListByResourceGroupPager("rgQumulo", 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.FileSystemResourceListResult = armqumulo.FileSystemResourceListResult{ - // Value: []*armqumulo.FileSystemResource{ - // { - // Name: to.Ptr("stftolw"), - // Type: to.Ptr("wj"), - // ID: to.Ptr("rfta"), - // SystemData: &armqumulo.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-21T08:11:54.895Z"); return t}()), - // CreatedBy: to.Ptr("usnkckwkizihezb"), - // CreatedByType: to.Ptr(armqumulo.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-21T08:11:54.895Z"); return t}()), - // LastModifiedBy: to.Ptr("yjsiqdgtsmycxlncjceemlucn"), - // LastModifiedByType: to.Ptr(armqumulo.CreatedByTypeUser), - // }, - // Location: to.Ptr("pnb"), - // Tags: map[string]*string{ - // "key7090": to.Ptr("rurrdiaqp"), - // }, - // Identity: &armqumulo.ManagedServiceIdentity{ - // Type: to.Ptr(armqumulo.ManagedServiceIdentityTypeNone), - // PrincipalID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // TenantID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // UserAssignedIdentities: map[string]*armqumulo.UserAssignedIdentity{ - // "key7679": &armqumulo.UserAssignedIdentity{ - // ClientID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // PrincipalID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // }, - // }, - // }, - // Properties: &armqumulo.FileSystemResourceProperties{ - // AvailabilityZone: to.Ptr("eqdvbdiuwmhhzqzmksmwllpddqquwt"), - // ClusterLoginURL: to.Ptr("ykaynsjvhihdthkkvvodjrgc"), - // DelegatedSubnetID: to.Ptr("jykmxrf"), - // MarketplaceDetails: &armqumulo.MarketplaceDetails{ - // MarketplaceSubscriptionID: to.Ptr("xaqtkloiyovmexqhn"), - // MarketplaceSubscriptionStatus: to.Ptr(armqumulo.MarketplaceSubscriptionStatusPendingFulfillmentStart), - // OfferID: to.Ptr("s"), - // PlanID: to.Ptr("fwtpz"), - // PublisherID: to.Ptr("czxcfrwodazyaft"), - // TermUnit: to.Ptr("cfwwczmygsimcyvoclcw"), - // }, - // PrivateIPs: []*string{ - // to.Ptr("gzken")}, - // ProvisioningState: to.Ptr(armqumulo.ProvisioningStateSucceeded), - // StorageSKU: to.Ptr("yhyzby"), - // UserDetails: &armqumulo.UserDetails{ - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/72de08114673a547de8a017c85ed89a2017a86f7/specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2024-06-19/examples/FileSystems_ListByResourceGroup_MinimumSet_Gen.json -func ExampleFileSystemsClient_NewListByResourceGroupPager_fileSystemsListByResourceGroupMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armqumulo.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewFileSystemsClient().NewListByResourceGroupPager("rgQumulo", 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.FileSystemResourceListResult = armqumulo.FileSystemResourceListResult{ - // Value: []*armqumulo.FileSystemResource{ - // { - // Name: to.Ptr("aaaaa"), - // ID: to.Ptr("aaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Properties: &armqumulo.FileSystemResourceProperties{ - // DelegatedSubnetID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // MarketplaceDetails: &armqumulo.MarketplaceDetails{ - // MarketplaceSubscriptionID: to.Ptr("aaaaaaaaaaaaaaaaa"), - // MarketplaceSubscriptionStatus: to.Ptr(armqumulo.MarketplaceSubscriptionStatusPendingFulfillmentStart), - // OfferID: to.Ptr("aaaaaaaaa"), - // PlanID: to.Ptr("aaaaaaa"), - // }, - // ProvisioningState: to.Ptr(armqumulo.ProvisioningStateSucceeded), - // StorageSKU: to.Ptr("Standard"), - // UserDetails: &armqumulo.UserDetails{ - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/72de08114673a547de8a017c85ed89a2017a86f7/specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2024-06-19/examples/FileSystems_Get_MaximumSet_Gen.json -func ExampleFileSystemsClient_Get_fileSystemsGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armqumulo.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFileSystemsClient().Get(ctx, "rgQumulo", "sihbehcisdqtqqyfiewiiaphgh", 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.FileSystemResource = armqumulo.FileSystemResource{ - // Name: to.Ptr("stftolw"), - // Type: to.Ptr("wj"), - // ID: to.Ptr("rfta"), - // SystemData: &armqumulo.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-21T08:11:54.895Z"); return t}()), - // CreatedBy: to.Ptr("usnkckwkizihezb"), - // CreatedByType: to.Ptr(armqumulo.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-21T08:11:54.895Z"); return t}()), - // LastModifiedBy: to.Ptr("yjsiqdgtsmycxlncjceemlucn"), - // LastModifiedByType: to.Ptr(armqumulo.CreatedByTypeUser), - // }, - // Location: to.Ptr("pnb"), - // Tags: map[string]*string{ - // "key7090": to.Ptr("rurrdiaqp"), - // }, - // Identity: &armqumulo.ManagedServiceIdentity{ - // Type: to.Ptr(armqumulo.ManagedServiceIdentityTypeNone), - // PrincipalID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // TenantID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // UserAssignedIdentities: map[string]*armqumulo.UserAssignedIdentity{ - // "key7679": &armqumulo.UserAssignedIdentity{ - // ClientID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // PrincipalID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // }, - // }, - // }, - // Properties: &armqumulo.FileSystemResourceProperties{ - // AvailabilityZone: to.Ptr("eqdvbdiuwmhhzqzmksmwllpddqquwt"), - // ClusterLoginURL: to.Ptr("ykaynsjvhihdthkkvvodjrgc"), - // DelegatedSubnetID: to.Ptr("jykmxrf"), - // MarketplaceDetails: &armqumulo.MarketplaceDetails{ - // MarketplaceSubscriptionID: to.Ptr("xaqtkloiyovmexqhn"), - // MarketplaceSubscriptionStatus: to.Ptr(armqumulo.MarketplaceSubscriptionStatusPendingFulfillmentStart), - // OfferID: to.Ptr("s"), - // PlanID: to.Ptr("fwtpz"), - // PublisherID: to.Ptr("czxcfrwodazyaft"), - // TermUnit: to.Ptr("cfwwczmygsimcyvoclcw"), - // }, - // PrivateIPs: []*string{ - // to.Ptr("gzken")}, - // ProvisioningState: to.Ptr(armqumulo.ProvisioningStateSucceeded), - // StorageSKU: to.Ptr("yhyzby"), - // UserDetails: &armqumulo.UserDetails{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/72de08114673a547de8a017c85ed89a2017a86f7/specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2024-06-19/examples/FileSystems_Get_MinimumSet_Gen.json -func ExampleFileSystemsClient_Get_fileSystemsGetMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armqumulo.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFileSystemsClient().Get(ctx, "rgQumulo", "aaaaaaaaaaaaaaaaa", 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.FileSystemResource = armqumulo.FileSystemResource{ - // Name: to.Ptr("aaaaa"), - // ID: to.Ptr("aaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Properties: &armqumulo.FileSystemResourceProperties{ - // DelegatedSubnetID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // MarketplaceDetails: &armqumulo.MarketplaceDetails{ - // MarketplaceSubscriptionID: to.Ptr("aaaaaaaaaaaaaaaaa"), - // MarketplaceSubscriptionStatus: to.Ptr(armqumulo.MarketplaceSubscriptionStatusPendingFulfillmentStart), - // OfferID: to.Ptr("aaaaaaaaa"), - // PlanID: to.Ptr("aaaaaaa"), - // TermUnit: to.Ptr("zxv"), - // }, - // ProvisioningState: to.Ptr(armqumulo.ProvisioningStateSucceeded), - // StorageSKU: to.Ptr("Standard"), - // UserDetails: &armqumulo.UserDetails{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/72de08114673a547de8a017c85ed89a2017a86f7/specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2024-06-19/examples/FileSystems_CreateOrUpdate_MaximumSet_Gen.json -func ExampleFileSystemsClient_BeginCreateOrUpdate_fileSystemsCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armqumulo.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFileSystemsClient().BeginCreateOrUpdate(ctx, "rgQumulo", "hfcmtgaes", armqumulo.FileSystemResource{ - Location: to.Ptr("pnb"), - Tags: map[string]*string{ - "key7090": to.Ptr("rurrdiaqp"), - }, - Identity: &armqumulo.ManagedServiceIdentity{ - Type: to.Ptr(armqumulo.ManagedServiceIdentityTypeNone), - UserAssignedIdentities: map[string]*armqumulo.UserAssignedIdentity{ - "key7679": {}, - }, - }, - Properties: &armqumulo.FileSystemResourceProperties{ - AdminPassword: to.Ptr("fakeTestSecretPlaceholder"), - AvailabilityZone: to.Ptr("eqdvbdiuwmhhzqzmksmwllpddqquwt"), - ClusterLoginURL: to.Ptr("ykaynsjvhihdthkkvvodjrgc"), - DelegatedSubnetID: to.Ptr("jykmxrf"), - MarketplaceDetails: &armqumulo.MarketplaceDetails{ - MarketplaceSubscriptionID: to.Ptr("xaqtkloiyovmexqhn"), - MarketplaceSubscriptionStatus: to.Ptr(armqumulo.MarketplaceSubscriptionStatusPendingFulfillmentStart), - OfferID: to.Ptr("s"), - PlanID: to.Ptr("fwtpz"), - PublisherID: to.Ptr("czxcfrwodazyaft"), - TermUnit: to.Ptr("cfwwczmygsimcyvoclcw"), - }, - PrivateIPs: []*string{ - to.Ptr("gzken")}, - StorageSKU: to.Ptr("yhyzby"), - UserDetails: &armqumulo.UserDetails{ - Email: to.Ptr("aqsnzyroo"), - }, - }, - }, 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.FileSystemResource = armqumulo.FileSystemResource{ - // Name: to.Ptr("stftolw"), - // Type: to.Ptr("wj"), - // ID: to.Ptr("rfta"), - // SystemData: &armqumulo.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-21T08:11:54.895Z"); return t}()), - // CreatedBy: to.Ptr("usnkckwkizihezb"), - // CreatedByType: to.Ptr(armqumulo.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-21T08:11:54.895Z"); return t}()), - // LastModifiedBy: to.Ptr("yjsiqdgtsmycxlncjceemlucn"), - // LastModifiedByType: to.Ptr(armqumulo.CreatedByTypeUser), - // }, - // Location: to.Ptr("pnb"), - // Tags: map[string]*string{ - // "key7090": to.Ptr("rurrdiaqp"), - // }, - // Identity: &armqumulo.ManagedServiceIdentity{ - // Type: to.Ptr(armqumulo.ManagedServiceIdentityTypeNone), - // PrincipalID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // TenantID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // UserAssignedIdentities: map[string]*armqumulo.UserAssignedIdentity{ - // "key7679": &armqumulo.UserAssignedIdentity{ - // ClientID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // PrincipalID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // }, - // }, - // }, - // Properties: &armqumulo.FileSystemResourceProperties{ - // AvailabilityZone: to.Ptr("eqdvbdiuwmhhzqzmksmwllpddqquwt"), - // ClusterLoginURL: to.Ptr("ykaynsjvhihdthkkvvodjrgc"), - // DelegatedSubnetID: to.Ptr("jykmxrf"), - // MarketplaceDetails: &armqumulo.MarketplaceDetails{ - // MarketplaceSubscriptionID: to.Ptr("xaqtkloiyovmexqhn"), - // MarketplaceSubscriptionStatus: to.Ptr(armqumulo.MarketplaceSubscriptionStatusPendingFulfillmentStart), - // OfferID: to.Ptr("s"), - // PlanID: to.Ptr("fwtpz"), - // PublisherID: to.Ptr("czxcfrwodazyaft"), - // TermUnit: to.Ptr("cfwwczmygsimcyvoclcw"), - // }, - // PrivateIPs: []*string{ - // to.Ptr("gzken")}, - // ProvisioningState: to.Ptr(armqumulo.ProvisioningStateSucceeded), - // StorageSKU: to.Ptr("yhyzby"), - // UserDetails: &armqumulo.UserDetails{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/72de08114673a547de8a017c85ed89a2017a86f7/specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2024-06-19/examples/FileSystems_CreateOrUpdate_MinimumSet_Gen.json -func ExampleFileSystemsClient_BeginCreateOrUpdate_fileSystemsCreateOrUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armqumulo.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFileSystemsClient().BeginCreateOrUpdate(ctx, "rgopenapi", "aaaaaaaa", armqumulo.FileSystemResource{ - Location: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - Properties: &armqumulo.FileSystemResourceProperties{ - AdminPassword: to.Ptr("fakeTestSecretPlaceholder"), - DelegatedSubnetID: to.Ptr("aaaaaaaaaa"), - MarketplaceDetails: &armqumulo.MarketplaceDetails{ - MarketplaceSubscriptionID: to.Ptr("aaaaaaaaaaaaa"), - MarketplaceSubscriptionStatus: to.Ptr(armqumulo.MarketplaceSubscriptionStatusPendingFulfillmentStart), - OfferID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - PlanID: to.Ptr("aaaaaa"), - }, - StorageSKU: to.Ptr("Standard"), - UserDetails: &armqumulo.UserDetails{ - Email: to.Ptr("viptslwulnpaupfljvnjeq"), - }, - }, - }, 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.FileSystemResource = armqumulo.FileSystemResource{ - // ID: to.Ptr("aaaaaaaaaaaaaaaaa"), - // Location: to.Ptr("aaaaaaaaa"), - // Properties: &armqumulo.FileSystemResourceProperties{ - // DelegatedSubnetID: to.Ptr("aaaaaaaaaa"), - // MarketplaceDetails: &armqumulo.MarketplaceDetails{ - // MarketplaceSubscriptionID: to.Ptr("aaaaaaaaaaaaa"), - // MarketplaceSubscriptionStatus: to.Ptr(armqumulo.MarketplaceSubscriptionStatusPendingFulfillmentStart), - // OfferID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaa"), - // PlanID: to.Ptr("aaaaaa"), - // PublisherID: to.Ptr("aa"), - // }, - // ProvisioningState: to.Ptr(armqumulo.ProvisioningStateSucceeded), - // StorageSKU: to.Ptr("Standard"), - // UserDetails: &armqumulo.UserDetails{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/72de08114673a547de8a017c85ed89a2017a86f7/specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2024-06-19/examples/FileSystems_Update_MaximumSet_Gen.json -func ExampleFileSystemsClient_Update_fileSystemsUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armqumulo.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFileSystemsClient().Update(ctx, "rgQumulo", "ahpixnvykleksjlr", armqumulo.FileSystemResourceUpdate{ - Identity: &armqumulo.ManagedServiceIdentity{ - Type: to.Ptr(armqumulo.ManagedServiceIdentityTypeNone), - UserAssignedIdentities: map[string]*armqumulo.UserAssignedIdentity{ - "key7679": {}, - }, - }, - Properties: &armqumulo.FileSystemResourceUpdateProperties{ - DelegatedSubnetID: to.Ptr("bqaryqsjlackxphpmzffgoqsvm"), - MarketplaceDetails: &armqumulo.MarketplaceDetails{ - MarketplaceSubscriptionID: to.Ptr("xaqtkloiyovmexqhn"), - MarketplaceSubscriptionStatus: to.Ptr(armqumulo.MarketplaceSubscriptionStatusPendingFulfillmentStart), - OfferID: to.Ptr("s"), - PlanID: to.Ptr("fwtpz"), - PublisherID: to.Ptr("czxcfrwodazyaft"), - TermUnit: to.Ptr("cfwwczmygsimcyvoclcw"), - }, - UserDetails: &armqumulo.UserDetails{ - Email: to.Ptr("aqsnzyroo"), - }, - }, - Tags: map[string]*string{ - "key357": to.Ptr("ztkkvhfia"), - }, - }, 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.FileSystemResource = armqumulo.FileSystemResource{ - // Name: to.Ptr("stftolw"), - // Type: to.Ptr("wj"), - // ID: to.Ptr("rfta"), - // SystemData: &armqumulo.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-21T08:11:54.895Z"); return t}()), - // CreatedBy: to.Ptr("usnkckwkizihezb"), - // CreatedByType: to.Ptr(armqumulo.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-03-21T08:11:54.895Z"); return t}()), - // LastModifiedBy: to.Ptr("yjsiqdgtsmycxlncjceemlucn"), - // LastModifiedByType: to.Ptr(armqumulo.CreatedByTypeUser), - // }, - // Location: to.Ptr("pnb"), - // Tags: map[string]*string{ - // "key7090": to.Ptr("rurrdiaqp"), - // }, - // Identity: &armqumulo.ManagedServiceIdentity{ - // Type: to.Ptr(armqumulo.ManagedServiceIdentityTypeNone), - // PrincipalID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // TenantID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // UserAssignedIdentities: map[string]*armqumulo.UserAssignedIdentity{ - // "key7679": &armqumulo.UserAssignedIdentity{ - // ClientID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // PrincipalID: to.Ptr("11111111-1111-1111-1111-111111111111"), - // }, - // }, - // }, - // Properties: &armqumulo.FileSystemResourceProperties{ - // AvailabilityZone: to.Ptr("eqdvbdiuwmhhzqzmksmwllpddqquwt"), - // ClusterLoginURL: to.Ptr("ykaynsjvhihdthkkvvodjrgc"), - // DelegatedSubnetID: to.Ptr("jykmxrf"), - // MarketplaceDetails: &armqumulo.MarketplaceDetails{ - // MarketplaceSubscriptionID: to.Ptr("xaqtkloiyovmexqhn"), - // MarketplaceSubscriptionStatus: to.Ptr(armqumulo.MarketplaceSubscriptionStatusPendingFulfillmentStart), - // OfferID: to.Ptr("s"), - // PlanID: to.Ptr("fwtpz"), - // PublisherID: to.Ptr("czxcfrwodazyaft"), - // TermUnit: to.Ptr("cfwwczmygsimcyvoclcw"), - // }, - // PrivateIPs: []*string{ - // to.Ptr("gzken")}, - // ProvisioningState: to.Ptr(armqumulo.ProvisioningStateSucceeded), - // StorageSKU: to.Ptr("yhyzby"), - // UserDetails: &armqumulo.UserDetails{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/72de08114673a547de8a017c85ed89a2017a86f7/specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2024-06-19/examples/FileSystems_Update_MinimumSet_Gen.json -func ExampleFileSystemsClient_Update_fileSystemsUpdateMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armqumulo.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFileSystemsClient().Update(ctx, "rgQumulo", "aaaaaaaaaaaaaaaaa", armqumulo.FileSystemResourceUpdate{}, 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.FileSystemResource = armqumulo.FileSystemResource{ - // Name: to.Ptr("aaaaa"), - // Location: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // Properties: &armqumulo.FileSystemResourceProperties{ - // DelegatedSubnetID: to.Ptr("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), - // MarketplaceDetails: &armqumulo.MarketplaceDetails{ - // MarketplaceSubscriptionID: to.Ptr("aaaaaaaaaaaaaaaaa"), - // MarketplaceSubscriptionStatus: to.Ptr(armqumulo.MarketplaceSubscriptionStatusPendingFulfillmentStart), - // OfferID: to.Ptr("aaaaaaaaa"), - // PlanID: to.Ptr("aaaaaaa"), - // }, - // ProvisioningState: to.Ptr(armqumulo.ProvisioningStateSucceeded), - // StorageSKU: to.Ptr("Standard"), - // UserDetails: &armqumulo.UserDetails{ - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/72de08114673a547de8a017c85ed89a2017a86f7/specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2024-06-19/examples/FileSystems_Delete_MaximumSet_Gen.json -func ExampleFileSystemsClient_BeginDelete_fileSystemsDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armqumulo.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFileSystemsClient().BeginDelete(ctx, "rgQumulo", "xoschzkccroahrykedlvbbnsddq", 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/72de08114673a547de8a017c85ed89a2017a86f7/specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2024-06-19/examples/FileSystems_Delete_MinimumSet_Gen.json -func ExampleFileSystemsClient_BeginDelete_fileSystemsDeleteMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armqumulo.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFileSystemsClient().BeginDelete(ctx, "rgQumulo", "jgtskkiplquyrlkaxvhdg", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/liftrqumulo/armqumulo/go.mod b/sdk/resourcemanager/liftrqumulo/armqumulo/go.mod index 4a1edc6434fb..0d6cb44e7fcf 100644 --- a/sdk/resourcemanager/liftrqumulo/armqumulo/go.mod +++ b/sdk/resourcemanager/liftrqumulo/armqumulo/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/liftrqumulo/armqumu 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 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.2 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.36.0 // indirect golang.org/x/net v0.38.0 // indirect - golang.org/x/sys v0.31.0 // indirect golang.org/x/text v0.23.0 // indirect ) diff --git a/sdk/resourcemanager/liftrqumulo/armqumulo/go.sum b/sdk/resourcemanager/liftrqumulo/armqumulo/go.sum index 4bacf756f06c..4de695d9e23a 100644 --- a/sdk/resourcemanager/liftrqumulo/armqumulo/go.sum +++ b/sdk/resourcemanager/liftrqumulo/armqumulo/go.sum @@ -1,44 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 h1:DSDNVxqkoXJiko6x8a90zidoYqnYYa6c1MTzDKzKkTo= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1/go.mod h1:zGqV2R4Cr/k8Uye5w+dgQ06WJtEcbQG/8J7BB6hnCr4= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 h1:F0gBpfdPLGsw+nsgk6aqqkZS1jiixa5WwFe3fk/T3Ys= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2/go.mod h1:SqINnQ9lVVdRlyC8cd1lCI0SdX4n2paeABd2K8ggfnE= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2 h1:yz1bePFlP5Vws5+8ez6T3HWXPmwOK7Yvq8QxDBD3SKY= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2/go.mod h1:Pa9ZNPuoNu/GztvBSKk9J1cDJW6vk/n0zLtV4mgd8N8= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= -github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 h1:oygO0locgZJe7PpYPXT5A29ZkwJaPqcva7BVeemZOZs= -github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= -github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= -github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8= -github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6 h1:IsMZxCuZqKuao2vNdfD82fjjgPLfyHLpR41Z88viRWs= -github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6/go.mod h1:3VeWNIJaW+O5xpRQbPp0Ybqu1vJd/pm7s2F473HRrkw= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E= -github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= -golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= -golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/liftrqumulo/armqumulo/models.go b/sdk/resourcemanager/liftrqumulo/armqumulo/models.go index b05dccbfde2d..fe2170885172 100644 --- a/sdk/resourcemanager/liftrqumulo/armqumulo/models.go +++ b/sdk/resourcemanager/liftrqumulo/armqumulo/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. diff --git a/sdk/resourcemanager/liftrqumulo/armqumulo/models_serde.go b/sdk/resourcemanager/liftrqumulo/armqumulo/models_serde.go index 4147c7673613..b956a7d8e4a7 100644 --- a/sdk/resourcemanager/liftrqumulo/armqumulo/models_serde.go +++ b/sdk/resourcemanager/liftrqumulo/armqumulo/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. diff --git a/sdk/resourcemanager/liftrqumulo/armqumulo/operations_client.go b/sdk/resourcemanager/liftrqumulo/armqumulo/operations_client.go index c5b3366f01af..5716a9694908 100644 --- a/sdk/resourcemanager/liftrqumulo/armqumulo/operations_client.go +++ b/sdk/resourcemanager/liftrqumulo/armqumulo/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. @@ -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/Qumulo.Storage/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { diff --git a/sdk/resourcemanager/liftrqumulo/armqumulo/operations_client_example_test.go b/sdk/resourcemanager/liftrqumulo/armqumulo/operations_client_example_test.go deleted file mode 100644 index c5a9fd050d97..000000000000 --- a/sdk/resourcemanager/liftrqumulo/armqumulo/operations_client_example_test.go +++ /dev/null @@ -1,85 +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 armqumulo_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/liftrqumulo/armqumulo/v2" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/72de08114673a547de8a017c85ed89a2017a86f7/specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2024-06-19/examples/Operations_List_MaximumSet_Gen.json -func ExampleOperationsClient_NewListPager_operationsList() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armqumulo.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 = armqumulo.OperationListResult{ - // Value: []*armqumulo.Operation{ - // { - // Name: to.Ptr("melhpzamnyx"), - // ActionType: to.Ptr(armqumulo.ActionTypeInternal), - // Display: &armqumulo.OperationDisplay{ - // Description: to.Ptr("vodhl"), - // Operation: to.Ptr("ayfoeuuyhtwjafroqzimyujr"), - // Provider: to.Ptr("ilyrhd"), - // Resource: to.Ptr("vjz"), - // }, - // IsDataAction: to.Ptr(true), - // Origin: to.Ptr(armqumulo.OriginUser), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/72de08114673a547de8a017c85ed89a2017a86f7/specification/liftrqumulo/resource-manager/Qumulo.Storage/stable/2024-06-19/examples/Operations_List_MinimumSet_Gen.json -func ExampleOperationsClient_NewListPager_operationsListMinimumSetGen() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armqumulo.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 = armqumulo.OperationListResult{ - // } - } -} diff --git a/sdk/resourcemanager/liftrqumulo/armqumulo/options.go b/sdk/resourcemanager/liftrqumulo/armqumulo/options.go index 2f8c3864f245..32fbba03045b 100644 --- a/sdk/resourcemanager/liftrqumulo/armqumulo/options.go +++ b/sdk/resourcemanager/liftrqumulo/armqumulo/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,13 +8,13 @@ package armqumulo // FileSystemsClientBeginCreateOrUpdateOptions contains the optional parameters for the FileSystemsClient.BeginCreateOrUpdate // method. type FileSystemsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // FileSystemsClientBeginDeleteOptions contains the optional parameters for the FileSystemsClient.BeginDelete method. type FileSystemsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } diff --git a/sdk/resourcemanager/liftrqumulo/armqumulo/responses.go b/sdk/resourcemanager/liftrqumulo/armqumulo/responses.go index c973fe15127f..250c48210ac0 100644 --- a/sdk/resourcemanager/liftrqumulo/armqumulo/responses.go +++ b/sdk/resourcemanager/liftrqumulo/armqumulo/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. diff --git a/sdk/resourcemanager/liftrqumulo/armqumulo/time_rfc3339.go b/sdk/resourcemanager/liftrqumulo/armqumulo/time_rfc3339.go index 6a9c29f6f67d..7da62b157943 100644 --- a/sdk/resourcemanager/liftrqumulo/armqumulo/time_rfc3339.go +++ b/sdk/resourcemanager/liftrqumulo/armqumulo/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. @@ -60,6 +57,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string diff --git a/sdk/resourcemanager/loadtesting/armloadtesting/CHANGELOG.md b/sdk/resourcemanager/loadtesting/armloadtesting/CHANGELOG.md index 22bec5129b54..cf7b1a3bd00e 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-04-27) +### 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 diff --git a/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md b/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md index c4347fe6a0d5..4b070140e970 100644 --- a/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md +++ b/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md @@ -1,5 +1,503 @@ # Release History +## 0.12.0 (2025-04-27) +### Breaking Changes + +- Type of `ErrorContract.Error` has been changed from `*ErrorResponse` to `*ErrorResponseAutoGenerated` +- Enum `AccessMode` has been removed +- Enum `ActionType` has been removed +- Enum `AggregationType` has been removed +- Enum `AggregationTypeEnum` has been removed +- Enum `BaselineSensitivity` has been removed +- Enum `CategoryType` has been removed +- Enum `ComparisonOperationType` has been removed +- Enum `DataStatus` has been removed +- Enum `DynamicThresholdOperator` has been removed +- Enum `DynamicThresholdSensitivity` has been removed +- Enum `EventLevel` has been removed +- Enum `KnownColumnDefinitionType` has been removed +- Enum `KnownDataCollectionEndpointProvisioningState` has been removed +- Enum `KnownDataCollectionEndpointResourceKind` has been removed +- Enum `KnownDataCollectionRuleAssociationProvisioningState` has been removed +- Enum `KnownDataCollectionRuleProvisioningState` has been removed +- Enum `KnownDataCollectionRuleResourceKind` has been removed +- Enum `KnownDataFlowStreams` has been removed +- Enum `KnownExtensionDataSourceStreams` has been removed +- Enum `KnownLocationSpecProvisioningStatus` has been removed +- Enum `KnownLogFileTextSettingsRecordStartTimestampFormat` has been removed +- Enum `KnownLogFilesDataSourceFormat` has been removed +- Enum `KnownPerfCounterDataSourceStreams` has been removed +- Enum `KnownPrometheusForwarderDataSourceStreams` has been removed +- Enum `KnownPublicNetworkAccessOptions` has been removed +- Enum `KnownSyslogDataSourceFacilityNames` has been removed +- Enum `KnownSyslogDataSourceLogLevels` has been removed +- Enum `KnownSyslogDataSourceStreams` has been removed +- Enum `KnownWindowsEventLogDataSourceStreams` has been removed +- Enum `MetricAggregationType` has been removed +- Enum `MetricClass` has been removed +- Enum `MetricResultType` has been removed +- Enum `MetricStatisticType` has been removed +- Enum `MetricUnit` has been removed +- Enum `NamespaceClassification` has been removed +- Enum `Odatatype` has been removed +- Enum `OnboardingStatus` has been removed +- Enum `Operator` has been removed +- Enum `Origin` has been removed +- Enum `PredictiveAutoscalePolicyScaleMode` has been removed +- Enum `PrivateEndpointConnectionProvisioningState` has been removed +- Enum `PrivateEndpointServiceConnectionStatus` has been removed +- Enum `ProvisioningState` has been removed +- Enum `PublicNetworkAccess` has been removed +- Enum `RecurrenceFrequency` has been removed +- Enum `ResultType` has been removed +- Enum `ScaleDirection` has been removed +- Enum `ScaleRuleMetricDimensionOperationType` has been removed +- Enum `ScaleType` has been removed +- Enum `TimeAggregationOperator` has been removed +- Enum `TimeAggregationType` has been removed +- Enum `Unit` has been removed +- Function `NewActivityLogAlertsClient` has been removed +- Function `*ActivityLogAlertsClient.CreateOrUpdate` has been removed +- Function `*ActivityLogAlertsClient.Delete` has been removed +- Function `*ActivityLogAlertsClient.Get` has been removed +- Function `*ActivityLogAlertsClient.NewListByResourceGroupPager` has been removed +- Function `*ActivityLogAlertsClient.NewListBySubscriptionIDPager` has been removed +- Function `*ActivityLogAlertsClient.Update` has been removed +- Function `NewActivityLogsClient` has been removed +- Function `*ActivityLogsClient.NewListPager` has been removed +- Function `NewAlertRuleIncidentsClient` has been removed +- Function `*AlertRuleIncidentsClient.Get` has been removed +- Function `*AlertRuleIncidentsClient.NewListByAlertRulePager` has been removed +- Function `NewAlertRulesClient` has been removed +- Function `*AlertRulesClient.CreateOrUpdate` has been removed +- Function `*AlertRulesClient.Delete` has been removed +- Function `*AlertRulesClient.Get` has been removed +- Function `*AlertRulesClient.NewListByResourceGroupPager` has been removed +- Function `*AlertRulesClient.NewListBySubscriptionPager` has been removed +- Function `*AlertRulesClient.Update` has been removed +- Function `NewAutoscaleSettingsClient` has been removed +- Function `*AutoscaleSettingsClient.CreateOrUpdate` has been removed +- Function `*AutoscaleSettingsClient.Delete` has been removed +- Function `*AutoscaleSettingsClient.Get` has been removed +- Function `*AutoscaleSettingsClient.NewListByResourceGroupPager` has been removed +- Function `*AutoscaleSettingsClient.NewListBySubscriptionPager` has been removed +- Function `*AutoscaleSettingsClient.Update` has been removed +- Function `NewAzureMonitorWorkspacesClient` has been removed +- Function `*AzureMonitorWorkspacesClient.Create` has been removed +- Function `*AzureMonitorWorkspacesClient.Delete` has been removed +- Function `*AzureMonitorWorkspacesClient.Get` has been removed +- Function `*AzureMonitorWorkspacesClient.NewListByResourceGroupPager` has been removed +- Function `*AzureMonitorWorkspacesClient.NewListBySubscriptionPager` has been removed +- Function `*AzureMonitorWorkspacesClient.Update` has been removed +- Function `NewBaselinesClient` has been removed +- Function `*BaselinesClient.NewListPager` has been removed +- Function `*ClientFactory.NewActivityLogAlertsClient` has been removed +- Function `*ClientFactory.NewActivityLogsClient` has been removed +- Function `*ClientFactory.NewAlertRuleIncidentsClient` has been removed +- Function `*ClientFactory.NewAlertRulesClient` has been removed +- Function `*ClientFactory.NewAutoscaleSettingsClient` has been removed +- Function `*ClientFactory.NewAzureMonitorWorkspacesClient` has been removed +- Function `*ClientFactory.NewBaselinesClient` has been removed +- Function `*ClientFactory.NewDataCollectionEndpointsClient` has been removed +- Function `*ClientFactory.NewDataCollectionRuleAssociationsClient` has been removed +- Function `*ClientFactory.NewDataCollectionRulesClient` has been removed +- Function `*ClientFactory.NewDiagnosticSettingsCategoryClient` has been removed +- Function `*ClientFactory.NewDiagnosticSettingsClient` has been removed +- Function `*ClientFactory.NewEventCategoriesClient` has been removed +- Function `*ClientFactory.NewLogProfilesClient` has been removed +- Function `*ClientFactory.NewMetricAlertsClient` has been removed +- Function `*ClientFactory.NewMetricAlertsStatusClient` has been removed +- Function `*ClientFactory.NewMetricDefinitionsClient` has been removed +- Function `*ClientFactory.NewMetricNamespacesClient` has been removed +- Function `*ClientFactory.NewMetricsClient` has been removed +- Function `*ClientFactory.NewOperationsClient` has been removed +- Function `*ClientFactory.NewOperationsForMonitorClient` has been removed +- Function `*ClientFactory.NewPredictiveMetricClient` has been removed +- Function `*ClientFactory.NewPrivateEndpointConnectionsClient` has been removed +- Function `*ClientFactory.NewPrivateLinkResourcesClient` has been removed +- Function `*ClientFactory.NewPrivateLinkScopeOperationStatusClient` has been removed +- Function `*ClientFactory.NewPrivateLinkScopedResourcesClient` has been removed +- Function `*ClientFactory.NewPrivateLinkScopesClient` has been removed +- Function `*ClientFactory.NewTenantActionGroupsClient` has been removed +- Function `*ClientFactory.NewTenantActivityLogsClient` has been removed +- Function `*ClientFactory.NewVMInsightsClient` has been removed +- Function `NewDataCollectionEndpointsClient` has been removed +- Function `*DataCollectionEndpointsClient.Create` has been removed +- Function `*DataCollectionEndpointsClient.Delete` has been removed +- Function `*DataCollectionEndpointsClient.Get` has been removed +- Function `*DataCollectionEndpointsClient.NewListByResourceGroupPager` has been removed +- Function `*DataCollectionEndpointsClient.NewListBySubscriptionPager` has been removed +- Function `*DataCollectionEndpointsClient.Update` has been removed +- Function `NewDataCollectionRuleAssociationsClient` has been removed +- Function `*DataCollectionRuleAssociationsClient.Create` has been removed +- Function `*DataCollectionRuleAssociationsClient.Delete` has been removed +- Function `*DataCollectionRuleAssociationsClient.Get` has been removed +- Function `*DataCollectionRuleAssociationsClient.NewListByDataCollectionEndpointPager` has been removed +- Function `*DataCollectionRuleAssociationsClient.NewListByResourcePager` has been removed +- Function `*DataCollectionRuleAssociationsClient.NewListByRulePager` has been removed +- Function `NewDataCollectionRulesClient` has been removed +- Function `*DataCollectionRulesClient.Create` has been removed +- Function `*DataCollectionRulesClient.Delete` has been removed +- Function `*DataCollectionRulesClient.Get` has been removed +- Function `*DataCollectionRulesClient.NewListByResourceGroupPager` has been removed +- Function `*DataCollectionRulesClient.NewListBySubscriptionPager` has been removed +- Function `*DataCollectionRulesClient.Update` has been removed +- Function `NewDiagnosticSettingsCategoryClient` has been removed +- Function `*DiagnosticSettingsCategoryClient.Get` has been removed +- Function `*DiagnosticSettingsCategoryClient.NewListPager` has been removed +- Function `NewDiagnosticSettingsClient` has been removed +- Function `*DiagnosticSettingsClient.CreateOrUpdate` has been removed +- Function `*DiagnosticSettingsClient.Delete` has been removed +- Function `*DiagnosticSettingsClient.Get` has been removed +- Function `*DiagnosticSettingsClient.NewListPager` has been removed +- Function `*DynamicMetricCriteria.GetMultiMetricCriteria` has been removed +- Function `NewEventCategoriesClient` has been removed +- Function `*EventCategoriesClient.NewListPager` has been removed +- Function `*LocationThresholdRuleCondition.GetRuleCondition` has been removed +- Function `NewLogProfilesClient` has been removed +- Function `*LogProfilesClient.CreateOrUpdate` has been removed +- Function `*LogProfilesClient.Delete` has been removed +- Function `*LogProfilesClient.Get` has been removed +- Function `*LogProfilesClient.NewListPager` has been removed +- Function `*LogProfilesClient.Update` has been removed +- Function `*ManagementEventRuleCondition.GetRuleCondition` has been removed +- Function `*MetricAlertCriteria.GetMetricAlertCriteria` has been removed +- Function `*MetricAlertMultipleResourceMultipleMetricCriteria.GetMetricAlertCriteria` has been removed +- Function `*MetricAlertSingleResourceMultipleMetricCriteria.GetMetricAlertCriteria` has been removed +- Function `NewMetricAlertsClient` has been removed +- Function `*MetricAlertsClient.CreateOrUpdate` has been removed +- Function `*MetricAlertsClient.Delete` has been removed +- Function `*MetricAlertsClient.Get` has been removed +- Function `*MetricAlertsClient.NewListByResourceGroupPager` has been removed +- Function `*MetricAlertsClient.NewListBySubscriptionPager` has been removed +- Function `*MetricAlertsClient.Update` has been removed +- Function `NewMetricAlertsStatusClient` has been removed +- Function `*MetricAlertsStatusClient.List` has been removed +- Function `*MetricAlertsStatusClient.ListByName` has been removed +- Function `*MetricCriteria.GetMultiMetricCriteria` has been removed +- Function `NewMetricDefinitionsClient` has been removed +- Function `*MetricDefinitionsClient.NewListAtSubscriptionScopePager` has been removed +- Function `*MetricDefinitionsClient.NewListPager` has been removed +- Function `NewMetricNamespacesClient` has been removed +- Function `*MetricNamespacesClient.NewListPager` has been removed +- Function `NewMetricsClient` has been removed +- Function `*MetricsClient.List` has been removed +- Function `*MetricsClient.ListAtSubscriptionScope` has been removed +- Function `*MetricsClient.ListAtSubscriptionScopePost` has been removed +- Function `*MultiMetricCriteria.GetMultiMetricCriteria` has been removed +- Function `NewOperationsClient` has been removed +- Function `*OperationsClient.List` has been removed +- Function `NewOperationsForMonitorClient` has been removed +- Function `*OperationsForMonitorClient.NewListPager` has been removed +- Function `PossibleAggregationTypeValues` has been removed +- Function `NewPredictiveMetricClient` has been removed +- Function `*PredictiveMetricClient.Get` has been removed +- Function `NewPrivateEndpointConnectionsClient` has been removed +- Function `*PrivateEndpointConnectionsClient.BeginCreateOrUpdate` has been removed +- Function `*PrivateEndpointConnectionsClient.BeginDelete` has been removed +- Function `*PrivateEndpointConnectionsClient.Get` has been removed +- Function `*PrivateEndpointConnectionsClient.ListByPrivateLinkScope` has been removed +- Function `NewPrivateLinkResourcesClient` has been removed +- Function `*PrivateLinkResourcesClient.Get` has been removed +- Function `*PrivateLinkResourcesClient.ListByPrivateLinkScope` has been removed +- Function `NewPrivateLinkScopeOperationStatusClient` has been removed +- Function `*PrivateLinkScopeOperationStatusClient.Get` has been removed +- Function `NewPrivateLinkScopedResourcesClient` has been removed +- Function `*PrivateLinkScopedResourcesClient.BeginCreateOrUpdate` has been removed +- Function `*PrivateLinkScopedResourcesClient.BeginDelete` has been removed +- Function `*PrivateLinkScopedResourcesClient.Get` has been removed +- Function `*PrivateLinkScopedResourcesClient.NewListByPrivateLinkScopePager` has been removed +- Function `NewPrivateLinkScopesClient` has been removed +- Function `*PrivateLinkScopesClient.CreateOrUpdate` has been removed +- Function `*PrivateLinkScopesClient.BeginDelete` has been removed +- Function `*PrivateLinkScopesClient.Get` has been removed +- Function `*PrivateLinkScopesClient.NewListByResourceGroupPager` has been removed +- Function `*PrivateLinkScopesClient.NewListPager` has been removed +- Function `*PrivateLinkScopesClient.UpdateTags` has been removed +- Function `*RuleAction.GetRuleAction` has been removed +- Function `*RuleCondition.GetRuleCondition` has been removed +- Function `*RuleDataSource.GetRuleDataSource` has been removed +- Function `*RuleEmailAction.GetRuleAction` has been removed +- Function `*RuleManagementEventDataSource.GetRuleDataSource` has been removed +- Function `*RuleMetricDataSource.GetRuleDataSource` has been removed +- Function `*RuleWebhookAction.GetRuleAction` has been removed +- Function `NewTenantActionGroupsClient` has been removed +- Function `*TenantActionGroupsClient.CreateOrUpdate` has been removed +- Function `*TenantActionGroupsClient.Delete` has been removed +- Function `*TenantActionGroupsClient.Get` has been removed +- Function `*TenantActionGroupsClient.NewListByManagementGroupIDPager` has been removed +- Function `*TenantActionGroupsClient.Update` has been removed +- Function `NewTenantActivityLogsClient` has been removed +- Function `*TenantActivityLogsClient.NewListPager` has been removed +- Function `*ThresholdRuleCondition.GetRuleCondition` has been removed +- Function `NewVMInsightsClient` has been removed +- Function `*VMInsightsClient.GetOnboardingStatus` has been removed +- Function `*WebtestLocationAvailabilityCriteria.GetMetricAlertCriteria` has been removed +- Struct `AccessModeSettings` has been removed +- Struct `AccessModeSettingsExclusion` has been removed +- Struct `ActionGroupAutoGenerated` has been removed +- Struct `ActionGroupPatchAutoGenerated` has been removed +- Struct `ActionGroupPatchBodyAutoGenerated` has been removed +- Struct `ActionList` has been removed +- Struct `ActivityLogAlertResource` has been removed +- Struct `AlertRule` has been removed +- Struct `AlertRuleAllOfCondition` has been removed +- Struct `AlertRuleAnyOfOrLeafCondition` has been removed +- Struct `AlertRuleLeafCondition` has been removed +- Struct `AlertRuleList` has been removed +- Struct `AlertRulePatchObject` has been removed +- Struct `AlertRulePatchProperties` has been removed +- Struct `AlertRuleProperties` has been removed +- Struct `AlertRuleResource` has been removed +- Struct `AlertRuleResourceCollection` has been removed +- Struct `AlertRuleResourcePatch` has been removed +- Struct `AutoscaleErrorResponse` has been removed +- Struct `AutoscaleErrorResponseError` has been removed +- Struct `AutoscaleNotification` has been removed +- Struct `AutoscaleProfile` has been removed +- Struct `AutoscaleSetting` has been removed +- Struct `AutoscaleSettingResource` has been removed +- Struct `AutoscaleSettingResourceCollection` has been removed +- Struct `AutoscaleSettingResourcePatch` has been removed +- Struct `AzureAppPushReceiverAutoGenerated` has been removed +- Struct `AzureMonitorMetricsDestination` has been removed +- Struct `AzureMonitorPrivateLinkScope` has been removed +- Struct `AzureMonitorPrivateLinkScopeListResult` has been removed +- Struct `AzureMonitorPrivateLinkScopeProperties` has been removed +- Struct `AzureMonitorWorkspace` has been removed +- Struct `AzureMonitorWorkspaceDefaultIngestionSettings` has been removed +- Struct `AzureMonitorWorkspaceMetrics` has been removed +- Struct `AzureMonitorWorkspaceResource` has been removed +- Struct `AzureMonitorWorkspaceResourceForUpdate` has been removed +- Struct `AzureMonitorWorkspaceResourceListResult` has been removed +- Struct `AzureMonitorWorkspaceResourceProperties` has been removed +- Struct `AzureResourceAutoGenerated` has been removed +- Struct `BaselineMetadata` has been removed +- Struct `ColumnDefinition` has been removed +- Struct `ConfigurationAccessEndpointSpec` has been removed +- Struct `DataCollectionEndpoint` has been removed +- Struct `DataCollectionEndpointConfigurationAccess` has been removed +- Struct `DataCollectionEndpointFailoverConfiguration` has been removed +- Struct `DataCollectionEndpointLogsIngestion` has been removed +- Struct `DataCollectionEndpointMetadata` has been removed +- Struct `DataCollectionEndpointMetricsIngestion` has been removed +- Struct `DataCollectionEndpointNetworkACLs` has been removed +- Struct `DataCollectionEndpointResource` has been removed +- Struct `DataCollectionEndpointResourceIdentity` has been removed +- Struct `DataCollectionEndpointResourceListResult` has been removed +- Struct `DataCollectionEndpointResourceProperties` has been removed +- Struct `DataCollectionEndpointResourceSystemData` has been removed +- Struct `DataCollectionRule` has been removed +- Struct `DataCollectionRuleAssociation` has been removed +- Struct `DataCollectionRuleAssociationMetadata` has been removed +- Struct `DataCollectionRuleAssociationProxyOnlyResource` has been removed +- Struct `DataCollectionRuleAssociationProxyOnlyResourceListResult` has been removed +- Struct `DataCollectionRuleAssociationProxyOnlyResourceProperties` has been removed +- Struct `DataCollectionRuleAssociationProxyOnlyResourceSystemData` has been removed +- Struct `DataCollectionRuleDataSources` has been removed +- Struct `DataCollectionRuleDestinations` has been removed +- Struct `DataCollectionRuleMetadata` has been removed +- Struct `DataCollectionRuleResource` has been removed +- Struct `DataCollectionRuleResourceIdentity` has been removed +- Struct `DataCollectionRuleResourceListResult` has been removed +- Struct `DataCollectionRuleResourceProperties` has been removed +- Struct `DataCollectionRuleResourceSystemData` has been removed +- Struct `DataContainer` has been removed +- Struct `DataFlow` has been removed +- Struct `DataImportSources` has been removed +- Struct `DataImportSourcesEventHub` has been removed +- Struct `DataSourcesSpec` has been removed +- Struct `DataSourcesSpecDataImports` has been removed +- Struct `DefaultErrorResponse` has been removed +- Struct `DestinationsSpec` has been removed +- Struct `DestinationsSpecAzureMonitorMetrics` has been removed +- Struct `DiagnosticSettings` has been removed +- Struct `DiagnosticSettingsCategory` has been removed +- Struct `DiagnosticSettingsCategoryResource` has been removed +- Struct `DiagnosticSettingsCategoryResourceCollection` has been removed +- Struct `DiagnosticSettingsResource` has been removed +- Struct `DiagnosticSettingsResourceCollection` has been removed +- Struct `DynamicMetricCriteria` has been removed +- Struct `DynamicThresholdFailingPeriods` has been removed +- Struct `EmailNotification` has been removed +- Struct `EmailReceiverAutoGenerated` has been removed +- Struct `Error` has been removed +- Struct `ErrorContractAutoGenerated` has been removed +- Struct `ErrorDetail` has been removed +- Struct `ErrorDetailAutoGenerated` has been removed +- Struct `ErrorResponseAdditionalInfo` has been removed +- Struct `ErrorResponseAutoGenerated2` has been removed +- Struct `ErrorResponseCommonV2` has been removed +- Struct `ErrorResponseDetails` has been removed +- Struct `EventCategoryCollection` has been removed +- Struct `EventData` has been removed +- Struct `EventDataCollection` has been removed +- Struct `EventHubDataSource` has been removed +- Struct `EventHubDestination` has been removed +- Struct `EventHubDirectDestination` has been removed +- Struct `ExtensionDataSource` has been removed +- Struct `FailoverConfigurationSpec` has been removed +- Struct `HTTPRequestInfo` has been removed +- Struct `IisLogsDataSource` has been removed +- Struct `Incident` has been removed +- Struct `IncidentListResult` has been removed +- Struct `IngestionSettings` has been removed +- Struct `LocalizableString` has been removed +- Struct `LocationSpec` has been removed +- Struct `LocationThresholdRuleCondition` has been removed +- Struct `LogAnalyticsDestination` has been removed +- Struct `LogFileSettings` has been removed +- Struct `LogFileSettingsText` has been removed +- Struct `LogFileTextSettings` has been removed +- Struct `LogFilesDataSource` has been removed +- Struct `LogFilesDataSourceSettings` has been removed +- Struct `LogProfileCollection` has been removed +- Struct `LogProfileProperties` has been removed +- Struct `LogProfileResource` has been removed +- Struct `LogProfileResourcePatch` has been removed +- Struct `LogSettings` has been removed +- Struct `LogsIngestionEndpointSpec` has been removed +- Struct `ManagementEventAggregationCondition` has been removed +- Struct `ManagementEventRuleCondition` has been removed +- Struct `Metadata` has been removed +- Struct `MetadataValue` has been removed +- Struct `Metric` has been removed +- Struct `MetricAlertAction` has been removed +- Struct `MetricAlertMultipleResourceMultipleMetricCriteria` has been removed +- Struct `MetricAlertProperties` has been removed +- Struct `MetricAlertPropertiesPatch` has been removed +- Struct `MetricAlertResource` has been removed +- Struct `MetricAlertResourceCollection` has been removed +- Struct `MetricAlertResourcePatch` has been removed +- Struct `MetricAlertSingleResourceMultipleMetricCriteria` has been removed +- Struct `MetricAlertStatus` has been removed +- Struct `MetricAlertStatusCollection` has been removed +- Struct `MetricAlertStatusProperties` has been removed +- Struct `MetricAvailability` has been removed +- Struct `MetricBaselinesProperties` has been removed +- Struct `MetricBaselinesResponse` has been removed +- Struct `MetricCriteria` has been removed +- Struct `MetricDefinition` has been removed +- Struct `MetricDefinitionCollection` has been removed +- Struct `MetricDimension` has been removed +- Struct `MetricNamespace` has been removed +- Struct `MetricNamespaceCollection` has been removed +- Struct `MetricNamespaceName` has been removed +- Struct `MetricSettings` has been removed +- Struct `MetricSingleDimension` has been removed +- Struct `MetricTrigger` has been removed +- Struct `MetricValue` has been removed +- Struct `Metrics` has been removed +- Struct `MetricsIngestionEndpointSpec` has been removed +- Struct `MonitoringAccountDestination` has been removed +- Struct `NetworkRuleSet` has been removed +- Struct `Operation` has been removed +- Struct `OperationAutoGenerated` has been removed +- Struct `OperationDisplay` has been removed +- Struct `OperationDisplayAutoGenerated` has been removed +- Struct `OperationListResult` has been removed +- Struct `OperationListResultAutoGenerated` has been removed +- Struct `OperationStatus` has been removed +- Struct `PerfCounterDataSource` has been removed +- Struct `PlatformTelemetryDataSource` has been removed +- Struct `PredictiveAutoscalePolicy` has been removed +- Struct `PredictiveResponse` has been removed +- Struct `PredictiveValue` has been removed +- Struct `PrivateEndpoint` has been removed +- Struct `PrivateEndpointConnection` has been removed +- Struct `PrivateEndpointConnectionListResult` has been removed +- Struct `PrivateEndpointConnectionProperties` has been removed +- Struct `PrivateLinkResource` has been removed +- Struct `PrivateLinkResourceListResult` has been removed +- Struct `PrivateLinkResourceProperties` has been removed +- Struct `PrivateLinkScopedResource` has been removed +- Struct `PrivateLinkServiceConnectionState` has been removed +- Struct `PrometheusForwarderDataSource` has been removed +- Struct `ProxyResource` has been removed +- Struct `ProxyResourceAutoGenerated` has been removed +- Struct `Recurrence` has been removed +- Struct `RecurrentSchedule` has been removed +- Struct `Resource` has been removed +- Struct `ResourceAutoGenerated` has been removed +- Struct `ResourceAutoGenerated2` has been removed +- Struct `ResourceAutoGenerated3` has been removed +- Struct `ResourceAutoGenerated4` has been removed +- Struct `ResourceAutoGenerated5` has been removed +- Struct `ResourceForUpdate` has been removed +- Struct `ResourceForUpdateIdentity` has been removed +- Struct `Response` has been removed +- Struct `ResponseWithError` has been removed +- Struct `RetentionPolicy` has been removed +- Struct `RuleEmailAction` has been removed +- Struct `RuleManagementEventClaimsDataSource` has been removed +- Struct `RuleManagementEventDataSource` has been removed +- Struct `RuleMetricDataSource` has been removed +- Struct `RuleWebhookAction` has been removed +- Struct `ScaleAction` has been removed +- Struct `ScaleCapacity` has been removed +- Struct `ScaleRule` has been removed +- Struct `ScaleRuleMetricDimension` has been removed +- Struct `ScopedResource` has been removed +- Struct `ScopedResourceListResult` has been removed +- Struct `ScopedResourceProperties` has been removed +- Struct `SenderAuthorization` has been removed +- Struct `SingleBaseline` has been removed +- Struct `SingleMetricBaseline` has been removed +- Struct `SmsReceiverAutoGenerated` has been removed +- Struct `StorageBlobDestination` has been removed +- Struct `StorageTableDestination` has been removed +- Struct `StreamDeclaration` has been removed +- Struct `SubscriptionScopeMetric` has been removed +- Struct `SubscriptionScopeMetricDefinition` has been removed +- Struct `SubscriptionScopeMetricDefinitionCollection` has been removed +- Struct `SubscriptionScopeMetricResponse` has been removed +- Struct `SubscriptionScopeMetricsRequestBodyParameters` has been removed +- Struct `SyslogDataSource` has been removed +- Struct `TagsResource` has been removed +- Struct `TenantActionGroup` has been removed +- Struct `TenantActionGroupList` has been removed +- Struct `TenantActionGroupResource` has been removed +- Struct `ThresholdRuleCondition` has been removed +- Struct `TimeSeriesBaseline` has been removed +- Struct `TimeSeriesElement` has been removed +- Struct `TimeWindow` has been removed +- Struct `TrackedResource` has been removed +- Struct `TrackedResourceAutoGenerated` has been removed +- Struct `VMInsightsOnboardingStatus` has been removed +- Struct `VMInsightsOnboardingStatusProperties` has been removed +- Struct `VoiceReceiverAutoGenerated` has been removed +- Struct `WebhookNotification` has been removed +- Struct `WebhookReceiverAutoGenerated` has been removed +- Struct `WebtestLocationAvailabilityCriteria` has been removed +- Struct `WindowsEventLogDataSource` has been removed +- Struct `WindowsFirewallLogsDataSource` has been removed +- Struct `WorkspaceInfo` has been removed +- Struct `WorkspaceInfoProperties` has been removed +- Field `PublicNetworkAccess`, `RuleResolveConfiguration` of struct `ScheduledQueryRuleProperties` has been removed + +### Features Added + +- New value `ConditionOperatorGreaterOrLessThan` added to enum type `ConditionOperator` +- New value `KindSimpleLogAlert` added to enum type `Kind` +- New enum type `IncidentManagementService` with values `IncidentManagementServiceIcm` +- New struct `IncidentReceiver` +- New struct `IncidentServiceConnection` +- New field `IncidentReceivers` in struct `ActionGroup` +- New field `Identity` in struct `ActionGroupPatchBody` +- New field `Identity` in struct `ActionGroupResource` +- New field `ActionProperties` in struct `Actions` +- New field `ManagedIdentity` in struct `AutomationRunbookReceiver` +- New field `ManagedIdentity` in struct `AzureFunctionReceiver` +- New field `Identity` in struct `AzureResource` +- New field `AlertSensitivity`, `CriterionType`, `IgnoreDataBefore`, `MinRecurrenceCount` in struct `Condition` +- New field `AdditionalInfo`, `Details`, `Target` in struct `ErrorResponseAutoGenerated` +- New field `ManagedIdentity` in struct `EventHubReceiver` +- New field `ManagedIdentity` in struct `LogicAppReceiver` +- New field `IncidentReceivers` in struct `NotificationRequestBody` +- New field `ResolveConfiguration` in struct `ScheduledQueryRuleProperties` +- New field `ManagedIdentity` in struct `WebhookReceiver` + + ## 0.11.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/monitor/armmonitor/README.md b/sdk/resourcemanager/monitor/armmonitor/README.md index 5031a70ca062..a1c9738f03e5 100644 --- a/sdk/resourcemanager/monitor/armmonitor/README.md +++ b/sdk/resourcemanager/monitor/armmonitor/README.md @@ -55,7 +55,7 @@ clientFactory, err := armmonitor.NewClientFactory(, cred, &opti A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. ```go -client := clientFactory.NewAlertRuleIncidentsClient() +client := clientFactory.NewActionGroupsClient() ``` ## Fakes diff --git a/sdk/resourcemanager/monitor/armmonitor/actiongroups_client.go b/sdk/resourcemanager/monitor/armmonitor/actiongroups_client.go index c5d4fc18bd19..af42675d458c 100644 --- a/sdk/resourcemanager/monitor/armmonitor/actiongroups_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/actiongroups_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. @@ -46,7 +43,7 @@ func NewActionGroupsClient(subscriptionID string, credential azcore.TokenCredent // BeginCreateNotificationsAtActionGroupResourceLevel - Send test notifications to a set of provided receivers // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - actionGroupName - The name of the action group. // - notificationRequest - The notification request body which includes the contact details @@ -73,7 +70,7 @@ func (client *ActionGroupsClient) BeginCreateNotificationsAtActionGroupResourceL // CreateNotificationsAtActionGroupResourceLevel - Send test notifications to a set of provided receivers // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01 +// Generated from API version 2024-10-01-preview func (client *ActionGroupsClient) createNotificationsAtActionGroupResourceLevel(ctx context.Context, resourceGroupName string, actionGroupName string, notificationRequest NotificationRequestBody, options *ActionGroupsClientBeginCreateNotificationsAtActionGroupResourceLevelOptions) (*http.Response, error) { var err error const operationName = "ActionGroupsClient.BeginCreateNotificationsAtActionGroupResourceLevel" @@ -96,7 +93,7 @@ func (client *ActionGroupsClient) createNotificationsAtActionGroupResourceLevel( } // createNotificationsAtActionGroupResourceLevelCreateRequest creates the CreateNotificationsAtActionGroupResourceLevel request. -func (client *ActionGroupsClient) createNotificationsAtActionGroupResourceLevelCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, notificationRequest NotificationRequestBody, options *ActionGroupsClientBeginCreateNotificationsAtActionGroupResourceLevelOptions) (*policy.Request, error) { +func (client *ActionGroupsClient) createNotificationsAtActionGroupResourceLevelCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, notificationRequest NotificationRequestBody, _ *ActionGroupsClientBeginCreateNotificationsAtActionGroupResourceLevelOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}/createNotifications" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -115,7 +112,7 @@ func (client *ActionGroupsClient) createNotificationsAtActionGroupResourceLevelC return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, notificationRequest); err != nil { @@ -127,7 +124,7 @@ func (client *ActionGroupsClient) createNotificationsAtActionGroupResourceLevelC // CreateOrUpdate - Create a new action group or update an existing one. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - actionGroupName - The name of the action group. // - actionGroup - The action group to create or use for the update. @@ -156,7 +153,7 @@ func (client *ActionGroupsClient) CreateOrUpdate(ctx context.Context, resourceGr } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ActionGroupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource, options *ActionGroupsClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ActionGroupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroup ActionGroupResource, _ *ActionGroupsClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -175,7 +172,7 @@ func (client *ActionGroupsClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, actionGroup); err != nil { @@ -196,7 +193,7 @@ func (client *ActionGroupsClient) createOrUpdateHandleResponse(resp *http.Respon // Delete - Delete an action group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - actionGroupName - The name of the action group. // - options - ActionGroupsClientDeleteOptions contains the optional parameters for the ActionGroupsClient.Delete method. @@ -222,7 +219,7 @@ func (client *ActionGroupsClient) Delete(ctx context.Context, resourceGroupName } // deleteCreateRequest creates the Delete request. -func (client *ActionGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, options *ActionGroupsClientDeleteOptions) (*policy.Request, error) { +func (client *ActionGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, _ *ActionGroupsClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -241,7 +238,7 @@ func (client *ActionGroupsClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -251,7 +248,7 @@ func (client *ActionGroupsClient) deleteCreateRequest(ctx context.Context, resou // operation is only supported for Email or SMS receivers. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - actionGroupName - The name of the action group. // - enableRequest - The receiver to re-enable. @@ -279,7 +276,7 @@ func (client *ActionGroupsClient) EnableReceiver(ctx context.Context, resourceGr } // enableReceiverCreateRequest creates the EnableReceiver request. -func (client *ActionGroupsClient) enableReceiverCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest, options *ActionGroupsClientEnableReceiverOptions) (*policy.Request, error) { +func (client *ActionGroupsClient) enableReceiverCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, enableRequest EnableRequest, _ *ActionGroupsClientEnableReceiverOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}/subscribe" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -298,7 +295,7 @@ func (client *ActionGroupsClient) enableReceiverCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, enableRequest); err != nil { @@ -310,7 +307,7 @@ func (client *ActionGroupsClient) enableReceiverCreateRequest(ctx context.Contex // Get - Get an action group. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - actionGroupName - The name of the action group. // - options - ActionGroupsClientGetOptions contains the optional parameters for the ActionGroupsClient.Get method. @@ -337,7 +334,7 @@ func (client *ActionGroupsClient) Get(ctx context.Context, resourceGroupName str } // getCreateRequest creates the Get request. -func (client *ActionGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, options *ActionGroupsClientGetOptions) (*policy.Request, error) { +func (client *ActionGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, _ *ActionGroupsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -356,7 +353,7 @@ func (client *ActionGroupsClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -374,7 +371,7 @@ func (client *ActionGroupsClient) getHandleResponse(resp *http.Response) (Action // GetTestNotificationsAtActionGroupResourceLevel - Get the test notifications by the notification id // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - actionGroupName - The name of the action group. // - notificationID - The notification id @@ -403,7 +400,7 @@ func (client *ActionGroupsClient) GetTestNotificationsAtActionGroupResourceLevel } // getTestNotificationsAtActionGroupResourceLevelCreateRequest creates the GetTestNotificationsAtActionGroupResourceLevel request. -func (client *ActionGroupsClient) getTestNotificationsAtActionGroupResourceLevelCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, notificationID string, options *ActionGroupsClientGetTestNotificationsAtActionGroupResourceLevelOptions) (*policy.Request, error) { +func (client *ActionGroupsClient) getTestNotificationsAtActionGroupResourceLevelCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, notificationID string, _ *ActionGroupsClientGetTestNotificationsAtActionGroupResourceLevelOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}/notificationStatus/{notificationId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -426,7 +423,7 @@ func (client *ActionGroupsClient) getTestNotificationsAtActionGroupResourceLevel return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -443,7 +440,7 @@ func (client *ActionGroupsClient) getTestNotificationsAtActionGroupResourceLevel // NewListByResourceGroupPager - Get a list of all action groups in a resource group. // -// Generated from API version 2023-01-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ActionGroupsClientListByResourceGroupOptions contains the optional parameters for the ActionGroupsClient.NewListByResourceGroupPager // method. @@ -472,7 +469,7 @@ func (client *ActionGroupsClient) NewListByResourceGroupPager(resourceGroupName } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *ActionGroupsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ActionGroupsClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *ActionGroupsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *ActionGroupsClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups" if resourceGroupName == "" { return nil, errors.New("parameter resourceGroupName cannot be empty") @@ -487,7 +484,7 @@ func (client *ActionGroupsClient) listByResourceGroupCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -504,7 +501,7 @@ func (client *ActionGroupsClient) listByResourceGroupHandleResponse(resp *http.R // NewListBySubscriptionIDPager - Get a list of all action groups in a subscription. // -// Generated from API version 2023-01-01 +// Generated from API version 2024-10-01-preview // - options - ActionGroupsClientListBySubscriptionIDOptions contains the optional parameters for the ActionGroupsClient.NewListBySubscriptionIDPager // method. func (client *ActionGroupsClient) NewListBySubscriptionIDPager(options *ActionGroupsClientListBySubscriptionIDOptions) *runtime.Pager[ActionGroupsClientListBySubscriptionIDResponse] { @@ -532,7 +529,7 @@ func (client *ActionGroupsClient) NewListBySubscriptionIDPager(options *ActionGr } // listBySubscriptionIDCreateRequest creates the ListBySubscriptionID request. -func (client *ActionGroupsClient) listBySubscriptionIDCreateRequest(ctx context.Context, options *ActionGroupsClientListBySubscriptionIDOptions) (*policy.Request, error) { +func (client *ActionGroupsClient) listBySubscriptionIDCreateRequest(ctx context.Context, _ *ActionGroupsClientListBySubscriptionIDOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/actionGroups" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -543,7 +540,7 @@ func (client *ActionGroupsClient) listBySubscriptionIDCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -561,7 +558,7 @@ func (client *ActionGroupsClient) listBySubscriptionIDHandleResponse(resp *http. // Update - Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-01-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - actionGroupName - The name of the action group. // - actionGroupPatch - Parameters supplied to the operation. @@ -589,7 +586,7 @@ func (client *ActionGroupsClient) Update(ctx context.Context, resourceGroupName } // updateCreateRequest creates the Update request. -func (client *ActionGroupsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody, options *ActionGroupsClientUpdateOptions) (*policy.Request, error) { +func (client *ActionGroupsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, actionGroupName string, actionGroupPatch ActionGroupPatchBody, _ *ActionGroupsClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/actionGroups/{actionGroupName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -608,7 +605,7 @@ func (client *ActionGroupsClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-01-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, actionGroupPatch); err != nil { diff --git a/sdk/resourcemanager/monitor/armmonitor/actiongroups_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/actiongroups_client_example_test.go deleted file mode 100644 index 1c00a65a8bdc..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/actiongroups_client_example_test.go +++ /dev/null @@ -1,938 +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 armmonitor_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/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/createOrUpdateActionGroup.json -func ExampleActionGroupsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActionGroupsClient().CreateOrUpdate(ctx, "Default-NotificationRules", "SampleActionGroup", armmonitor.ActionGroupResource{ - Location: to.Ptr("Global"), - Tags: map[string]*string{}, - Properties: &armmonitor.ActionGroup{ - ArmRoleReceivers: []*armmonitor.ArmRoleReceiver{ - { - Name: to.Ptr("Sample armRole"), - RoleID: to.Ptr("8e3af657-a8ff-443c-a75c-2fe8c4bcb635"), - UseCommonAlertSchema: to.Ptr(true), - }}, - AutomationRunbookReceivers: []*armmonitor.AutomationRunbookReceiver{ - { - Name: to.Ptr("testRunbook"), - AutomationAccountID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest"), - IsGlobalRunbook: to.Ptr(false), - RunbookName: to.Ptr("Sample runbook"), - ServiceURI: to.Ptr(""), - UseCommonAlertSchema: to.Ptr(true), - WebhookResourceID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest/webhooks/Alert1510184037084"), - }}, - AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiver{ - { - Name: to.Ptr("Sample azureAppPush"), - EmailAddress: to.Ptr("johndoe@email.com"), - }}, - AzureFunctionReceivers: []*armmonitor.AzureFunctionReceiver{ - { - Name: to.Ptr("Sample azureFunction"), - FunctionAppResourceID: to.Ptr("/subscriptions/5def922a-3ed4-49c1-b9fd-05ec533819a3/resourceGroups/aznsTest/providers/Microsoft.Web/sites/testFunctionApp"), - FunctionName: to.Ptr("HttpTriggerCSharp1"), - HTTPTriggerURL: to.Ptr("http://test.me"), - UseCommonAlertSchema: to.Ptr(true), - }}, - EmailReceivers: []*armmonitor.EmailReceiver{ - { - Name: to.Ptr("John Doe's email"), - EmailAddress: to.Ptr("johndoe@email.com"), - UseCommonAlertSchema: to.Ptr(false), - }, - { - Name: to.Ptr("Jane Smith's email"), - EmailAddress: to.Ptr("janesmith@email.com"), - UseCommonAlertSchema: to.Ptr(true), - }}, - Enabled: to.Ptr(true), - EventHubReceivers: []*armmonitor.EventHubReceiver{ - { - Name: to.Ptr("Sample eventHub"), - EventHubName: to.Ptr("testEventHub"), - EventHubNameSpace: to.Ptr("testEventHubNameSpace"), - SubscriptionID: to.Ptr("187f412d-1758-44d9-b052-169e2564721d"), - TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - }}, - GroupShortName: to.Ptr("sample"), - ItsmReceivers: []*armmonitor.ItsmReceiver{ - { - Name: to.Ptr("Sample itsm"), - ConnectionID: to.Ptr("a3b9076c-ce8e-434e-85b4-aff10cb3c8f1"), - Region: to.Ptr("westcentralus"), - TicketConfiguration: to.Ptr("{\"PayloadRevision\":0,\"WorkItemType\":\"Incident\",\"UseTemplate\":false,\"WorkItemData\":\"{}\",\"CreateOneWIPerCI\":false}"), - WorkspaceID: to.Ptr("5def922a-3ed4-49c1-b9fd-05ec533819a3|55dfd1f8-7e59-4f89-bf56-4c82f5ace23c"), - }}, - LogicAppReceivers: []*armmonitor.LogicAppReceiver{ - { - Name: to.Ptr("Sample logicApp"), - CallbackURL: to.Ptr("https://prod-27.northcentralus.logic.azure.com/workflows/68e572e818e5457ba898763b7db90877/triggers/manual/paths/invoke/azns/test?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=Abpsb72UYJxPPvmDo937uzofupO5r_vIeWEx7KVHo7w"), - ResourceID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/LogicApp/providers/Microsoft.Logic/workflows/testLogicApp"), - UseCommonAlertSchema: to.Ptr(false), - }}, - SmsReceivers: []*armmonitor.SmsReceiver{ - { - Name: to.Ptr("John Doe's mobile"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("1234567890"), - }, - { - Name: to.Ptr("Jane Smith's mobile"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("0987654321"), - }}, - VoiceReceivers: []*armmonitor.VoiceReceiver{ - { - Name: to.Ptr("Sample voice"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("1234567890"), - }}, - WebhookReceivers: []*armmonitor.WebhookReceiver{ - { - Name: to.Ptr("Sample webhook 1"), - ServiceURI: to.Ptr("http://www.example.com/webhook1"), - UseCommonAlertSchema: to.Ptr(true), - }, - { - Name: to.Ptr("Sample webhook 2"), - IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - ServiceURI: to.Ptr("http://www.example.com/webhook2"), - TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - UseAADAuth: to.Ptr(true), - UseCommonAlertSchema: to.Ptr(true), - }}, - }, - }, 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.ActionGroupResource = armmonitor.ActionGroupResource{ - // Name: to.Ptr("SampleActionGroup"), - // Type: to.Ptr("Microsoft.Insights/ActionGroups"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-NotificationRules/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.ActionGroup{ - // ArmRoleReceivers: []*armmonitor.ArmRoleReceiver{ - // { - // Name: to.Ptr("Sample armRole"), - // RoleID: to.Ptr("8e3af657-a8ff-443c-a75c-2fe8c4bcb635"), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // AutomationRunbookReceivers: []*armmonitor.AutomationRunbookReceiver{ - // { - // Name: to.Ptr("testRunbook"), - // AutomationAccountID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest"), - // IsGlobalRunbook: to.Ptr(false), - // RunbookName: to.Ptr("Sample runbook"), - // ServiceURI: to.Ptr(""), - // UseCommonAlertSchema: to.Ptr(true), - // WebhookResourceID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest/webhooks/Alert1510184037084"), - // }}, - // AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiver{ - // { - // Name: to.Ptr("Sample azureAppPush"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // }}, - // AzureFunctionReceivers: []*armmonitor.AzureFunctionReceiver{ - // { - // Name: to.Ptr("Sample azureFunction"), - // FunctionAppResourceID: to.Ptr("/subscriptions/5def922a-3ed4-49c1-b9fd-05ec533819a3/resourceGroups/aznsTest/providers/Microsoft.Web/sites/testFunctionApp"), - // FunctionName: to.Ptr("HttpTriggerCSharp1"), - // HTTPTriggerURL: to.Ptr(""), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // EmailReceivers: []*armmonitor.EmailReceiver{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(true), - // EventHubReceivers: []*armmonitor.EventHubReceiver{ - // { - // Name: to.Ptr("Sample eventHub"), - // EventHubName: to.Ptr("testEventHub"), - // EventHubNameSpace: to.Ptr("testEventHubNameSpace"), - // SubscriptionID: to.Ptr("187f412d-1758-44d9-b052-169e2564721d"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseCommonAlertSchema: to.Ptr(false), - // }}, - // GroupShortName: to.Ptr("sample"), - // ItsmReceivers: []*armmonitor.ItsmReceiver{ - // { - // Name: to.Ptr("Sample itsm"), - // ConnectionID: to.Ptr("a3b9076c-ce8e-434e-85b4-aff10cb3c8f1"), - // Region: to.Ptr("westcentralus"), - // TicketConfiguration: to.Ptr("{\"PayloadRevision\":0,\"WorkItemType\":\"Incident\",\"UseTemplate\":false,\"WorkItemData\":\"{}\",\"CreateOneWIPerCI\":false}"), - // WorkspaceID: to.Ptr("5def922a-3ed4-49c1-b9fd-05ec533819a3|55dfd1f8-7e59-4f89-bf56-4c82f5ace23c"), - // }}, - // LogicAppReceivers: []*armmonitor.LogicAppReceiver{ - // { - // Name: to.Ptr("Sample logicApp"), - // CallbackURL: to.Ptr("https://prod-27.northcentralus.logic.azure.com/workflows/68e572e818e5457ba898763b7db90877/triggers/manual/paths/invoke/azns/test?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=Abpsb72UYJxPPvmDo937uzofupO5r_vIeWEx7KVHo7w"), - // ResourceID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/LogicApp/providers/Microsoft.Logic/workflows/testLogicApp"), - // UseCommonAlertSchema: to.Ptr(false), - // }}, - // SmsReceivers: []*armmonitor.SmsReceiver{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("1234567890"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiver{ - // { - // Name: to.Ptr("Sample voice"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("1234567890"), - // }}, - // WebhookReceivers: []*armmonitor.WebhookReceiver{ - // { - // Name: to.Ptr("Sample webhook 1"), - // ServiceURI: to.Ptr("http://www.example.com/webhook1"), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/getActionGroup.json -func ExampleActionGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActionGroupsClient().Get(ctx, "Default-NotificationRules", "SampleActionGroup", 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.ActionGroupResource = armmonitor.ActionGroupResource{ - // Name: to.Ptr("SampleActionGroup"), - // Type: to.Ptr("Microsoft.Insights/ActionGroups"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-NotificationRules/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.ActionGroup{ - // ArmRoleReceivers: []*armmonitor.ArmRoleReceiver{ - // }, - // AutomationRunbookReceivers: []*armmonitor.AutomationRunbookReceiver{ - // }, - // AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiver{ - // }, - // AzureFunctionReceivers: []*armmonitor.AzureFunctionReceiver{ - // }, - // EmailReceivers: []*armmonitor.EmailReceiver{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusDisabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(true), - // EventHubReceivers: []*armmonitor.EventHubReceiver{ - // }, - // GroupShortName: to.Ptr("sample"), - // ItsmReceivers: []*armmonitor.ItsmReceiver{ - // }, - // LogicAppReceivers: []*armmonitor.LogicAppReceiver{ - // }, - // SmsReceivers: []*armmonitor.SmsReceiver{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("1234567890"), - // Status: to.Ptr(armmonitor.ReceiverStatusDisabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiver{ - // }, - // WebhookReceivers: []*armmonitor.WebhookReceiver{ - // { - // Name: to.Ptr("Sample webhook"), - // ServiceURI: to.Ptr("http://www.example.com/webhook"), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/deleteActionGroup.json -func ExampleActionGroupsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewActionGroupsClient().Delete(ctx, "Default-NotificationRules", "SampleActionGroup", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/patchActionGroup.json -func ExampleActionGroupsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActionGroupsClient().Update(ctx, "Default-NotificationRules", "SampleActionGroup", armmonitor.ActionGroupPatchBody{ - Properties: &armmonitor.ActionGroupPatch{ - Enabled: to.Ptr(false), - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, 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.ActionGroupResource = armmonitor.ActionGroupResource{ - // Name: to.Ptr("SampleActionGroup"), - // Type: to.Ptr("Microsoft.Insights/ActionGroups"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-NotificationRules/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armmonitor.ActionGroup{ - // ArmRoleReceivers: []*armmonitor.ArmRoleReceiver{ - // }, - // AutomationRunbookReceivers: []*armmonitor.AutomationRunbookReceiver{ - // }, - // AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiver{ - // }, - // AzureFunctionReceivers: []*armmonitor.AzureFunctionReceiver{ - // }, - // EmailReceivers: []*armmonitor.EmailReceiver{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(true), - // EventHubReceivers: []*armmonitor.EventHubReceiver{ - // }, - // GroupShortName: to.Ptr("sample"), - // ItsmReceivers: []*armmonitor.ItsmReceiver{ - // }, - // LogicAppReceivers: []*armmonitor.LogicAppReceiver{ - // }, - // SmsReceivers: []*armmonitor.SmsReceiver{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("1234567890"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiver{ - // }, - // WebhookReceivers: []*armmonitor.WebhookReceiver{ - // { - // Name: to.Ptr("Sample webhook"), - // ServiceURI: to.Ptr("http://www.example.com/webhook"), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/postTestNotificationsAtActionGroupResourceLevel.json -func ExampleActionGroupsClient_BeginCreateNotificationsAtActionGroupResourceLevel() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewActionGroupsClient().BeginCreateNotificationsAtActionGroupResourceLevel(ctx, "TestRgName", "TestAgName", armmonitor.NotificationRequestBody{ - AlertType: to.Ptr("budget"), - ArmRoleReceivers: []*armmonitor.ArmRoleReceiver{ - { - Name: to.Ptr("ArmRole-Common"), - RoleID: to.Ptr("11111111-1111-1111-1111-111111111111"), - UseCommonAlertSchema: to.Ptr(true), - }, - { - Name: to.Ptr("ArmRole-nonCommon"), - RoleID: to.Ptr("11111111-1111-1111-1111-111111111111"), - UseCommonAlertSchema: to.Ptr(false), - }}, - AutomationRunbookReceivers: []*armmonitor.AutomationRunbookReceiver{ - { - Name: to.Ptr("testRunbook"), - AutomationAccountID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest"), - IsGlobalRunbook: to.Ptr(false), - RunbookName: to.Ptr("Sample runbook"), - ServiceURI: to.Ptr("http://test.me"), - UseCommonAlertSchema: to.Ptr(true), - WebhookResourceID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest/webhooks/Alert1510184037084"), - }}, - AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiver{ - { - Name: to.Ptr("Sample azureAppPush"), - EmailAddress: to.Ptr("johndoe@email.com"), - }}, - AzureFunctionReceivers: []*armmonitor.AzureFunctionReceiver{ - { - Name: to.Ptr("Sample azureFunction"), - FunctionAppResourceID: to.Ptr("/subscriptions/5def922a-3ed4-49c1-b9fd-05ec533819a3/resourceGroups/aznsTest/providers/Microsoft.Web/sites/testFunctionApp"), - FunctionName: to.Ptr("HttpTriggerCSharp1"), - HTTPTriggerURL: to.Ptr("http://test.me"), - UseCommonAlertSchema: to.Ptr(true), - }}, - EmailReceivers: []*armmonitor.EmailReceiver{ - { - Name: to.Ptr("John Doe's email"), - EmailAddress: to.Ptr("johndoe@email.com"), - UseCommonAlertSchema: to.Ptr(false), - }, - { - Name: to.Ptr("Jane Smith's email"), - EmailAddress: to.Ptr("janesmith@email.com"), - UseCommonAlertSchema: to.Ptr(true), - }}, - EventHubReceivers: []*armmonitor.EventHubReceiver{ - { - Name: to.Ptr("Sample eventHub"), - EventHubName: to.Ptr("testEventHub"), - EventHubNameSpace: to.Ptr("testEventHubNameSpace"), - SubscriptionID: to.Ptr("187f412d-1758-44d9-b052-169e2564721d"), - TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - }}, - ItsmReceivers: []*armmonitor.ItsmReceiver{ - { - Name: to.Ptr("Sample itsm"), - ConnectionID: to.Ptr("a3b9076c-ce8e-434e-85b4-aff10cb3c8f1"), - Region: to.Ptr("westcentralus"), - TicketConfiguration: to.Ptr("{\"PayloadRevision\":0,\"WorkItemType\":\"Incident\",\"UseTemplate\":false,\"WorkItemData\":\"{}\",\"CreateOneWIPerCI\":false}"), - WorkspaceID: to.Ptr("5def922a-3ed4-49c1-b9fd-05ec533819a3|55dfd1f8-7e59-4f89-bf56-4c82f5ace23c"), - }}, - LogicAppReceivers: []*armmonitor.LogicAppReceiver{ - { - Name: to.Ptr("Sample logicApp"), - CallbackURL: to.Ptr("https://prod-27.northcentralus.logic.azure.com/workflows/68e572e818e5457ba898763b7db90877/triggers/manual/paths/invoke/azns/test?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=Abpsb72UYJxPPvmDo937uzofupO5r_vIeWEx7KVHo7w"), - ResourceID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/LogicApp/providers/Microsoft.Logic/workflows/testLogicApp"), - UseCommonAlertSchema: to.Ptr(false), - }}, - SmsReceivers: []*armmonitor.SmsReceiver{ - { - Name: to.Ptr("John Doe's mobile"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("1234567890"), - }, - { - Name: to.Ptr("Jane Smith's mobile"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("0987654321"), - }}, - VoiceReceivers: []*armmonitor.VoiceReceiver{ - { - Name: to.Ptr("Sample voice"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("1234567890"), - }}, - WebhookReceivers: []*armmonitor.WebhookReceiver{ - { - Name: to.Ptr("Sample webhook 1"), - ServiceURI: to.Ptr("http://www.example.com/webhook1"), - UseCommonAlertSchema: to.Ptr(true), - }, - { - Name: to.Ptr("Sample webhook 2"), - IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - ServiceURI: to.Ptr("http://www.example.com/webhook2"), - TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - UseAADAuth: to.Ptr(true), - UseCommonAlertSchema: to.Ptr(true), - }}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.TestNotificationDetailsResponse = armmonitor.TestNotificationDetailsResponse{ - // ActionDetails: []*armmonitor.ActionDetail{ - // { - // MechanismType: to.Ptr("AzureAppPush"), - // Name: to.Ptr("AzureAppPush-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.8620629+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("AzureFunction"), - // Name: to.Ptr("AzureFunction-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0623319+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Email"), - // Name: to.Ptr("Email-name"), - // SendTime: to.Ptr("2021-09-21T04:52:40.7480368+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("LogicApp"), - // Name: to.Ptr("LogicApp-Name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.2473419+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Webhook"), - // Name: to.Ptr("Webhook-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("SecureWebhook"), - // Name: to.Ptr("SecureWebhook-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Sms"), - // Name: to.Ptr("Sms-name"), - // SendTime: to.Ptr("2021-09-21T04:52:41.353015+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Voice"), - // Name: to.Ptr("Voice-name"), - // SendTime: to.Ptr("2021-09-21T04:52:41.6330734+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("EventHub"), - // Name: to.Ptr("EventHub-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("AutomationRunbook"), - // Name: to.Ptr("AutomationRunbook-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Itsm"), - // Name: to.Ptr("Itsm-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }}, - // CompletedTime: to.Ptr("0001-01-01T00:00:00+00:00"), - // Context: &armmonitor.Context{ - // ContextType: to.Ptr("Microsoft.Insights/Budget"), - // NotificationSource: to.Ptr("Microsoft.Insights/TestNotification"), - // }, - // CreatedTime: to.Ptr("2021-09-21T04:52:29.5091168+00:00"), - // State: to.Ptr("Completed"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/getTestNotificationsAtActionGroupResourceLevel.json -func ExampleActionGroupsClient_GetTestNotificationsAtActionGroupResourceLevel() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActionGroupsClient().GetTestNotificationsAtActionGroupResourceLevel(ctx, "TestRgName", "TestAgName", "11000222191287", 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.TestNotificationDetailsResponse = armmonitor.TestNotificationDetailsResponse{ - // ActionDetails: []*armmonitor.ActionDetail{ - // { - // MechanismType: to.Ptr("AzureAppPush"), - // Name: to.Ptr("AzureAppPush-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.8620629+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("AzureFunction"), - // Name: to.Ptr("AzureFunction-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0623319+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Email"), - // Name: to.Ptr("Email-name"), - // SendTime: to.Ptr("2021-09-21T04:52:40.7480368+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("LogicApp"), - // Name: to.Ptr("LogicApp-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.2473419+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Webhook"), - // Name: to.Ptr("Webhook-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("SecureWebhook"), - // Name: to.Ptr("SecureWebhook-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Sms"), - // Name: to.Ptr("Sms-name"), - // SendTime: to.Ptr("2021-09-21T04:52:41.353015+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Voice"), - // Name: to.Ptr("Voice-name"), - // SendTime: to.Ptr("2021-09-21T04:52:41.6330734+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("EventHub"), - // Name: to.Ptr("EventHub-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("AutomationRunbook"), - // Name: to.Ptr("AutomationRunbook-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }, - // { - // MechanismType: to.Ptr("Itsm"), - // Name: to.Ptr("Itsm-name"), - // SendTime: to.Ptr("2021-09-21T04:52:42.0723479+00:00"), - // Status: to.Ptr("Completed"), - // SubState: to.Ptr("Default"), - // }}, - // CompletedTime: to.Ptr("0001-01-01T00:00:00+00:00"), - // Context: &armmonitor.Context{ - // ContextType: to.Ptr("Microsoft.Insights/Budget"), - // NotificationSource: to.Ptr("Microsoft.Insights/TestNotification"), - // }, - // CreatedTime: to.Ptr("2021-09-21T04:52:29.5091168+00:00"), - // State: to.Ptr("Completed"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/listActionGroups.json -func ExampleActionGroupsClient_NewListBySubscriptionIDPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewActionGroupsClient().NewListBySubscriptionIDPager(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.ActionGroupList = armmonitor.ActionGroupList{ - // Value: []*armmonitor.ActionGroupResource{ - // { - // Name: to.Ptr("SampleActionGroup"), - // Type: to.Ptr("Microsoft.Insights/ActionGroups"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-NotificationRules/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.ActionGroup{ - // ArmRoleReceivers: []*armmonitor.ArmRoleReceiver{ - // }, - // AutomationRunbookReceivers: []*armmonitor.AutomationRunbookReceiver{ - // }, - // AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiver{ - // }, - // AzureFunctionReceivers: []*armmonitor.AzureFunctionReceiver{ - // }, - // EmailReceivers: []*armmonitor.EmailReceiver{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusDisabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(true), - // EventHubReceivers: []*armmonitor.EventHubReceiver{ - // }, - // GroupShortName: to.Ptr("sample"), - // ItsmReceivers: []*armmonitor.ItsmReceiver{ - // }, - // LogicAppReceivers: []*armmonitor.LogicAppReceiver{ - // }, - // SmsReceivers: []*armmonitor.SmsReceiver{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("1234567890"), - // Status: to.Ptr(armmonitor.ReceiverStatusDisabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiver{ - // }, - // WebhookReceivers: []*armmonitor.WebhookReceiver{ - // { - // Name: to.Ptr("Sample webhook"), - // ServiceURI: to.Ptr("http://www.example.com/webhook"), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // }, - // { - // Name: to.Ptr("SampleActionGroup2"), - // Type: to.Ptr("Microsoft.Insights/ActionGroups"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-NotificationRules/providers/microsoft.insights/actionGroups/SampleActionGroup2"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.ActionGroup{ - // ArmRoleReceivers: []*armmonitor.ArmRoleReceiver{ - // }, - // AutomationRunbookReceivers: []*armmonitor.AutomationRunbookReceiver{ - // }, - // AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiver{ - // }, - // AzureFunctionReceivers: []*armmonitor.AzureFunctionReceiver{ - // }, - // EmailReceivers: []*armmonitor.EmailReceiver{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(false), - // EventHubReceivers: []*armmonitor.EventHubReceiver{ - // }, - // GroupShortName: to.Ptr("sample2"), - // ItsmReceivers: []*armmonitor.ItsmReceiver{ - // }, - // LogicAppReceivers: []*armmonitor.LogicAppReceiver{ - // }, - // SmsReceivers: []*armmonitor.SmsReceiver{ - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiver{ - // }, - // WebhookReceivers: []*armmonitor.WebhookReceiver{ - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2023-01-01/examples/enableReceiver.json -func ExampleActionGroupsClient_EnableReceiver() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewActionGroupsClient().EnableReceiver(ctx, "Default-NotificationRules", "SampleActionGroup", armmonitor.EnableRequest{ - ReceiverName: to.Ptr("John Doe's mobile"), - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client.go b/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client.go deleted file mode 100644 index 73bf59a32024..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client.go +++ /dev/null @@ -1,418 +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 armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// ActivityLogAlertsClient contains the methods for the ActivityLogAlerts group. -// Don't use this type directly, use NewActivityLogAlertsClient() instead. -type ActivityLogAlertsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewActivityLogAlertsClient creates a new instance of ActivityLogAlertsClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewActivityLogAlertsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ActivityLogAlertsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ActivityLogAlertsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Create a new Activity Log Alert rule or update an existing one. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-10-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - activityLogAlertName - The name of the Activity Log Alert rule. -// - activityLogAlertRule - The Activity Log Alert rule to create or use for the update. -// - options - ActivityLogAlertsClientCreateOrUpdateOptions contains the optional parameters for the ActivityLogAlertsClient.CreateOrUpdate -// method. -func (client *ActivityLogAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertRule ActivityLogAlertResource, options *ActivityLogAlertsClientCreateOrUpdateOptions) (ActivityLogAlertsClientCreateOrUpdateResponse, error) { - var err error - const operationName = "ActivityLogAlertsClient.CreateOrUpdate" - 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, activityLogAlertName, activityLogAlertRule, options) - if err != nil { - return ActivityLogAlertsClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ActivityLogAlertsClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return ActivityLogAlertsClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ActivityLogAlertsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertRule ActivityLogAlertResource, options *ActivityLogAlertsClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if activityLogAlertName == "" { - return nil, errors.New("parameter activityLogAlertName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{activityLogAlertName}", url.PathEscape(activityLogAlertName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, activityLogAlertRule); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *ActivityLogAlertsClient) createOrUpdateHandleResponse(resp *http.Response) (ActivityLogAlertsClientCreateOrUpdateResponse, error) { - result := ActivityLogAlertsClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ActivityLogAlertResource); err != nil { - return ActivityLogAlertsClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Delete an Activity Log Alert rule. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-10-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - activityLogAlertName - The name of the Activity Log Alert rule. -// - options - ActivityLogAlertsClientDeleteOptions contains the optional parameters for the ActivityLogAlertsClient.Delete -// method. -func (client *ActivityLogAlertsClient) Delete(ctx context.Context, resourceGroupName string, activityLogAlertName string, options *ActivityLogAlertsClientDeleteOptions) (ActivityLogAlertsClientDeleteResponse, error) { - var err error - const operationName = "ActivityLogAlertsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, activityLogAlertName, options) - if err != nil { - return ActivityLogAlertsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ActivityLogAlertsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return ActivityLogAlertsClientDeleteResponse{}, err - } - return ActivityLogAlertsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *ActivityLogAlertsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, activityLogAlertName string, options *ActivityLogAlertsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if activityLogAlertName == "" { - return nil, errors.New("parameter activityLogAlertName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{activityLogAlertName}", url.PathEscape(activityLogAlertName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get an Activity Log Alert rule. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-10-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - activityLogAlertName - The name of the Activity Log Alert rule. -// - options - ActivityLogAlertsClientGetOptions contains the optional parameters for the ActivityLogAlertsClient.Get method. -func (client *ActivityLogAlertsClient) Get(ctx context.Context, resourceGroupName string, activityLogAlertName string, options *ActivityLogAlertsClientGetOptions) (ActivityLogAlertsClientGetResponse, error) { - var err error - const operationName = "ActivityLogAlertsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, activityLogAlertName, options) - if err != nil { - return ActivityLogAlertsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ActivityLogAlertsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ActivityLogAlertsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ActivityLogAlertsClient) getCreateRequest(ctx context.Context, resourceGroupName string, activityLogAlertName string, options *ActivityLogAlertsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if activityLogAlertName == "" { - return nil, errors.New("parameter activityLogAlertName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{activityLogAlertName}", url.PathEscape(activityLogAlertName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ActivityLogAlertsClient) getHandleResponse(resp *http.Response) (ActivityLogAlertsClientGetResponse, error) { - result := ActivityLogAlertsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ActivityLogAlertResource); err != nil { - return ActivityLogAlertsClientGetResponse{}, err - } - return result, nil -} - -// NewListByResourceGroupPager - Get a list of all Activity Log Alert rules in a resource group. -// -// Generated from API version 2020-10-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - options - ActivityLogAlertsClientListByResourceGroupOptions contains the optional parameters for the ActivityLogAlertsClient.NewListByResourceGroupPager -// method. -func (client *ActivityLogAlertsClient) NewListByResourceGroupPager(resourceGroupName string, options *ActivityLogAlertsClientListByResourceGroupOptions) *runtime.Pager[ActivityLogAlertsClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[ActivityLogAlertsClientListByResourceGroupResponse]{ - More: func(page ActivityLogAlertsClientListByResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ActivityLogAlertsClientListByResourceGroupResponse) (ActivityLogAlertsClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ActivityLogAlertsClient.NewListByResourceGroupPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - }, nil) - if err != nil { - return ActivityLogAlertsClientListByResourceGroupResponse{}, err - } - return client.listByResourceGroupHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *ActivityLogAlertsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ActivityLogAlertsClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *ActivityLogAlertsClient) listByResourceGroupHandleResponse(resp *http.Response) (ActivityLogAlertsClientListByResourceGroupResponse, error) { - result := ActivityLogAlertsClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AlertRuleList); err != nil { - return ActivityLogAlertsClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionIDPager - Get a list of all Activity Log Alert rules in a subscription. -// -// Generated from API version 2020-10-01 -// - options - ActivityLogAlertsClientListBySubscriptionIDOptions contains the optional parameters for the ActivityLogAlertsClient.NewListBySubscriptionIDPager -// method. -func (client *ActivityLogAlertsClient) NewListBySubscriptionIDPager(options *ActivityLogAlertsClientListBySubscriptionIDOptions) *runtime.Pager[ActivityLogAlertsClientListBySubscriptionIDResponse] { - return runtime.NewPager(runtime.PagingHandler[ActivityLogAlertsClientListBySubscriptionIDResponse]{ - More: func(page ActivityLogAlertsClientListBySubscriptionIDResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ActivityLogAlertsClientListBySubscriptionIDResponse) (ActivityLogAlertsClientListBySubscriptionIDResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ActivityLogAlertsClient.NewListBySubscriptionIDPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listBySubscriptionIDCreateRequest(ctx, options) - }, nil) - if err != nil { - return ActivityLogAlertsClientListBySubscriptionIDResponse{}, err - } - return client.listBySubscriptionIDHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listBySubscriptionIDCreateRequest creates the ListBySubscriptionID request. -func (client *ActivityLogAlertsClient) listBySubscriptionIDCreateRequest(ctx context.Context, options *ActivityLogAlertsClientListBySubscriptionIDOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/activityLogAlerts" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionIDHandleResponse handles the ListBySubscriptionID response. -func (client *ActivityLogAlertsClient) listBySubscriptionIDHandleResponse(resp *http.Response) (ActivityLogAlertsClientListBySubscriptionIDResponse, error) { - result := ActivityLogAlertsClientListBySubscriptionIDResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AlertRuleList); err != nil { - return ActivityLogAlertsClientListBySubscriptionIDResponse{}, err - } - return result, nil -} - -// Update - Updates 'tags' and 'enabled' fields in an existing Alert rule. This method is used to update the Alert rule tags, -// and to enable or disable the Alert rule. To update other fields use CreateOrUpdate -// operation. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-10-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - activityLogAlertName - The name of the Activity Log Alert rule. -// - activityLogAlertRulePatch - Parameters supplied to the operation. -// - options - ActivityLogAlertsClientUpdateOptions contains the optional parameters for the ActivityLogAlertsClient.Update -// method. -func (client *ActivityLogAlertsClient) Update(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertRulePatch AlertRulePatchObject, options *ActivityLogAlertsClientUpdateOptions) (ActivityLogAlertsClientUpdateResponse, error) { - var err error - const operationName = "ActivityLogAlertsClient.Update" - 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, activityLogAlertName, activityLogAlertRulePatch, options) - if err != nil { - return ActivityLogAlertsClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ActivityLogAlertsClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ActivityLogAlertsClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *ActivityLogAlertsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertRulePatch AlertRulePatchObject, options *ActivityLogAlertsClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/activityLogAlerts/{activityLogAlertName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if activityLogAlertName == "" { - return nil, errors.New("parameter activityLogAlertName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{activityLogAlertName}", url.PathEscape(activityLogAlertName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, activityLogAlertRulePatch); err != nil { - return nil, err - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *ActivityLogAlertsClient) updateHandleResponse(resp *http.Response) (ActivityLogAlertsClientUpdateResponse, error) { - result := ActivityLogAlertsClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ActivityLogAlertResource); err != nil { - return ActivityLogAlertsClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client_example_test.go deleted file mode 100644 index 200ad713e952..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/activitylogalerts_client_example_test.go +++ /dev/null @@ -1,611 +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 armmonitor_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/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_CreateOrUpdate.json -func ExampleActivityLogAlertsClient_CreateOrUpdate_createOrUpdateAnActivityLogAlertRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActivityLogAlertsClient().CreateOrUpdate(ctx, "MyResourceGroup", "SampleActivityLogAlertRule", armmonitor.ActivityLogAlertResource{ - Location: to.Ptr("Global"), - Tags: map[string]*string{}, - Properties: &armmonitor.AlertRuleProperties{ - Description: to.Ptr("Description of sample Activity Log Alert rule."), - Actions: &armmonitor.ActionList{ - ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - { - ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup"), - WebhookProperties: map[string]*string{ - "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - }, - }}, - }, - Condition: &armmonitor.AlertRuleAllOfCondition{ - AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - { - Equals: to.Ptr("Administrative"), - Field: to.Ptr("category"), - }, - { - Equals: to.Ptr("Error"), - Field: to.Ptr("level"), - }}, - }, - Enabled: to.Ptr(true), - Scopes: []*string{ - to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - }, - }, 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.ActivityLogAlertResource = armmonitor.ActivityLogAlertResource{ - // Name: to.Ptr("SampleActivityLogAlertRule"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("Administrative"), - // Field: to.Ptr("Category"), - // }, - // { - // Equals: to.Ptr("Error"), - // Field: to.Ptr("Level"), - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_CreateOrUpdateRuleWithAnyOfCondition.json -func ExampleActivityLogAlertsClient_CreateOrUpdate_createOrUpdateAnActivityLogAlertRuleWithAnyOfCondition() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActivityLogAlertsClient().CreateOrUpdate(ctx, "MyResourceGroup", "SampleActivityLogAlertRuleWithAnyOfCondition", armmonitor.ActivityLogAlertResource{ - Location: to.Ptr("Global"), - Tags: map[string]*string{}, - Properties: &armmonitor.AlertRuleProperties{ - Description: to.Ptr("Description of sample Activity Log Alert rule with 'anyOf' condition."), - Actions: &armmonitor.ActionList{ - ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - { - ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup"), - WebhookProperties: map[string]*string{ - "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - }, - }}, - }, - Condition: &armmonitor.AlertRuleAllOfCondition{ - AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - { - Equals: to.Ptr("ServiceHealth"), - Field: to.Ptr("category"), - }, - { - AnyOf: []*armmonitor.AlertRuleLeafCondition{ - { - Equals: to.Ptr("Incident"), - Field: to.Ptr("properties.incidentType"), - }, - { - Equals: to.Ptr("Maintenance"), - Field: to.Ptr("properties.incidentType"), - }}, - }}, - }, - Enabled: to.Ptr(true), - Scopes: []*string{ - to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - }, - }, 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.ActivityLogAlertResource = armmonitor.ActivityLogAlertResource{ - // Name: to.Ptr("SampleActivityLogAlertRuleWithAnyOfCondition"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRuleWithAnyOfCondition"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule with 'anyOf' condition."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("ServiceHealth"), - // Field: to.Ptr("category"), - // }, - // { - // AnyOf: []*armmonitor.AlertRuleLeafCondition{ - // { - // Equals: to.Ptr("Incident"), - // Field: to.Ptr("properties.incidentType"), - // }, - // { - // Equals: to.Ptr("Maintenance"), - // Field: to.Ptr("properties.incidentType"), - // }}, - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_CreateOrUpdateRuleWithContainsAny.json -func ExampleActivityLogAlertsClient_CreateOrUpdate_createOrUpdateAnActivityLogAlertRuleWithContainsAny() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActivityLogAlertsClient().CreateOrUpdate(ctx, "MyResourceGroup", "SampleActivityLogAlertRuleWithContainsAny", armmonitor.ActivityLogAlertResource{ - Location: to.Ptr("Global"), - Tags: map[string]*string{}, - Properties: &armmonitor.AlertRuleProperties{ - Description: to.Ptr("Description of sample Activity Log Alert rule with 'containsAny'."), - Actions: &armmonitor.ActionList{ - ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - { - ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup"), - WebhookProperties: map[string]*string{ - "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - }, - }}, - }, - Condition: &armmonitor.AlertRuleAllOfCondition{ - AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - { - Equals: to.Ptr("ServiceHealth"), - Field: to.Ptr("category"), - }, - { - ContainsAny: []*string{ - to.Ptr("North Europe"), - to.Ptr("West Europe")}, - Field: to.Ptr("properties.impactedServices[*].ImpactedRegions[*].RegionName"), - }}, - }, - Enabled: to.Ptr(true), - Scopes: []*string{ - to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - }, - }, 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.ActivityLogAlertResource = armmonitor.ActivityLogAlertResource{ - // Name: to.Ptr("SampleActivityLogAlertRuleWithContainsAny"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRuleWithContainsAny"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule with 'containsAny'."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("ServiceHealth"), - // Field: to.Ptr("category"), - // }, - // { - // ContainsAny: []*string{ - // to.Ptr("North Europe"), - // to.Ptr("West Europe")}, - // Field: to.Ptr("properties.impactedServices[*].ImpactedRegions[*].RegionName"), - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_Get.json -func ExampleActivityLogAlertsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActivityLogAlertsClient().Get(ctx, "MyResourceGroup", "SampleActivityLogAlertRule", 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.ActivityLogAlertResource = armmonitor.ActivityLogAlertResource{ - // Name: to.Ptr("SampleActivityLogAlertRule"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("Administrative"), - // Field: to.Ptr("category"), - // }, - // { - // Equals: to.Ptr("Error"), - // Field: to.Ptr("level"), - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_Delete.json -func ExampleActivityLogAlertsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewActivityLogAlertsClient().Delete(ctx, "MyResourceGroup", "SampleActivityLogAlertRule", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_Update.json -func ExampleActivityLogAlertsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActivityLogAlertsClient().Update(ctx, "MyResourceGroup", "SampleActivityLogAlertRule", armmonitor.AlertRulePatchObject{ - Properties: &armmonitor.AlertRulePatchProperties{ - Enabled: to.Ptr(false), - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, 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.ActivityLogAlertResource = armmonitor.ActivityLogAlertResource{ - // Name: to.Ptr("SampleActivityLogAlertRule"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("Administrative"), - // Field: to.Ptr("category"), - // }, - // { - // Equals: to.Ptr("Error"), - // Field: to.Ptr("level"), - // }}, - // }, - // Enabled: to.Ptr(false), - // Scopes: []*string{ - // to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_ListBySubscriptionId.json -func ExampleActivityLogAlertsClient_NewListBySubscriptionIDPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewActivityLogAlertsClient().NewListBySubscriptionIDPager(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.AlertRuleList = armmonitor.AlertRuleList{ - // Value: []*armmonitor.ActivityLogAlertResource{ - // { - // Name: to.Ptr("SampleActivityLogAlertRule1"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup1/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule1"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup1/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("Administrative"), - // Field: to.Ptr("category"), - // }, - // { - // Equals: to.Ptr("Error"), - // Field: to.Ptr("level"), - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - // }, - // }, - // { - // Name: to.Ptr("SampleActivityLogAlertRule2"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup2/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule2"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup2/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("Administrative"), - // Field: to.Ptr("category"), - // }, - // { - // Equals: to.Ptr("Succeeded"), - // Field: to.Ptr("status"), - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup2")}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_ListByResourceGroupName.json -func ExampleActivityLogAlertsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewActivityLogAlertsClient().NewListByResourceGroupPager("MyResourceGroup", 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.AlertRuleList = armmonitor.AlertRuleList{ - // Value: []*armmonitor.ActivityLogAlertResource{ - // { - // Name: to.Ptr("SampleActivityLogAlertRule1"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule1"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // "sampleWebhookProperty": to.Ptr("SamplePropertyValue"), - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("Administrative"), - // Field: to.Ptr("category"), - // }, - // { - // Equals: to.Ptr("Error"), - // Field: to.Ptr("level"), - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d")}, - // }, - // }, - // { - // Name: to.Ptr("SampleActivityLogAlertRule2"), - // Type: to.Ptr("Microsoft.Insights/ActivityLogAlerts"), - // ID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/activityLogAlerts/SampleActivityLogAlertRule2"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AlertRuleProperties{ - // Description: to.Ptr("Description of sample Activity Log Alert rule."), - // Actions: &armmonitor.ActionList{ - // ActionGroups: []*armmonitor.ActionGroupAutoGenerated{ - // { - // ActionGroupID: to.Ptr("/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/microsoft.insights/actionGroups/SampleActionGroup"), - // WebhookProperties: map[string]*string{ - // }, - // }}, - // }, - // Condition: &armmonitor.AlertRuleAllOfCondition{ - // AllOf: []*armmonitor.AlertRuleAnyOfOrLeafCondition{ - // { - // Equals: to.Ptr("Administrative"), - // Field: to.Ptr("category"), - // }, - // { - // Equals: to.Ptr("Succeeded"), - // Field: to.Ptr("status"), - // }}, - // }, - // Enabled: to.Ptr(true), - // Scopes: []*string{ - // to.Ptr("subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup")}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/activitylogs_client.go b/sdk/resourcemanager/monitor/armmonitor/activitylogs_client.go deleted file mode 100644 index 492b618e1a55..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/activitylogs_client.go +++ /dev/null @@ -1,116 +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 armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// ActivityLogsClient contains the methods for the ActivityLogs group. -// Don't use this type directly, use NewActivityLogsClient() instead. -type ActivityLogsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewActivityLogsClient creates a new instance of ActivityLogsClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewActivityLogsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ActivityLogsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ActivityLogsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// NewListPager - Provides the list of records from the activity logs. -// -// Generated from API version 2015-04-01 -// - filter - Reduces the set of data collected. -// This argument is required and it also requires at least the start date/time. -// The $filter argument is very restricted and allows only the following patterns. -// - List events for a resource group: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' -// and resourceGroupName eq 'resourceGroupName'. -// - List events for resource: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' -// and resourceUri eq 'resourceURI'. -// - List events for a subscription in a time range: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp -// le '2014-07-20T04:36:37.6407898Z'. -// - List events for a resource provider: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' -// and resourceProvider eq 'resourceProviderName'. -// - List events for a correlation Id: $filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and eventTimestamp le '2014-07-20T04:36:37.6407898Z' -// and correlationId eq 'correlationID'. -// NOTE: No other syntax is allowed. -// - options - ActivityLogsClientListOptions contains the optional parameters for the ActivityLogsClient.NewListPager method. -func (client *ActivityLogsClient) NewListPager(filter string, options *ActivityLogsClientListOptions) *runtime.Pager[ActivityLogsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[ActivityLogsClientListResponse]{ - More: func(page ActivityLogsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ActivityLogsClientListResponse) (ActivityLogsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ActivityLogsClient.NewListPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, filter, options) - }, nil) - if err != nil { - return ActivityLogsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *ActivityLogsClient) listCreateRequest(ctx context.Context, filter string, options *ActivityLogsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/eventtypes/management/values" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-04-01") - reqQP.Set("$filter", filter) - if options != nil && options.Select != nil { - reqQP.Set("$select", *options.Select) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *ActivityLogsClient) listHandleResponse(resp *http.Response) (ActivityLogsClientListResponse, error) { - result := ActivityLogsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.EventDataCollection); err != nil { - return ActivityLogsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/activitylogs_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/activitylogs_client_example_test.go deleted file mode 100644 index f77fa9b69702..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/activitylogs_client_example_test.go +++ /dev/null @@ -1,168 +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 armmonitor_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/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetActivityLogsFiltered.json -func ExampleActivityLogsClient_NewListPager_getActivityLogsWithFilter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewActivityLogsClient().NewListPager("eventTimestamp ge '2015-01-21T20:00:00Z' and eventTimestamp le '2015-01-23T20:00:00Z' and resourceGroupName eq 'MSSupportGroup'", &armmonitor.ActivityLogsClientListOptions{Select: 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.EventDataCollection = armmonitor.EventDataCollection{ - // Value: []*armmonitor.EventData{ - // { - // OperationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // Description: to.Ptr(""), - // Authorization: &armmonitor.SenderAuthorization{ - // Action: to.Ptr("microsoft.support/supporttickets/write"), - // Role: to.Ptr("Subscription Admin"), - // Scope: to.Ptr("/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841"), - // }, - // Caller: to.Ptr("admin@contoso.com"), - // Claims: map[string]*string{ - // "name": to.Ptr("John Smith"), - // "appid": to.Ptr("c44b4083-3bq0-49c1-b47d-974e53cbdf3c"), - // "appidacr": to.Ptr("2"), - // "aud": to.Ptr("https://management.core.windows.net/"), - // "exp": to.Ptr("1421880271"), - // "groups": to.Ptr("cacfe77c-e058-4712-83qw-f9b08849fd60,7f71d11d-4c41-4b23-99d2-d32ce7aa621c,31522864-0578-4ea0-9gdc-e66cc564d18c"), - // "http://schemas.microsoft.com/claims/authnclassreference": to.Ptr("1"), - // "http://schemas.microsoft.com/claims/authnmethodsreferences": to.Ptr("pwd"), - // "http://schemas.microsoft.com/identity/claims/objectidentifier": to.Ptr("2468adf0-8211-44e3-95xq-85137af64708"), - // "http://schemas.microsoft.com/identity/claims/scope": to.Ptr("user_impersonation"), - // "http://schemas.microsoft.com/identity/claims/tenantid": to.Ptr("1e8d8218-c5e7-4578-9acc-9abbd5d23315"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname": to.Ptr("John"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name": to.Ptr("admin@contoso.com"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier": to.Ptr("9vckmEGF7zDKk1YzIY8k0t1_EAPaXoeHyPRn6f413zM"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname": to.Ptr("Smith"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn": to.Ptr("admin@contoso.com"), - // "iat": to.Ptr("1421876371"), - // "iss": to.Ptr("https://sts.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/"), - // "nbf": to.Ptr("1421876371"), - // "puid": to.Ptr("20030000801A118C"), - // "ver": to.Ptr("1.0"), - // }, - // CorrelationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // EventDataID: to.Ptr("44ade6b4-3813-45e6-ae27-7420a95fa2f8"), - // EventName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("End request"), - // Value: to.Ptr("EndRequest"), - // }, - // EventTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:26.979Z"); return t}()), - // HTTPRequest: &armmonitor.HTTPRequestInfo{ - // Method: to.Ptr("PUT"), - // ClientIPAddress: to.Ptr("192.168.35.115"), - // ClientRequestID: to.Ptr("27003b25-91d3-418f-8eb1-29e537dcb249"), - // }, - // ID: to.Ptr("/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841/events/44ade6b4-3813-45e6-ae27-7420a95fa2f8/ticks/635574752669792776"), - // Level: to.Ptr(armmonitor.EventLevelInformational), - // OperationName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support/supporttickets/write"), - // Value: to.Ptr("microsoft.support/supporttickets/write"), - // }, - // Properties: map[string]*string{ - // "statusCode": to.Ptr("Created"), - // }, - // ResourceGroupName: to.Ptr("MSSupportGroup"), - // ResourceProviderName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support"), - // Value: to.Ptr("microsoft.support"), - // }, - // Status: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Succeeded"), - // Value: to.Ptr("Succeeded"), - // }, - // SubStatus: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Created (HTTP Status Code: 201)"), - // Value: to.Ptr("Created"), - // }, - // SubmissionTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:39.993Z"); return t}()), - // SubscriptionID: to.Ptr("089bd33f-d4ec-47fe-8ba5-0753aa5c5b33"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetActivityLogsFilteredAndSelected.json -func ExampleActivityLogsClient_NewListPager_getActivityLogsWithFilterAndSelect() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewActivityLogsClient().NewListPager("eventTimestamp ge '2015-01-21T20:00:00Z' and eventTimestamp le '2015-01-23T20:00:00Z' and resourceGroupName eq 'MSSupportGroup'", &armmonitor.ActivityLogsClientListOptions{Select: to.Ptr("eventName,id,resourceGroupName,resourceProviderName,operationName,status,eventTimestamp,correlationId,submissionTimestamp,level")}) - 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.EventDataCollection = armmonitor.EventDataCollection{ - // Value: []*armmonitor.EventData{ - // { - // CorrelationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // EventName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("End request"), - // Value: to.Ptr("EndRequest"), - // }, - // EventTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:26.979Z"); return t}()), - // ID: to.Ptr("/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841/events/44ade6b4-3813-45e6-ae27-7420a95fa2f8/ticks/635574752669792776"), - // Level: to.Ptr(armmonitor.EventLevelInformational), - // OperationName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support/supporttickets/write"), - // Value: to.Ptr("microsoft.support/supporttickets/write"), - // }, - // ResourceGroupName: to.Ptr("MSSupportGroup"), - // ResourceProviderName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support"), - // Value: to.Ptr("microsoft.support"), - // }, - // Status: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Succeeded"), - // Value: to.Ptr("Succeeded"), - // }, - // SubmissionTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:39.993Z"); return t}()), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client.go b/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client.go deleted file mode 100644 index caf0f7b0d2bb..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client.go +++ /dev/null @@ -1,179 +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 armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// AlertRuleIncidentsClient contains the methods for the AlertRuleIncidents group. -// Don't use this type directly, use NewAlertRuleIncidentsClient() instead. -type AlertRuleIncidentsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewAlertRuleIncidentsClient creates a new instance of AlertRuleIncidentsClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewAlertRuleIncidentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertRuleIncidentsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &AlertRuleIncidentsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Gets an incident associated to an alert rule -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2016-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - ruleName - The name of the rule. -// - incidentName - The name of the incident to retrieve. -// - options - AlertRuleIncidentsClientGetOptions contains the optional parameters for the AlertRuleIncidentsClient.Get method. -func (client *AlertRuleIncidentsClient) Get(ctx context.Context, resourceGroupName string, ruleName string, incidentName string, options *AlertRuleIncidentsClientGetOptions) (AlertRuleIncidentsClientGetResponse, error) { - var err error - const operationName = "AlertRuleIncidentsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, ruleName, incidentName, options) - if err != nil { - return AlertRuleIncidentsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AlertRuleIncidentsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AlertRuleIncidentsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *AlertRuleIncidentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, incidentName string, options *AlertRuleIncidentsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents/{incidentName}" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ruleName == "" { - return nil, errors.New("parameter ruleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) - if incidentName == "" { - return nil, errors.New("parameter incidentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{incidentName}", url.PathEscape(incidentName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2016-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *AlertRuleIncidentsClient) getHandleResponse(resp *http.Response) (AlertRuleIncidentsClientGetResponse, error) { - result := AlertRuleIncidentsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Incident); err != nil { - return AlertRuleIncidentsClientGetResponse{}, err - } - return result, nil -} - -// NewListByAlertRulePager - Gets a list of incidents associated to an alert rule -// -// Generated from API version 2016-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - ruleName - The name of the rule. -// - options - AlertRuleIncidentsClientListByAlertRuleOptions contains the optional parameters for the AlertRuleIncidentsClient.NewListByAlertRulePager -// method. -func (client *AlertRuleIncidentsClient) NewListByAlertRulePager(resourceGroupName string, ruleName string, options *AlertRuleIncidentsClientListByAlertRuleOptions) *runtime.Pager[AlertRuleIncidentsClientListByAlertRuleResponse] { - return runtime.NewPager(runtime.PagingHandler[AlertRuleIncidentsClientListByAlertRuleResponse]{ - More: func(page AlertRuleIncidentsClientListByAlertRuleResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *AlertRuleIncidentsClientListByAlertRuleResponse) (AlertRuleIncidentsClientListByAlertRuleResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AlertRuleIncidentsClient.NewListByAlertRulePager") - req, err := client.listByAlertRuleCreateRequest(ctx, resourceGroupName, ruleName, options) - if err != nil { - return AlertRuleIncidentsClientListByAlertRuleResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AlertRuleIncidentsClientListByAlertRuleResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AlertRuleIncidentsClientListByAlertRuleResponse{}, runtime.NewResponseError(resp) - } - return client.listByAlertRuleHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByAlertRuleCreateRequest creates the ListByAlertRule request. -func (client *AlertRuleIncidentsClient) listByAlertRuleCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, options *AlertRuleIncidentsClientListByAlertRuleOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules/{ruleName}/incidents" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ruleName == "" { - return nil, errors.New("parameter ruleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2016-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByAlertRuleHandleResponse handles the ListByAlertRule response. -func (client *AlertRuleIncidentsClient) listByAlertRuleHandleResponse(resp *http.Response) (AlertRuleIncidentsClientListByAlertRuleResponse, error) { - result := AlertRuleIncidentsClientListByAlertRuleResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.IncidentListResult); err != nil { - return AlertRuleIncidentsClientListByAlertRuleResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client_example_test.go deleted file mode 100644 index a7ea44b05299..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/alertruleincidents_client_example_test.go +++ /dev/null @@ -1,80 +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 armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/getAlertRuleIncident.json -func ExampleAlertRuleIncidentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertRuleIncidentsClient().Get(ctx, "Rac46PostSwapRG", "myRuleName", "Website_started", 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.Incident = armmonitor.Incident{ - // Name: to.Ptr("Website_started"), - // ActivatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-13T15:45:26.979Z"); return t}()), - // IsActive: to.Ptr(true), - // ResolvedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-13T22:14:28.979Z"); return t}()), - // RuleName: to.Ptr("myRuleName"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/listAlertRuleIncidents.json -func ExampleAlertRuleIncidentsClient_NewListByAlertRulePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAlertRuleIncidentsClient().NewListByAlertRulePager("Rac46PostSwapRG", "myRuleName", 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.IncidentListResult = armmonitor.IncidentListResult{ - // Value: []*armmonitor.Incident{ - // { - // Name: to.Ptr("Website_started"), - // ActivatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-13T15:45:26.979Z"); return t}()), - // IsActive: to.Ptr(true), - // ResolvedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-09-13T22:14:28.979Z"); return t}()), - // RuleName: to.Ptr("myRuleName"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/alertrules_client.go b/sdk/resourcemanager/monitor/armmonitor/alertrules_client.go deleted file mode 100644 index e22582113f98..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/alertrules_client.go +++ /dev/null @@ -1,416 +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 armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// AlertRulesClient contains the methods for the AlertRules group. -// Don't use this type directly, use NewAlertRulesClient() instead. -type AlertRulesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewAlertRulesClient creates a new instance of AlertRulesClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewAlertRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertRulesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &AlertRulesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Creates or updates a classic metric alert rule. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2016-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - ruleName - The name of the rule. -// - parameters - The parameters of the rule to create or update. -// - options - AlertRulesClientCreateOrUpdateOptions contains the optional parameters for the AlertRulesClient.CreateOrUpdate -// method. -func (client *AlertRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource, options *AlertRulesClientCreateOrUpdateOptions) (AlertRulesClientCreateOrUpdateResponse, error) { - var err error - const operationName = "AlertRulesClient.CreateOrUpdate" - 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, ruleName, parameters, options) - if err != nil { - return AlertRulesClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AlertRulesClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return AlertRulesClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *AlertRulesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, parameters AlertRuleResource, options *AlertRulesClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ruleName == "" { - return nil, errors.New("parameter ruleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2016-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *AlertRulesClient) createOrUpdateHandleResponse(resp *http.Response) (AlertRulesClientCreateOrUpdateResponse, error) { - result := AlertRulesClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AlertRuleResource); err != nil { - return AlertRulesClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Deletes a classic metric alert rule -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2016-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - ruleName - The name of the rule. -// - options - AlertRulesClientDeleteOptions contains the optional parameters for the AlertRulesClient.Delete method. -func (client *AlertRulesClient) Delete(ctx context.Context, resourceGroupName string, ruleName string, options *AlertRulesClientDeleteOptions) (AlertRulesClientDeleteResponse, error) { - var err error - const operationName = "AlertRulesClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, ruleName, options) - if err != nil { - return AlertRulesClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AlertRulesClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return AlertRulesClientDeleteResponse{}, err - } - return AlertRulesClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *AlertRulesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, options *AlertRulesClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ruleName == "" { - return nil, errors.New("parameter ruleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2016-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets a classic metric alert rule -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2016-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - ruleName - The name of the rule. -// - options - AlertRulesClientGetOptions contains the optional parameters for the AlertRulesClient.Get method. -func (client *AlertRulesClient) Get(ctx context.Context, resourceGroupName string, ruleName string, options *AlertRulesClientGetOptions) (AlertRulesClientGetResponse, error) { - var err error - const operationName = "AlertRulesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, ruleName, options) - if err != nil { - return AlertRulesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AlertRulesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AlertRulesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *AlertRulesClient) getCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, options *AlertRulesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ruleName == "" { - return nil, errors.New("parameter ruleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2016-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *AlertRulesClient) getHandleResponse(resp *http.Response) (AlertRulesClientGetResponse, error) { - result := AlertRulesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AlertRuleResource); err != nil { - return AlertRulesClientGetResponse{}, err - } - return result, nil -} - -// NewListByResourceGroupPager - List the classic metric alert rules within a resource group. -// -// Generated from API version 2016-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - options - AlertRulesClientListByResourceGroupOptions contains the optional parameters for the AlertRulesClient.NewListByResourceGroupPager -// method. -func (client *AlertRulesClient) NewListByResourceGroupPager(resourceGroupName string, options *AlertRulesClientListByResourceGroupOptions) *runtime.Pager[AlertRulesClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[AlertRulesClientListByResourceGroupResponse]{ - More: func(page AlertRulesClientListByResourceGroupResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *AlertRulesClientListByResourceGroupResponse) (AlertRulesClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AlertRulesClient.NewListByResourceGroupPager") - req, err := client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - if err != nil { - return AlertRulesClientListByResourceGroupResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AlertRulesClientListByResourceGroupResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AlertRulesClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) - } - return client.listByResourceGroupHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *AlertRulesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AlertRulesClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2016-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *AlertRulesClient) listByResourceGroupHandleResponse(resp *http.Response) (AlertRulesClientListByResourceGroupResponse, error) { - result := AlertRulesClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AlertRuleResourceCollection); err != nil { - return AlertRulesClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionPager - List the classic metric alert rules within a subscription. -// -// Generated from API version 2016-03-01 -// - options - AlertRulesClientListBySubscriptionOptions contains the optional parameters for the AlertRulesClient.NewListBySubscriptionPager -// method. -func (client *AlertRulesClient) NewListBySubscriptionPager(options *AlertRulesClientListBySubscriptionOptions) *runtime.Pager[AlertRulesClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[AlertRulesClientListBySubscriptionResponse]{ - More: func(page AlertRulesClientListBySubscriptionResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *AlertRulesClientListBySubscriptionResponse) (AlertRulesClientListBySubscriptionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AlertRulesClient.NewListBySubscriptionPager") - req, err := client.listBySubscriptionCreateRequest(ctx, options) - if err != nil { - return AlertRulesClientListBySubscriptionResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AlertRulesClientListBySubscriptionResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AlertRulesClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) - } - return client.listBySubscriptionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *AlertRulesClient) listBySubscriptionCreateRequest(ctx context.Context, options *AlertRulesClientListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2016-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *AlertRulesClient) listBySubscriptionHandleResponse(resp *http.Response) (AlertRulesClientListBySubscriptionResponse, error) { - result := AlertRulesClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AlertRuleResourceCollection); err != nil { - return AlertRulesClientListBySubscriptionResponse{}, err - } - return result, nil -} - -// Update - Updates an existing classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2016-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - ruleName - The name of the rule. -// - alertRulesResource - Parameters supplied to the operation. -// - options - AlertRulesClientUpdateOptions contains the optional parameters for the AlertRulesClient.Update method. -func (client *AlertRulesClient) Update(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch, options *AlertRulesClientUpdateOptions) (AlertRulesClientUpdateResponse, error) { - var err error - const operationName = "AlertRulesClient.Update" - 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, ruleName, alertRulesResource, options) - if err != nil { - return AlertRulesClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AlertRulesClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return AlertRulesClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *AlertRulesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource AlertRuleResourcePatch, options *AlertRulesClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules/{ruleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ruleName == "" { - return nil, errors.New("parameter ruleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2016-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, alertRulesResource); err != nil { - return nil, err - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *AlertRulesClient) updateHandleResponse(resp *http.Response) (AlertRulesClientUpdateResponse, error) { - result := AlertRulesClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AlertRuleResource); err != nil { - return AlertRulesClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/alertrules_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/alertrules_client_example_test.go deleted file mode 100644 index 653ea80a2dec..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/alertrules_client_example_test.go +++ /dev/null @@ -1,416 +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 armmonitor_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/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/createOrUpdateAlertRule.json -func ExampleAlertRulesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertRulesClient().CreateOrUpdate(ctx, "Rac46PostSwapRG", "chiricutin", armmonitor.AlertRuleResource{ - Location: to.Ptr("West US"), - Tags: map[string]*string{}, - Properties: &armmonitor.AlertRule{ - Name: to.Ptr("chiricutin"), - Description: to.Ptr("Pura Vida"), - Actions: []armmonitor.RuleActionClassification{}, - Condition: &armmonitor.ThresholdRuleCondition{ - DataSource: &armmonitor.RuleMetricDataSource{ - ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), - ResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest"), - MetricName: to.Ptr("Requests"), - }, - ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"), - Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - Threshold: to.Ptr[float64](3), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationOperatorTotal), - WindowSize: to.Ptr("PT5M"), - }, - IsEnabled: to.Ptr(true), - }, - }, 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.AlertRuleResource = armmonitor.AlertRuleResource{ - // Name: to.Ptr("chiricutin"), - // Type: to.Ptr("Microsoft.Insights/alertRules"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/chiricutin"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, Microsoft.WindowsAzure.Management.Common.Storage"), - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.AlertRule{ - // Name: to.Ptr("chiricutin"), - // Description: to.Ptr("Pura Vida"), - // Actions: []armmonitor.RuleActionClassification{ - // }, - // Condition: &armmonitor.ThresholdRuleCondition{ - // DataSource: &armmonitor.RuleMetricDataSource{ - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), - // ResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest"), - // MetricName: to.Ptr("Requests"), - // }, - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Threshold: to.Ptr[float64](3), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationOperatorTotal), - // WindowSize: to.Ptr("PT5M"), - // }, - // IsEnabled: to.Ptr(true), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-11-23T21:23:52.022Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/deleteAlertRule.json -func ExampleAlertRulesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAlertRulesClient().Delete(ctx, "Rac46PostSwapRG", "chiricutin", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/getAlertRule.json -func ExampleAlertRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertRulesClient().Get(ctx, "Rac46PostSwapRG", "chiricutin", 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.AlertRuleResource = armmonitor.AlertRuleResource{ - // Name: to.Ptr("chiricutin"), - // Type: to.Ptr("Microsoft.Insights/alertRules"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/chiricutin"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, Microsoft.WindowsAzure.Management.Common.Storage"), - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.AlertRule{ - // Name: to.Ptr("chiricutin"), - // Description: to.Ptr("Pura Vida"), - // Actions: []armmonitor.RuleActionClassification{ - // }, - // Condition: &armmonitor.ThresholdRuleCondition{ - // DataSource: &armmonitor.RuleMetricDataSource{ - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), - // ResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest"), - // MetricName: to.Ptr("Requests"), - // }, - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Threshold: to.Ptr[float64](3), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationOperatorTotal), - // WindowSize: to.Ptr("PT5M"), - // }, - // IsEnabled: to.Ptr(true), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-11-23T21:23:52.022Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/patchAlertRule.json -func ExampleAlertRulesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertRulesClient().Update(ctx, "Rac46PostSwapRG", "chiricutin", armmonitor.AlertRuleResourcePatch{ - Properties: &armmonitor.AlertRule{ - Name: to.Ptr("chiricutin"), - Description: to.Ptr("Pura Vida"), - Actions: []armmonitor.RuleActionClassification{}, - Condition: &armmonitor.ThresholdRuleCondition{ - DataSource: &armmonitor.RuleMetricDataSource{ - ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), - ResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest"), - MetricName: to.Ptr("Requests"), - }, - ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"), - Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - Threshold: to.Ptr[float64](3), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationOperatorTotal), - WindowSize: to.Ptr("PT5M"), - }, - IsEnabled: to.Ptr(true), - }, - Tags: map[string]*string{ - "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary"), - }, - }, 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.AlertRuleResource = armmonitor.AlertRuleResource{ - // Name: to.Ptr("chiricutin"), - // Type: to.Ptr("Microsoft.Insights/alertRules"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/chiricutin"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary"), - // }, - // Properties: &armmonitor.AlertRule{ - // Name: to.Ptr("chiricutin"), - // Description: to.Ptr("Pura Vida"), - // Actions: []armmonitor.RuleActionClassification{ - // }, - // Condition: &armmonitor.ThresholdRuleCondition{ - // DataSource: &armmonitor.RuleMetricDataSource{ - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), - // ResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest"), - // MetricName: to.Ptr("Requests"), - // }, - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Threshold: to.Ptr[float64](3), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationOperatorTotal), - // WindowSize: to.Ptr("PT5M"), - // }, - // IsEnabled: to.Ptr(true), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-11-23T21:23:52.022Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/listAlertRule.json -func ExampleAlertRulesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAlertRulesClient().NewListByResourceGroupPager("Rac46PostSwapRG", 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.AlertRuleResourceCollection = armmonitor.AlertRuleResourceCollection{ - // Value: []*armmonitor.AlertRuleResource{ - // { - // Name: to.Ptr("myRuleName"), - // Type: to.Ptr("Microsoft.Insights/alertRules"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/myRuleName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, Microsoft.WindowsAzure.Management.Common.Storage"), - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.AlertRule{ - // Name: to.Ptr("myRuleName"), - // Description: to.Ptr("Pura Vida"), - // Actions: []armmonitor.RuleActionClassification{ - // &armmonitor.RuleEmailAction{ - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleEmailAction"), - // CustomEmails: []*string{ - // to.Ptr("gu@ms.com"), - // to.Ptr("su@ms.net")}, - // SendToServiceOwners: to.Ptr(true), - // }}, - // Condition: &armmonitor.ThresholdRuleCondition{ - // DataSource: &armmonitor.RuleMetricDataSource{ - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), - // ResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest"), - // MetricName: to.Ptr("Requests"), - // }, - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Threshold: to.Ptr[float64](2), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationOperatorTotal), - // WindowSize: to.Ptr("PT5M"), - // }, - // IsEnabled: to.Ptr(true), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-11-10T21:04:39.000Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("chiricutin0"), - // Type: to.Ptr("Microsoft.Insights/alertRules"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/chiricutin0"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, Microsoft.WindowsAzure.Management.Common.Storage"), - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.AlertRule{ - // Name: to.Ptr("chiricutin0"), - // Description: to.Ptr("Pura Vida 0"), - // Actions: []armmonitor.RuleActionClassification{ - // }, - // Condition: &armmonitor.ThresholdRuleCondition{ - // DataSource: &armmonitor.RuleMetricDataSource{ - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), - // ResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest"), - // MetricName: to.Ptr("Requests"), - // }, - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Threshold: to.Ptr[float64](2), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationOperatorTotal), - // WindowSize: to.Ptr("PT5M"), - // }, - // IsEnabled: to.Ptr(true), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-11-10T21:04:39.108Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/listAlertRuleBySubscription.json -func ExampleAlertRulesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAlertRulesClient().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.AlertRuleResourceCollection = armmonitor.AlertRuleResourceCollection{ - // Value: []*armmonitor.AlertRuleResource{ - // { - // Name: to.Ptr("myRuleName"), - // Type: to.Ptr("Microsoft.Insights/alertRules"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/myRuleName"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, Microsoft.WindowsAzure.Management.Common.Storage"), - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.AlertRule{ - // Name: to.Ptr("myRuleName"), - // Description: to.Ptr("Pura Vida"), - // Actions: []armmonitor.RuleActionClassification{ - // &armmonitor.RuleEmailAction{ - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleEmailAction"), - // CustomEmails: []*string{ - // to.Ptr("gu@ms.com"), - // to.Ptr("su@ms.net")}, - // SendToServiceOwners: to.Ptr(true), - // }}, - // Condition: &armmonitor.ThresholdRuleCondition{ - // DataSource: &armmonitor.RuleMetricDataSource{ - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), - // ResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest"), - // MetricName: to.Ptr("Requests"), - // }, - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Threshold: to.Ptr[float64](2), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationOperatorTotal), - // WindowSize: to.Ptr("PT5M"), - // }, - // IsEnabled: to.Ptr(true), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-11-10T21:04:39.000Z"); return t}()), - // }, - // }, - // { - // Name: to.Ptr("chiricutin0"), - // Type: to.Ptr("Microsoft.Insights/alertRules"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/alertrules/chiricutin0"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary, Microsoft.WindowsAzure.Management.Common.Storage"), - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.AlertRule{ - // Name: to.Ptr("chiricutin0"), - // Description: to.Ptr("Pura Vida 0"), - // Actions: []armmonitor.RuleActionClassification{ - // }, - // Condition: &armmonitor.ThresholdRuleCondition{ - // DataSource: &armmonitor.RuleMetricDataSource{ - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource"), - // ResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest"), - // MetricName: to.Ptr("Requests"), - // }, - // ODataType: to.Ptr("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Threshold: to.Ptr[float64](2), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationOperatorTotal), - // WindowSize: to.Ptr("PT5M"), - // }, - // IsEnabled: to.Ptr(true), - // LastUpdatedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2016-11-10T21:04:39.108Z"); return t}()), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/autorest.md b/sdk/resourcemanager/monitor/armmonitor/autorest.md index 1a2805b6b7e6..f2ac75dbce9a 100644 --- a/sdk/resourcemanager/monitor/armmonitor/autorest.md +++ b/sdk/resourcemanager/monitor/armmonitor/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/monitor/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/monitor/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.11.0 +module-version: 0.12.0 ``` diff --git a/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client.go b/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client.go deleted file mode 100644 index 771527125f21..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client.go +++ /dev/null @@ -1,416 +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 armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// AutoscaleSettingsClient contains the methods for the AutoscaleSettings group. -// Don't use this type directly, use NewAutoscaleSettingsClient() instead. -type AutoscaleSettingsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewAutoscaleSettingsClient creates a new instance of AutoscaleSettingsClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewAutoscaleSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AutoscaleSettingsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &AutoscaleSettingsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Creates or updates an autoscale setting. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-10-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - autoscaleSettingName - The autoscale setting name. -// - parameters - Parameters supplied to the operation. -// - options - AutoscaleSettingsClientCreateOrUpdateOptions contains the optional parameters for the AutoscaleSettingsClient.CreateOrUpdate -// method. -func (client *AutoscaleSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource, options *AutoscaleSettingsClientCreateOrUpdateOptions) (AutoscaleSettingsClientCreateOrUpdateResponse, error) { - var err error - const operationName = "AutoscaleSettingsClient.CreateOrUpdate" - 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, autoscaleSettingName, parameters, options) - if err != nil { - return AutoscaleSettingsClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AutoscaleSettingsClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return AutoscaleSettingsClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *AutoscaleSettingsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters AutoscaleSettingResource, options *AutoscaleSettingsClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if autoscaleSettingName == "" { - return nil, errors.New("parameter autoscaleSettingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{autoscaleSettingName}", url.PathEscape(autoscaleSettingName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *AutoscaleSettingsClient) createOrUpdateHandleResponse(resp *http.Response) (AutoscaleSettingsClientCreateOrUpdateResponse, error) { - result := AutoscaleSettingsClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AutoscaleSettingResource); err != nil { - return AutoscaleSettingsClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Deletes and autoscale setting -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-10-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - autoscaleSettingName - The autoscale setting name. -// - options - AutoscaleSettingsClientDeleteOptions contains the optional parameters for the AutoscaleSettingsClient.Delete -// method. -func (client *AutoscaleSettingsClient) Delete(ctx context.Context, resourceGroupName string, autoscaleSettingName string, options *AutoscaleSettingsClientDeleteOptions) (AutoscaleSettingsClientDeleteResponse, error) { - var err error - const operationName = "AutoscaleSettingsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, autoscaleSettingName, options) - if err != nil { - return AutoscaleSettingsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AutoscaleSettingsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return AutoscaleSettingsClientDeleteResponse{}, err - } - return AutoscaleSettingsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *AutoscaleSettingsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, autoscaleSettingName string, options *AutoscaleSettingsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if autoscaleSettingName == "" { - return nil, errors.New("parameter autoscaleSettingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{autoscaleSettingName}", url.PathEscape(autoscaleSettingName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets an autoscale setting -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-10-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - autoscaleSettingName - The autoscale setting name. -// - options - AutoscaleSettingsClientGetOptions contains the optional parameters for the AutoscaleSettingsClient.Get method. -func (client *AutoscaleSettingsClient) Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string, options *AutoscaleSettingsClientGetOptions) (AutoscaleSettingsClientGetResponse, error) { - var err error - const operationName = "AutoscaleSettingsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, autoscaleSettingName, options) - if err != nil { - return AutoscaleSettingsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AutoscaleSettingsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AutoscaleSettingsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *AutoscaleSettingsClient) getCreateRequest(ctx context.Context, resourceGroupName string, autoscaleSettingName string, options *AutoscaleSettingsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if autoscaleSettingName == "" { - return nil, errors.New("parameter autoscaleSettingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{autoscaleSettingName}", url.PathEscape(autoscaleSettingName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *AutoscaleSettingsClient) getHandleResponse(resp *http.Response) (AutoscaleSettingsClientGetResponse, error) { - result := AutoscaleSettingsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AutoscaleSettingResource); err != nil { - return AutoscaleSettingsClientGetResponse{}, err - } - return result, nil -} - -// NewListByResourceGroupPager - Lists the autoscale settings for a resource group -// -// Generated from API version 2022-10-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - options - AutoscaleSettingsClientListByResourceGroupOptions contains the optional parameters for the AutoscaleSettingsClient.NewListByResourceGroupPager -// method. -func (client *AutoscaleSettingsClient) NewListByResourceGroupPager(resourceGroupName string, options *AutoscaleSettingsClientListByResourceGroupOptions) *runtime.Pager[AutoscaleSettingsClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[AutoscaleSettingsClientListByResourceGroupResponse]{ - More: func(page AutoscaleSettingsClientListByResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *AutoscaleSettingsClientListByResourceGroupResponse) (AutoscaleSettingsClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AutoscaleSettingsClient.NewListByResourceGroupPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - }, nil) - if err != nil { - return AutoscaleSettingsClientListByResourceGroupResponse{}, err - } - return client.listByResourceGroupHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *AutoscaleSettingsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AutoscaleSettingsClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *AutoscaleSettingsClient) listByResourceGroupHandleResponse(resp *http.Response) (AutoscaleSettingsClientListByResourceGroupResponse, error) { - result := AutoscaleSettingsClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AutoscaleSettingResourceCollection); err != nil { - return AutoscaleSettingsClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionPager - Lists the autoscale settings for a subscription -// -// Generated from API version 2022-10-01 -// - options - AutoscaleSettingsClientListBySubscriptionOptions contains the optional parameters for the AutoscaleSettingsClient.NewListBySubscriptionPager -// method. -func (client *AutoscaleSettingsClient) NewListBySubscriptionPager(options *AutoscaleSettingsClientListBySubscriptionOptions) *runtime.Pager[AutoscaleSettingsClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[AutoscaleSettingsClientListBySubscriptionResponse]{ - More: func(page AutoscaleSettingsClientListBySubscriptionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *AutoscaleSettingsClientListBySubscriptionResponse) (AutoscaleSettingsClientListBySubscriptionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AutoscaleSettingsClient.NewListBySubscriptionPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listBySubscriptionCreateRequest(ctx, options) - }, nil) - if err != nil { - return AutoscaleSettingsClientListBySubscriptionResponse{}, err - } - return client.listBySubscriptionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *AutoscaleSettingsClient) listBySubscriptionCreateRequest(ctx context.Context, options *AutoscaleSettingsClientListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *AutoscaleSettingsClient) listBySubscriptionHandleResponse(resp *http.Response) (AutoscaleSettingsClientListBySubscriptionResponse, error) { - result := AutoscaleSettingsClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AutoscaleSettingResourceCollection); err != nil { - return AutoscaleSettingsClientListBySubscriptionResponse{}, err - } - return result, nil -} - -// Update - Updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-10-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - autoscaleSettingName - The autoscale setting name. -// - autoscaleSettingResource - Parameters supplied to the operation. -// - options - AutoscaleSettingsClientUpdateOptions contains the optional parameters for the AutoscaleSettingsClient.Update -// method. -func (client *AutoscaleSettingsClient) Update(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch, options *AutoscaleSettingsClientUpdateOptions) (AutoscaleSettingsClientUpdateResponse, error) { - var err error - const operationName = "AutoscaleSettingsClient.Update" - 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, autoscaleSettingName, autoscaleSettingResource, options) - if err != nil { - return AutoscaleSettingsClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AutoscaleSettingsClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AutoscaleSettingsClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *AutoscaleSettingsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource AutoscaleSettingResourcePatch, options *AutoscaleSettingsClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if autoscaleSettingName == "" { - return nil, errors.New("parameter autoscaleSettingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{autoscaleSettingName}", url.PathEscape(autoscaleSettingName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, autoscaleSettingResource); err != nil { - return nil, err - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *AutoscaleSettingsClient) updateHandleResponse(resp *http.Response) (AutoscaleSettingsClientUpdateResponse, error) { - result := AutoscaleSettingsClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AutoscaleSettingResource); err != nil { - return AutoscaleSettingsClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client_example_test.go deleted file mode 100644 index af47a871e44d..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/autoscalesettings_client_example_test.go +++ /dev/null @@ -1,1166 +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 armmonitor_test - -import ( - "context" - "log" - - "time" - - "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/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/listAutoscaleSetting.json -func ExampleAutoscaleSettingsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAutoscaleSettingsClient().NewListByResourceGroupPager("TestingMetricsScaleSet", 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.AutoscaleSettingResourceCollection = armmonitor.AutoscaleSettingResourceCollection{ - // Value: []*armmonitor.AutoscaleSettingResource{ - // { - // Name: to.Ptr("MySetting"), - // Type: to.Ptr("Microsoft.Insights/autoscaleSettings"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/microsoft.insights/autoscalesettings/MySetting"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armmonitor.AutoscaleSetting{ - // Name: to.Ptr("MySetting"), - // Enabled: to.Ptr(true), - // Notifications: []*armmonitor.AutoscaleNotification{ - // { - // Email: &armmonitor.EmailNotification{ - // CustomEmails: []*string{ - // to.Ptr("gu@ms.com"), - // to.Ptr("ge@ns.net")}, - // SendToSubscriptionAdministrator: to.Ptr(true), - // SendToSubscriptionCoAdministrators: to.Ptr(true), - // }, - // Operation: to.Ptr("Scale"), - // Webhooks: []*armmonitor.WebhookNotification{ - // { - // Properties: map[string]*string{ - // }, - // ServiceURI: to.Ptr("http://myservice.com"), - // }}, - // }}, - // PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ - // ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), - // }, - // Profiles: []*armmonitor.AutoscaleProfile{ - // { - // Name: to.Ptr("adios"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // FixedDate: &armmonitor.TimeWindow{ - // End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30:00.000Z"); return t}()), - // Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:00:00.000Z"); return t}()), - // TimeZone: to.Ptr("UTC"), - // }, - // Rules: []*armmonitor.ScaleRule{ - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](10), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT1M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT5M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - // Value: to.Ptr("1"), - // }, - // }, - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](15), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT2M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT6M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - // Value: to.Ptr("2"), - // }, - // }}, - // }, - // { - // Name: to.Ptr("saludos"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // Recurrence: &armmonitor.Recurrence{ - // Frequency: to.Ptr(armmonitor.RecurrenceFrequencyWeek), - // Schedule: &armmonitor.RecurrentSchedule{ - // Days: []*string{ - // to.Ptr("1")}, - // Hours: []*int32{ - // to.Ptr[int32](5)}, - // Minutes: []*int32{ - // to.Ptr[int32](15)}, - // TimeZone: to.Ptr("UTC"), - // }, - // }, - // Rules: []*armmonitor.ScaleRule{ - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](10), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT1M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT5M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - // Value: to.Ptr("1"), - // }, - // }, - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](15), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT2M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT6M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - // Value: to.Ptr("2"), - // }, - // }}, - // }}, - // TargetResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/createOrUpdateAutoscaleSetting.json -func ExampleAutoscaleSettingsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAutoscaleSettingsClient().CreateOrUpdate(ctx, "TestingMetricsScaleSet", "MySetting", armmonitor.AutoscaleSettingResource{ - Location: to.Ptr("West US"), - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - Properties: &armmonitor.AutoscaleSetting{ - Enabled: to.Ptr(true), - Notifications: []*armmonitor.AutoscaleNotification{ - { - Email: &armmonitor.EmailNotification{ - CustomEmails: []*string{ - to.Ptr("gu@ms.com"), - to.Ptr("ge@ns.net")}, - SendToSubscriptionAdministrator: to.Ptr(true), - SendToSubscriptionCoAdministrators: to.Ptr(true), - }, - Operation: to.Ptr("Scale"), - Webhooks: []*armmonitor.WebhookNotification{ - { - Properties: map[string]*string{}, - ServiceURI: to.Ptr("http://myservice.com"), - }}, - }}, - PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ - ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), - }, - Profiles: []*armmonitor.AutoscaleProfile{ - { - Name: to.Ptr("adios"), - Capacity: &armmonitor.ScaleCapacity{ - Default: to.Ptr("1"), - Maximum: to.Ptr("10"), - Minimum: to.Ptr("1"), - }, - FixedDate: &armmonitor.TimeWindow{ - End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30:00.000Z"); return t }()), - Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:00:00.000Z"); return t }()), - TimeZone: to.Ptr("UTC"), - }, - Rules: []*armmonitor.ScaleRule{ - { - MetricTrigger: &armmonitor.MetricTrigger{ - DividePerInstance: to.Ptr(false), - MetricName: to.Ptr("Percentage CPU"), - MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - Threshold: to.Ptr[float64](10), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - TimeGrain: to.Ptr("PT1M"), - TimeWindow: to.Ptr("PT5M"), - }, - ScaleAction: &armmonitor.ScaleAction{ - Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - Cooldown: to.Ptr("PT5M"), - Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - Value: to.Ptr("1"), - }, - }, - { - MetricTrigger: &armmonitor.MetricTrigger{ - DividePerInstance: to.Ptr(false), - MetricName: to.Ptr("Percentage CPU"), - MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - Threshold: to.Ptr[float64](15), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - TimeGrain: to.Ptr("PT2M"), - TimeWindow: to.Ptr("PT5M"), - }, - ScaleAction: &armmonitor.ScaleAction{ - Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - Cooldown: to.Ptr("PT6M"), - Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - Value: to.Ptr("2"), - }, - }}, - }, - { - Name: to.Ptr("saludos"), - Capacity: &armmonitor.ScaleCapacity{ - Default: to.Ptr("1"), - Maximum: to.Ptr("10"), - Minimum: to.Ptr("1"), - }, - Recurrence: &armmonitor.Recurrence{ - Frequency: to.Ptr(armmonitor.RecurrenceFrequencyWeek), - Schedule: &armmonitor.RecurrentSchedule{ - Days: []*string{ - to.Ptr("1")}, - Hours: []*int32{ - to.Ptr[int32](5)}, - Minutes: []*int32{ - to.Ptr[int32](15)}, - TimeZone: to.Ptr("UTC"), - }, - }, - Rules: []*armmonitor.ScaleRule{ - { - MetricTrigger: &armmonitor.MetricTrigger{ - DividePerInstance: to.Ptr(false), - MetricName: to.Ptr("Percentage CPU"), - MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - Threshold: to.Ptr[float64](10), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - TimeGrain: to.Ptr("PT1M"), - TimeWindow: to.Ptr("PT5M"), - }, - ScaleAction: &armmonitor.ScaleAction{ - Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - Cooldown: to.Ptr("PT5M"), - Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - Value: to.Ptr("1"), - }, - }, - { - MetricTrigger: &armmonitor.MetricTrigger{ - DividePerInstance: to.Ptr(false), - MetricName: to.Ptr("Percentage CPU"), - MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - Threshold: to.Ptr[float64](15), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - TimeGrain: to.Ptr("PT2M"), - TimeWindow: to.Ptr("PT5M"), - }, - ScaleAction: &armmonitor.ScaleAction{ - Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - Cooldown: to.Ptr("PT6M"), - Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - Value: to.Ptr("2"), - }, - }}, - }}, - TargetResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - }, - }, 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.AutoscaleSettingResource = armmonitor.AutoscaleSettingResource{ - // Name: to.Ptr("MySetting"), - // Type: to.Ptr("Microsoft.Insights/autoscaleSettings"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/microsoft.insights/autoscalesettings/MySetting"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armmonitor.AutoscaleSetting{ - // Name: to.Ptr("MySetting"), - // Enabled: to.Ptr(true), - // Notifications: []*armmonitor.AutoscaleNotification{ - // { - // Email: &armmonitor.EmailNotification{ - // CustomEmails: []*string{ - // to.Ptr("gu@ms.com"), - // to.Ptr("ge@ns.net")}, - // SendToSubscriptionAdministrator: to.Ptr(true), - // SendToSubscriptionCoAdministrators: to.Ptr(true), - // }, - // Operation: to.Ptr("Scale"), - // Webhooks: []*armmonitor.WebhookNotification{ - // { - // Properties: map[string]*string{ - // }, - // ServiceURI: to.Ptr("http://myservice.com"), - // }}, - // }}, - // PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ - // ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), - // }, - // Profiles: []*armmonitor.AutoscaleProfile{ - // { - // Name: to.Ptr("adios"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // FixedDate: &armmonitor.TimeWindow{ - // End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30:00.000Z"); return t}()), - // Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:00:00.000Z"); return t}()), - // TimeZone: to.Ptr("UTC"), - // }, - // Rules: []*armmonitor.ScaleRule{ - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](10), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT1M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT5M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - // Value: to.Ptr("1"), - // }, - // }, - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](15), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT2M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT6M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - // Value: to.Ptr("2"), - // }, - // }}, - // }, - // { - // Name: to.Ptr("saludos"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // Recurrence: &armmonitor.Recurrence{ - // Frequency: to.Ptr(armmonitor.RecurrenceFrequencyWeek), - // Schedule: &armmonitor.RecurrentSchedule{ - // Days: []*string{ - // to.Ptr("1")}, - // Hours: []*int32{ - // to.Ptr[int32](5)}, - // Minutes: []*int32{ - // to.Ptr[int32](15)}, - // TimeZone: to.Ptr("UTC"), - // }, - // }, - // Rules: []*armmonitor.ScaleRule{ - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](10), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT1M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT5M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - // Value: to.Ptr("1"), - // }, - // }, - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](15), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT2M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT6M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - // Value: to.Ptr("2"), - // }, - // }}, - // }}, - // TargetResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/deleteAutoscaleSetting.json -func ExampleAutoscaleSettingsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAutoscaleSettingsClient().Delete(ctx, "TestingMetricsScaleSet", "MySetting", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/getAutoscaleSetting.json -func ExampleAutoscaleSettingsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAutoscaleSettingsClient().Get(ctx, "TestingMetricsScaleSet", "MySetting", 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.AutoscaleSettingResource = armmonitor.AutoscaleSettingResource{ - // Name: to.Ptr("MySetting"), - // Type: to.Ptr("Microsoft.Insights/autoscaleSettings"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/microsoft.insights/autoscalesettings/MySetting"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armmonitor.AutoscaleSetting{ - // Name: to.Ptr("MySetting"), - // Enabled: to.Ptr(true), - // Notifications: []*armmonitor.AutoscaleNotification{ - // { - // Email: &armmonitor.EmailNotification{ - // CustomEmails: []*string{ - // to.Ptr("gu@ms.com"), - // to.Ptr("ge@ns.net")}, - // SendToSubscriptionAdministrator: to.Ptr(true), - // SendToSubscriptionCoAdministrators: to.Ptr(true), - // }, - // Operation: to.Ptr("Scale"), - // Webhooks: []*armmonitor.WebhookNotification{ - // { - // Properties: map[string]*string{ - // }, - // ServiceURI: to.Ptr("http://myservice.com"), - // }}, - // }}, - // PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ - // ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), - // }, - // Profiles: []*armmonitor.AutoscaleProfile{ - // { - // Name: to.Ptr("adios"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // FixedDate: &armmonitor.TimeWindow{ - // End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30:00.000Z"); return t}()), - // Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:00:00.000Z"); return t}()), - // TimeZone: to.Ptr("UTC"), - // }, - // Rules: []*armmonitor.ScaleRule{ - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](10), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT1M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT5M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - // Value: to.Ptr("1"), - // }, - // }, - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](15), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT2M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT6M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - // Value: to.Ptr("2"), - // }, - // }}, - // }, - // { - // Name: to.Ptr("saludos"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // Recurrence: &armmonitor.Recurrence{ - // Frequency: to.Ptr(armmonitor.RecurrenceFrequencyWeek), - // Schedule: &armmonitor.RecurrentSchedule{ - // Days: []*string{ - // to.Ptr("1")}, - // Hours: []*int32{ - // to.Ptr[int32](5)}, - // Minutes: []*int32{ - // to.Ptr[int32](15)}, - // TimeZone: to.Ptr("UTC"), - // }, - // }, - // Rules: []*armmonitor.ScaleRule{ - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](10), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT1M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT5M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - // Value: to.Ptr("1"), - // }, - // }, - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](15), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT2M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT6M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - // Value: to.Ptr("2"), - // }, - // }}, - // }}, - // TargetResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/patchAutoscaleSetting.json -func ExampleAutoscaleSettingsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAutoscaleSettingsClient().Update(ctx, "TestingMetricsScaleSet", "MySetting", armmonitor.AutoscaleSettingResourcePatch{ - Properties: &armmonitor.AutoscaleSetting{ - Enabled: to.Ptr(true), - Notifications: []*armmonitor.AutoscaleNotification{ - { - Email: &armmonitor.EmailNotification{ - CustomEmails: []*string{ - to.Ptr("gu@ms.com"), - to.Ptr("ge@ns.net")}, - SendToSubscriptionAdministrator: to.Ptr(true), - SendToSubscriptionCoAdministrators: to.Ptr(true), - }, - Operation: to.Ptr("Scale"), - Webhooks: []*armmonitor.WebhookNotification{ - { - Properties: map[string]*string{}, - ServiceURI: to.Ptr("http://myservice.com"), - }}, - }}, - PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ - ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), - }, - Profiles: []*armmonitor.AutoscaleProfile{ - { - Name: to.Ptr("adios"), - Capacity: &armmonitor.ScaleCapacity{ - Default: to.Ptr("1"), - Maximum: to.Ptr("10"), - Minimum: to.Ptr("1"), - }, - FixedDate: &armmonitor.TimeWindow{ - End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30:00.000Z"); return t }()), - Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:00:00.000Z"); return t }()), - TimeZone: to.Ptr("UTC"), - }, - Rules: []*armmonitor.ScaleRule{ - { - MetricTrigger: &armmonitor.MetricTrigger{ - DividePerInstance: to.Ptr(false), - MetricName: to.Ptr("Percentage CPU"), - MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - Threshold: to.Ptr[float64](10), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - TimeGrain: to.Ptr("PT1M"), - TimeWindow: to.Ptr("PT5M"), - }, - ScaleAction: &armmonitor.ScaleAction{ - Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - Cooldown: to.Ptr("PT5M"), - Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - Value: to.Ptr("1"), - }, - }, - { - MetricTrigger: &armmonitor.MetricTrigger{ - DividePerInstance: to.Ptr(false), - MetricName: to.Ptr("Percentage CPU"), - MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - Threshold: to.Ptr[float64](15), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - TimeGrain: to.Ptr("PT2M"), - TimeWindow: to.Ptr("PT5M"), - }, - ScaleAction: &armmonitor.ScaleAction{ - Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - Cooldown: to.Ptr("PT6M"), - Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - Value: to.Ptr("2"), - }, - }}, - }, - { - Name: to.Ptr("saludos"), - Capacity: &armmonitor.ScaleCapacity{ - Default: to.Ptr("1"), - Maximum: to.Ptr("10"), - Minimum: to.Ptr("1"), - }, - Recurrence: &armmonitor.Recurrence{ - Frequency: to.Ptr(armmonitor.RecurrenceFrequencyWeek), - Schedule: &armmonitor.RecurrentSchedule{ - Days: []*string{ - to.Ptr("1")}, - Hours: []*int32{ - to.Ptr[int32](5)}, - Minutes: []*int32{ - to.Ptr[int32](15)}, - TimeZone: to.Ptr("UTC"), - }, - }, - Rules: []*armmonitor.ScaleRule{ - { - MetricTrigger: &armmonitor.MetricTrigger{ - DividePerInstance: to.Ptr(false), - MetricName: to.Ptr("Percentage CPU"), - MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - Threshold: to.Ptr[float64](10), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - TimeGrain: to.Ptr("PT1M"), - TimeWindow: to.Ptr("PT5M"), - }, - ScaleAction: &armmonitor.ScaleAction{ - Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - Cooldown: to.Ptr("PT5M"), - Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - Value: to.Ptr("1"), - }, - }, - { - MetricTrigger: &armmonitor.MetricTrigger{ - DividePerInstance: to.Ptr(false), - MetricName: to.Ptr("Percentage CPU"), - MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - Threshold: to.Ptr[float64](15), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - TimeGrain: to.Ptr("PT2M"), - TimeWindow: to.Ptr("PT5M"), - }, - ScaleAction: &armmonitor.ScaleAction{ - Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - Cooldown: to.Ptr("PT6M"), - Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - Value: to.Ptr("2"), - }, - }}, - }}, - TargetResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - }, 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.AutoscaleSettingResource = armmonitor.AutoscaleSettingResource{ - // Name: to.Ptr("MySetting"), - // Type: to.Ptr("Microsoft.Insights/autoscaleSettings"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/microsoft.insights/autoscalesettings/MySetting"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "$type": to.Ptr("Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary"), - // }, - // Properties: &armmonitor.AutoscaleSetting{ - // Name: to.Ptr("MySetting"), - // Enabled: to.Ptr(true), - // Notifications: []*armmonitor.AutoscaleNotification{ - // { - // Email: &armmonitor.EmailNotification{ - // CustomEmails: []*string{ - // to.Ptr("gu@ms.com"), - // to.Ptr("ge@ns.net")}, - // SendToSubscriptionAdministrator: to.Ptr(true), - // SendToSubscriptionCoAdministrators: to.Ptr(true), - // }, - // Operation: to.Ptr("Scale"), - // Webhooks: []*armmonitor.WebhookNotification{ - // { - // Properties: map[string]*string{ - // }, - // ServiceURI: to.Ptr("http://myservice.com"), - // }}, - // }}, - // PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ - // ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), - // }, - // Profiles: []*armmonitor.AutoscaleProfile{ - // { - // Name: to.Ptr("adios"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // FixedDate: &armmonitor.TimeWindow{ - // End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30:00.000Z"); return t}()), - // Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:00:00.000Z"); return t}()), - // TimeZone: to.Ptr("UTC"), - // }, - // Rules: []*armmonitor.ScaleRule{ - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](10), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT1M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT5M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - // Value: to.Ptr("1"), - // }, - // }, - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](15), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT2M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT6M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - // Value: to.Ptr("2"), - // }, - // }}, - // }, - // { - // Name: to.Ptr("saludos"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // Recurrence: &armmonitor.Recurrence{ - // Frequency: to.Ptr(armmonitor.RecurrenceFrequencyWeek), - // Schedule: &armmonitor.RecurrentSchedule{ - // Days: []*string{ - // to.Ptr("1")}, - // Hours: []*int32{ - // to.Ptr[int32](5)}, - // Minutes: []*int32{ - // to.Ptr[int32](15)}, - // TimeZone: to.Ptr("UTC"), - // }, - // }, - // Rules: []*armmonitor.ScaleRule{ - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](10), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT1M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT5M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - // Value: to.Ptr("1"), - // }, - // }, - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](15), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT2M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT6M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - // Value: to.Ptr("2"), - // }, - // }}, - // }}, - // TargetResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/listAutoscaleSettingBySubscription.json -func ExampleAutoscaleSettingsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAutoscaleSettingsClient().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.AutoscaleSettingResourceCollection = armmonitor.AutoscaleSettingResourceCollection{ - // Value: []*armmonitor.AutoscaleSettingResource{ - // { - // Name: to.Ptr("MySetting"), - // Type: to.Ptr("Microsoft.Insights/autoscaleSettings"), - // ID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/microsoft.insights/autoscalesettings/MySetting"), - // Location: to.Ptr("West US"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armmonitor.AutoscaleSetting{ - // Name: to.Ptr("MySetting"), - // Enabled: to.Ptr(true), - // Notifications: []*armmonitor.AutoscaleNotification{ - // { - // Email: &armmonitor.EmailNotification{ - // CustomEmails: []*string{ - // to.Ptr("gu@ms.com"), - // to.Ptr("ge@ns.net")}, - // SendToSubscriptionAdministrator: to.Ptr(true), - // SendToSubscriptionCoAdministrators: to.Ptr(true), - // }, - // Operation: to.Ptr("Scale"), - // Webhooks: []*armmonitor.WebhookNotification{ - // { - // Properties: map[string]*string{ - // }, - // ServiceURI: to.Ptr("http://myservice.com"), - // }}, - // }}, - // PredictiveAutoscalePolicy: &armmonitor.PredictiveAutoscalePolicy{ - // ScaleMode: to.Ptr(armmonitor.PredictiveAutoscalePolicyScaleModeEnabled), - // }, - // Profiles: []*armmonitor.AutoscaleProfile{ - // { - // Name: to.Ptr("adios"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // FixedDate: &armmonitor.TimeWindow{ - // End: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:30:00.000Z"); return t}()), - // Start: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-03-05T14:00:00.000Z"); return t}()), - // TimeZone: to.Ptr("UTC"), - // }, - // Rules: []*armmonitor.ScaleRule{ - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](10), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT1M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT5M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - // Value: to.Ptr("1"), - // }, - // }, - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](15), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT2M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT6M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - // Value: to.Ptr("2"), - // }, - // }}, - // }, - // { - // Name: to.Ptr("saludos"), - // Capacity: &armmonitor.ScaleCapacity{ - // Default: to.Ptr("1"), - // Maximum: to.Ptr("10"), - // Minimum: to.Ptr("1"), - // }, - // Recurrence: &armmonitor.Recurrence{ - // Frequency: to.Ptr(armmonitor.RecurrenceFrequencyWeek), - // Schedule: &armmonitor.RecurrentSchedule{ - // Days: []*string{ - // to.Ptr("1")}, - // Hours: []*int32{ - // to.Ptr[int32](5)}, - // Minutes: []*int32{ - // to.Ptr[int32](15)}, - // TimeZone: to.Ptr("UTC"), - // }, - // }, - // Rules: []*armmonitor.ScaleRule{ - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](10), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT1M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT5M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionIncrease), - // Value: to.Ptr("1"), - // }, - // }, - // { - // MetricTrigger: &armmonitor.MetricTrigger{ - // DividePerInstance: to.Ptr(false), - // MetricName: to.Ptr("Percentage CPU"), - // MetricResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // Operator: to.Ptr(armmonitor.ComparisonOperationTypeGreaterThan), - // Statistic: to.Ptr(armmonitor.MetricStatisticTypeAverage), - // Threshold: to.Ptr[float64](15), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationTypeAverage), - // TimeGrain: to.Ptr("PT2M"), - // TimeWindow: to.Ptr("PT5M"), - // }, - // ScaleAction: &armmonitor.ScaleAction{ - // Type: to.Ptr(armmonitor.ScaleTypeChangeCount), - // Cooldown: to.Ptr("PT6M"), - // Direction: to.Ptr(armmonitor.ScaleDirectionDecrease), - // Value: to.Ptr("2"), - // }, - // }}, - // }}, - // TargetResourceURI: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client.go b/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client.go deleted file mode 100644 index d23375c62f44..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client.go +++ /dev/null @@ -1,419 +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 armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// AzureMonitorWorkspacesClient contains the methods for the AzureMonitorWorkspaces group. -// Don't use this type directly, use NewAzureMonitorWorkspacesClient() instead. -type AzureMonitorWorkspacesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewAzureMonitorWorkspacesClient creates a new instance of AzureMonitorWorkspacesClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewAzureMonitorWorkspacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AzureMonitorWorkspacesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &AzureMonitorWorkspacesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Create - Create or update a workspace -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-06-03-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - azureMonitorWorkspaceName - The name of the Azure Monitor workspace. The name is case insensitive -// - azureMonitorWorkspaceProperties - Properties that need to be specified to create a new workspace -// - options - AzureMonitorWorkspacesClientCreateOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Create -// method. -func (client *AzureMonitorWorkspacesClient) Create(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, azureMonitorWorkspaceProperties AzureMonitorWorkspaceResource, options *AzureMonitorWorkspacesClientCreateOptions) (AzureMonitorWorkspacesClientCreateResponse, error) { - var err error - const operationName = "AzureMonitorWorkspacesClient.Create" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, azureMonitorWorkspaceName, azureMonitorWorkspaceProperties, options) - if err != nil { - return AzureMonitorWorkspacesClientCreateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AzureMonitorWorkspacesClientCreateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return AzureMonitorWorkspacesClientCreateResponse{}, err - } - resp, err := client.createHandleResponse(httpResp) - return resp, err -} - -// createCreateRequest creates the Create request. -func (client *AzureMonitorWorkspacesClient) createCreateRequest(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, azureMonitorWorkspaceProperties AzureMonitorWorkspaceResource, options *AzureMonitorWorkspacesClientCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if azureMonitorWorkspaceName == "" { - return nil, errors.New("parameter azureMonitorWorkspaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{azureMonitorWorkspaceName}", url.PathEscape(azureMonitorWorkspaceName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-03-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, azureMonitorWorkspaceProperties); err != nil { - return nil, err - } - return req, nil -} - -// createHandleResponse handles the Create response. -func (client *AzureMonitorWorkspacesClient) createHandleResponse(resp *http.Response) (AzureMonitorWorkspacesClientCreateResponse, error) { - result := AzureMonitorWorkspacesClientCreateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureMonitorWorkspaceResource); err != nil { - return AzureMonitorWorkspacesClientCreateResponse{}, err - } - return result, nil -} - -// Delete - Delete a workspace -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-06-03-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - azureMonitorWorkspaceName - The name of the Azure Monitor workspace. The name is case insensitive -// - options - AzureMonitorWorkspacesClientDeleteOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Delete -// method. -func (client *AzureMonitorWorkspacesClient) Delete(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientDeleteOptions) (AzureMonitorWorkspacesClientDeleteResponse, error) { - var err error - const operationName = "AzureMonitorWorkspacesClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, azureMonitorWorkspaceName, options) - if err != nil { - return AzureMonitorWorkspacesClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AzureMonitorWorkspacesClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return AzureMonitorWorkspacesClientDeleteResponse{}, err - } - return AzureMonitorWorkspacesClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *AzureMonitorWorkspacesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if azureMonitorWorkspaceName == "" { - return nil, errors.New("parameter azureMonitorWorkspaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{azureMonitorWorkspaceName}", url.PathEscape(azureMonitorWorkspaceName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-03-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Returns the specific Azure Monitor workspace -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-06-03-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - azureMonitorWorkspaceName - The name of the Azure Monitor workspace. The name is case insensitive -// - options - AzureMonitorWorkspacesClientGetOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Get -// method. -func (client *AzureMonitorWorkspacesClient) Get(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientGetOptions) (AzureMonitorWorkspacesClientGetResponse, error) { - var err error - const operationName = "AzureMonitorWorkspacesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, azureMonitorWorkspaceName, options) - if err != nil { - return AzureMonitorWorkspacesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AzureMonitorWorkspacesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AzureMonitorWorkspacesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *AzureMonitorWorkspacesClient) getCreateRequest(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if azureMonitorWorkspaceName == "" { - return nil, errors.New("parameter azureMonitorWorkspaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{azureMonitorWorkspaceName}", url.PathEscape(azureMonitorWorkspaceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-03-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *AzureMonitorWorkspacesClient) getHandleResponse(resp *http.Response) (AzureMonitorWorkspacesClientGetResponse, error) { - result := AzureMonitorWorkspacesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureMonitorWorkspaceResource); err != nil { - return AzureMonitorWorkspacesClientGetResponse{}, err - } - return result, nil -} - -// NewListByResourceGroupPager - Lists all workspaces in the specified resource group -// -// Generated from API version 2021-06-03-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - options - AzureMonitorWorkspacesClientListByResourceGroupOptions contains the optional parameters for the AzureMonitorWorkspacesClient.NewListByResourceGroupPager -// method. -func (client *AzureMonitorWorkspacesClient) NewListByResourceGroupPager(resourceGroupName string, options *AzureMonitorWorkspacesClientListByResourceGroupOptions) *runtime.Pager[AzureMonitorWorkspacesClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[AzureMonitorWorkspacesClientListByResourceGroupResponse]{ - More: func(page AzureMonitorWorkspacesClientListByResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *AzureMonitorWorkspacesClientListByResourceGroupResponse) (AzureMonitorWorkspacesClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AzureMonitorWorkspacesClient.NewListByResourceGroupPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - }, nil) - if err != nil { - return AzureMonitorWorkspacesClientListByResourceGroupResponse{}, err - } - return client.listByResourceGroupHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *AzureMonitorWorkspacesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AzureMonitorWorkspacesClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-03-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *AzureMonitorWorkspacesClient) listByResourceGroupHandleResponse(resp *http.Response) (AzureMonitorWorkspacesClientListByResourceGroupResponse, error) { - result := AzureMonitorWorkspacesClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureMonitorWorkspaceResourceListResult); err != nil { - return AzureMonitorWorkspacesClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionPager - Lists all workspaces in the specified subscription -// -// Generated from API version 2021-06-03-preview -// - options - AzureMonitorWorkspacesClientListBySubscriptionOptions contains the optional parameters for the AzureMonitorWorkspacesClient.NewListBySubscriptionPager -// method. -func (client *AzureMonitorWorkspacesClient) NewListBySubscriptionPager(options *AzureMonitorWorkspacesClientListBySubscriptionOptions) *runtime.Pager[AzureMonitorWorkspacesClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[AzureMonitorWorkspacesClientListBySubscriptionResponse]{ - More: func(page AzureMonitorWorkspacesClientListBySubscriptionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *AzureMonitorWorkspacesClientListBySubscriptionResponse) (AzureMonitorWorkspacesClientListBySubscriptionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AzureMonitorWorkspacesClient.NewListBySubscriptionPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listBySubscriptionCreateRequest(ctx, options) - }, nil) - if err != nil { - return AzureMonitorWorkspacesClientListBySubscriptionResponse{}, err - } - return client.listBySubscriptionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *AzureMonitorWorkspacesClient) listBySubscriptionCreateRequest(ctx context.Context, options *AzureMonitorWorkspacesClientListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Monitor/accounts" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-03-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *AzureMonitorWorkspacesClient) listBySubscriptionHandleResponse(resp *http.Response) (AzureMonitorWorkspacesClientListBySubscriptionResponse, error) { - result := AzureMonitorWorkspacesClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureMonitorWorkspaceResourceListResult); err != nil { - return AzureMonitorWorkspacesClientListBySubscriptionResponse{}, err - } - return result, nil -} - -// Update - Updates part of a workspace -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-06-03-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - azureMonitorWorkspaceName - The name of the Azure Monitor workspace. The name is case insensitive -// - options - AzureMonitorWorkspacesClientUpdateOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Update -// method. -func (client *AzureMonitorWorkspacesClient) Update(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientUpdateOptions) (AzureMonitorWorkspacesClientUpdateResponse, error) { - var err error - const operationName = "AzureMonitorWorkspacesClient.Update" - 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, azureMonitorWorkspaceName, options) - if err != nil { - return AzureMonitorWorkspacesClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AzureMonitorWorkspacesClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AzureMonitorWorkspacesClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *AzureMonitorWorkspacesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *AzureMonitorWorkspacesClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if azureMonitorWorkspaceName == "" { - return nil, errors.New("parameter azureMonitorWorkspaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{azureMonitorWorkspaceName}", url.PathEscape(azureMonitorWorkspaceName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-03-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.AzureMonitorWorkspaceProperties != nil { - if err := runtime.MarshalAsJSON(req, *options.AzureMonitorWorkspaceProperties); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *AzureMonitorWorkspacesClient) updateHandleResponse(resp *http.Response) (AzureMonitorWorkspacesClientUpdateResponse, error) { - result := AzureMonitorWorkspacesClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureMonitorWorkspaceResource); err != nil { - return AzureMonitorWorkspacesClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client_example_test.go deleted file mode 100644 index 455a436b12cd..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/azuremonitorworkspaces_client_example_test.go +++ /dev/null @@ -1,379 +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 armmonitor_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/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesListByResourceGroup.json -func ExampleAzureMonitorWorkspacesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAzureMonitorWorkspacesClient().NewListByResourceGroupPager("myResourceGroup", 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.AzureMonitorWorkspaceResourceListResult = armmonitor.AzureMonitorWorkspaceResourceListResult{ - // Value: []*armmonitor.AzureMonitorWorkspaceResource{ - // { - // Name: to.Ptr("myAzureMonitorWorkspace"), - // Type: to.Ptr("Microsoft.Monitor/accounts"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Monitor/accounts/myAzureMonitorWorkspace"), - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // Properties: &armmonitor.AzureMonitorWorkspaceResourceProperties{ - // AccountID: to.Ptr("2df515bf-c3ce-4920-84d4-1d9d16542d9f"), - // DefaultIngestionSettings: &armmonitor.AzureMonitorWorkspaceDefaultIngestionSettings{ - // DataCollectionEndpointResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_myAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionEndpoints/myAzureMonitorWorkspace"), - // DataCollectionRuleResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_myAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionRules/myAzureMonitorWorkspace"), - // }, - // Metrics: &armmonitor.AzureMonitorWorkspaceMetrics{ - // InternalID: to.Ptr("mac_2df515bf-c3ce-4920-84d4-1d9d16542d9f"), - // PrometheusQueryEndpoint: to.Ptr("https://myAzureMonitorWorkspace-abcd.eastus.prometheus.monitor.azure.com"), - // }, - // ProvisioningState: to.Ptr(armmonitor.ProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("herAzureMonitorWorkspace"), - // Type: to.Ptr("Microsoft.Monitor/accounts"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Monitor/accounts/herAzureMonitorWorkspace"), - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // Properties: &armmonitor.AzureMonitorWorkspaceResourceProperties{ - // AccountID: to.Ptr("823220c6-0415-44d8-bfb2-d5c1c9ea1172"), - // DefaultIngestionSettings: &armmonitor.AzureMonitorWorkspaceDefaultIngestionSettings{ - // DataCollectionEndpointResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_herAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionEndpoints/herAzureMonitorWorkspace"), - // DataCollectionRuleResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_herAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionRules/herAzureMonitorWorkspace"), - // }, - // Metrics: &armmonitor.AzureMonitorWorkspaceMetrics{ - // InternalID: to.Ptr("mac_823220c6-0415-44d8-bfb2-d5c1c9ea1172"), - // PrometheusQueryEndpoint: to.Ptr("https://herAzureMonitorWorkspace-xywz.eastus.prometheus.monitor.azure.com"), - // }, - // ProvisioningState: to.Ptr(armmonitor.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesListBySubscription.json -func ExampleAzureMonitorWorkspacesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAzureMonitorWorkspacesClient().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.AzureMonitorWorkspaceResourceListResult = armmonitor.AzureMonitorWorkspaceResourceListResult{ - // Value: []*armmonitor.AzureMonitorWorkspaceResource{ - // { - // Name: to.Ptr("myAzureMonitorWorkspace"), - // Type: to.Ptr("Microsoft.Monitor/accounts"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Monitor/accounts/myAzureMonitorWorkspace"), - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // Properties: &armmonitor.AzureMonitorWorkspaceResourceProperties{ - // AccountID: to.Ptr("2df515bf-c3ce-4920-84d4-1d9d16542d9f"), - // DefaultIngestionSettings: &armmonitor.AzureMonitorWorkspaceDefaultIngestionSettings{ - // DataCollectionEndpointResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_myAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionEndpoints/myAzureMonitorWorkspace"), - // DataCollectionRuleResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_myAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionRules/myAzureMonitorWorkspace"), - // }, - // Metrics: &armmonitor.AzureMonitorWorkspaceMetrics{ - // InternalID: to.Ptr("mac_2df515bf-c3ce-4920-84d4-1d9d16542d9f"), - // PrometheusQueryEndpoint: to.Ptr("https://myAzureMonitorWorkspace-v8hx.eastus.prometheus.monitor.azure.com"), - // }, - // ProvisioningState: to.Ptr(armmonitor.ProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("herAzureMonitorWorkspace"), - // Type: to.Ptr("Microsoft.Monitor/accounts"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/herResourceGroup/providers/Microsoft.Monitor/accounts/herAzureMonitorWorkspace"), - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // Properties: &armmonitor.AzureMonitorWorkspaceResourceProperties{ - // AccountID: to.Ptr("823220c6-0415-44d8-bfb2-d5c1c9ea1172"), - // DefaultIngestionSettings: &armmonitor.AzureMonitorWorkspaceDefaultIngestionSettings{ - // DataCollectionEndpointResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_herAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionEndpoints/herAzureMonitorWorkspace"), - // DataCollectionRuleResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_herAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionRules/herAzureMonitorWorkspace"), - // }, - // Metrics: &armmonitor.AzureMonitorWorkspaceMetrics{ - // InternalID: to.Ptr("mac_823220c6-0415-44d8-bfb2-d5c1c9ea1172"), - // PrometheusQueryEndpoint: to.Ptr("https://herazuremonitorworkspace-xywz.eastus.prometheus.monitor.azure.com"), - // }, - // ProvisioningState: to.Ptr(armmonitor.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesGet.json -func ExampleAzureMonitorWorkspacesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureMonitorWorkspacesClient().Get(ctx, "myResourceGroup", "myAzureMonitorWorkspace", 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.AzureMonitorWorkspaceResource = armmonitor.AzureMonitorWorkspaceResource{ - // Name: to.Ptr("myAzureMonitorWorkspace"), - // Type: to.Ptr("Microsoft.Monitor/accounts"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Monitor/accounts/myAzureMonitorWorkspace"), - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // Properties: &armmonitor.AzureMonitorWorkspaceResourceProperties{ - // AccountID: to.Ptr("2df515bf-c3ce-4920-84d4-1d9d16542d9f"), - // DefaultIngestionSettings: &armmonitor.AzureMonitorWorkspaceDefaultIngestionSettings{ - // DataCollectionEndpointResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_myAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionEndpoints/myAzureMonitorWorkspace"), - // DataCollectionRuleResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_myAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionRules/myAzureMonitorWorkspace"), - // }, - // Metrics: &armmonitor.AzureMonitorWorkspaceMetrics{ - // InternalID: to.Ptr("mac_2df515bf-c3ce-4920-84d4-1d9d16542d9f"), - // PrometheusQueryEndpoint: to.Ptr("https://myAzureMonitorWorkspace-v8hx.eastus.prometheus.monitor.azure.com"), - // }, - // ProvisioningState: to.Ptr(armmonitor.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesCreate.json -func ExampleAzureMonitorWorkspacesClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureMonitorWorkspacesClient().Create(ctx, "myResourceGroup", "myAzureMonitorWorkspace", armmonitor.AzureMonitorWorkspaceResource{ - Location: to.Ptr("eastus"), - }, 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.AzureMonitorWorkspaceResource = armmonitor.AzureMonitorWorkspaceResource{ - // Name: to.Ptr("myAzureMonitorWorkspace"), - // Type: to.Ptr("Microsoft.Monitor/accounts"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Monitor/accounts/myAzureMonitorWorkspace"), - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // Properties: &armmonitor.AzureMonitorWorkspaceResourceProperties{ - // AccountID: to.Ptr("2df515bf-c3ce-4920-84d4-1d9d16542d9f"), - // DefaultIngestionSettings: &armmonitor.AzureMonitorWorkspaceDefaultIngestionSettings{ - // DataCollectionEndpointResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_myAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionEndpoints/myAzureMonitorWorkspace"), - // DataCollectionRuleResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_myAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionRules/myAzureMonitorWorkspace"), - // }, - // Metrics: &armmonitor.AzureMonitorWorkspaceMetrics{ - // InternalID: to.Ptr("mac_2df515bf-c3ce-4920-84d4-1d9d16542d9f"), - // PrometheusQueryEndpoint: to.Ptr("https://myAzureMonitorWorkspace-v8hx.eastus.prometheus.monitor.azure.com"), - // }, - // ProvisioningState: to.Ptr(armmonitor.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesUpdate.json -func ExampleAzureMonitorWorkspacesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureMonitorWorkspacesClient().Update(ctx, "myResourceGroup", "myAzureMonitorWorkspace", &armmonitor.AzureMonitorWorkspacesClientUpdateOptions{AzureMonitorWorkspaceProperties: &armmonitor.AzureMonitorWorkspaceResourceForUpdate{ - Tags: map[string]*string{ - "tag1": to.Ptr("A"), - "tag2": to.Ptr("B"), - "tag3": to.Ptr("C"), - }, - }, - }) - 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.AzureMonitorWorkspaceResource = armmonitor.AzureMonitorWorkspaceResource{ - // Name: to.Ptr("myAzureMonitorWorkspace"), - // Type: to.Ptr("Microsoft.Monitor/accounts"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Monitor/accounts/myAzureMonitorWorkspace"), - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // "tag3": to.Ptr("C"), - // }, - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // Properties: &armmonitor.AzureMonitorWorkspaceResourceProperties{ - // AccountID: to.Ptr("2df515bf-c3ce-4920-84d4-1d9d16542d9f"), - // DefaultIngestionSettings: &armmonitor.AzureMonitorWorkspaceDefaultIngestionSettings{ - // DataCollectionEndpointResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_myAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionEndpoints/myAzureMonitorWorkspace"), - // DataCollectionRuleResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/MA_myAzureMonitorWorkspace_eastus_managed/providers/Microsoft.Insights/dataCollectionRules/myAzureMonitorWorkspace"), - // }, - // Metrics: &armmonitor.AzureMonitorWorkspaceMetrics{ - // InternalID: to.Ptr("mac_2df515bf-c3ce-4920-84d4-1d9d16542d9f"), - // PrometheusQueryEndpoint: to.Ptr("https://myAzureMonitorWorkspace-v8hx.eastus.prometheus.monitor.azure.com"), - // }, - // ProvisioningState: to.Ptr(armmonitor.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesDelete.json -func ExampleAzureMonitorWorkspacesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAzureMonitorWorkspacesClient().Delete(ctx, "myResourceGroup", "myAzureMonitorWorkspace", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/baselines_client.go b/sdk/resourcemanager/monitor/armmonitor/baselines_client.go deleted file mode 100644 index 997ba5b2a6a1..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/baselines_client.go +++ /dev/null @@ -1,116 +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 armmonitor - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "strings" -) - -// BaselinesClient contains the methods for the Baselines group. -// Don't use this type directly, use NewBaselinesClient() instead. -type BaselinesClient struct { - internal *arm.Client -} - -// NewBaselinesClient creates a new instance of BaselinesClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewBaselinesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*BaselinesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &BaselinesClient{ - internal: cl, - } - return client, nil -} - -// NewListPager - Lists the metric baseline values for a resource. -// -// Generated from API version 2019-03-01 -// - resourceURI - The identifier of the resource. -// - options - BaselinesClientListOptions contains the optional parameters for the BaselinesClient.NewListPager method. -func (client *BaselinesClient) NewListPager(resourceURI string, options *BaselinesClientListOptions) *runtime.Pager[BaselinesClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[BaselinesClientListResponse]{ - More: func(page BaselinesClientListResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *BaselinesClientListResponse) (BaselinesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "BaselinesClient.NewListPager") - req, err := client.listCreateRequest(ctx, resourceURI, options) - if err != nil { - return BaselinesClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return BaselinesClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return BaselinesClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *BaselinesClient) listCreateRequest(ctx context.Context, resourceURI string, options *BaselinesClientListOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.Insights/metricBaselines" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Metricnames != nil { - reqQP.Set("metricnames", *options.Metricnames) - } - if options != nil && options.Metricnamespace != nil { - reqQP.Set("metricnamespace", *options.Metricnamespace) - } - if options != nil && options.Timespan != nil { - reqQP.Set("timespan", *options.Timespan) - } - if options != nil && options.Interval != nil { - reqQP.Set("interval", *options.Interval) - } - if options != nil && options.Aggregation != nil { - reqQP.Set("aggregation", *options.Aggregation) - } - if options != nil && options.Sensitivities != nil { - reqQP.Set("sensitivities", *options.Sensitivities) - } - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.ResultType != nil { - reqQP.Set("resultType", string(*options.ResultType)) - } - reqQP.Set("api-version", "2019-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *BaselinesClient) listHandleResponse(resp *http.Response) (BaselinesClientListResponse, error) { - result := BaselinesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MetricBaselinesResponse); err != nil { - return BaselinesClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/baselines_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/baselines_client_example_test.go deleted file mode 100644 index 7eb46f3d4253..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/baselines_client_example_test.go +++ /dev/null @@ -1,102 +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 armmonitor_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/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2019-03-01/examples/metricBaselines.json -func ExampleBaselinesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewBaselinesClient().NewListPager("subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1", &armmonitor.BaselinesClientListOptions{Metricnames: nil, - Metricnamespace: nil, - Timespan: to.Ptr("2019-03-12T11:00:00.000Z/2019-03-12T12:00:00.000Z"), - Interval: to.Ptr("PT1H"), - Aggregation: to.Ptr("average"), - Sensitivities: to.Ptr("Low,Medium"), - Filter: nil, - ResultType: 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.MetricBaselinesResponse = armmonitor.MetricBaselinesResponse{ - // Value: []*armmonitor.SingleMetricBaseline{ - // { - // Name: to.Ptr("Percentage CPU"), - // Type: to.Ptr("microsoft.insights/metricBaselines"), - // ID: to.Ptr("/subscriptions/11aeb0ed-456b-4ca0-8df5-b9fbdc63d0d3/resourceGroups/SmartAnalytics-DEV-VM/providers/Microsoft.Compute/virtualMachines/DemoVM1/providers/microsoft.insights/metricBaselines/Percentage CPU"), - // Properties: &armmonitor.MetricBaselinesProperties{ - // Baselines: []*armmonitor.TimeSeriesBaseline{ - // { - // Aggregation: to.Ptr("average"), - // Data: []*armmonitor.SingleBaseline{ - // { - // HighThresholds: []*float64{ - // to.Ptr[float64](90.3453), - // to.Ptr[float64](91.3453)}, - // LowThresholds: []*float64{ - // to.Ptr[float64](30), - // to.Ptr[float64](31.1)}, - // Sensitivity: to.Ptr(armmonitor.BaselineSensitivityLow), - // }, - // { - // HighThresholds: []*float64{ - // to.Ptr[float64](70.3453), - // to.Ptr[float64](71.3453)}, - // LowThresholds: []*float64{ - // to.Ptr[float64](50), - // to.Ptr[float64](51.1)}, - // Sensitivity: to.Ptr(armmonitor.BaselineSensitivityMedium), - // }}, - // Dimensions: []*armmonitor.MetricSingleDimension{ - // }, - // MetadataValues: []*armmonitor.BaselineMetadata{ - // { - // Name: to.Ptr("ErrorType"), - // Value: to.Ptr("TooManyAnomalies"), - // }, - // { - // Name: to.Ptr("SeasonalityFrequency"), - // Value: to.Ptr("288"), - // }}, - // Timestamps: []*time.Time{ - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-12T11:00:00.000Z"); return t}()), - // to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-03-12T12:00:00.000Z"); return t}())}, - // }}, - // Interval: to.Ptr("PT1H"), - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // Timespan: to.Ptr("2019-03-12T11:00:00.000Z/2019-03-12T12:00:00.000Z"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/client_factory.go b/sdk/resourcemanager/monitor/armmonitor/client_factory.go index 06b2c0c10362..b2e65899f533 100644 --- a/sdk/resourcemanager/monitor/armmonitor/client_factory.go +++ b/sdk/resourcemanager/monitor/armmonitor/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,8 +14,7 @@ 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. @@ -27,204 +23,28 @@ type ClientFactory struct { // - 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 } // NewActionGroupsClient creates a new instance of ActionGroupsClient. func (c *ClientFactory) NewActionGroupsClient() *ActionGroupsClient { - subClient, _ := NewActionGroupsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewActivityLogAlertsClient creates a new instance of ActivityLogAlertsClient. -func (c *ClientFactory) NewActivityLogAlertsClient() *ActivityLogAlertsClient { - subClient, _ := NewActivityLogAlertsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewActivityLogsClient creates a new instance of ActivityLogsClient. -func (c *ClientFactory) NewActivityLogsClient() *ActivityLogsClient { - subClient, _ := NewActivityLogsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewAlertRuleIncidentsClient creates a new instance of AlertRuleIncidentsClient. -func (c *ClientFactory) NewAlertRuleIncidentsClient() *AlertRuleIncidentsClient { - subClient, _ := NewAlertRuleIncidentsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewAlertRulesClient creates a new instance of AlertRulesClient. -func (c *ClientFactory) NewAlertRulesClient() *AlertRulesClient { - subClient, _ := NewAlertRulesClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewAutoscaleSettingsClient creates a new instance of AutoscaleSettingsClient. -func (c *ClientFactory) NewAutoscaleSettingsClient() *AutoscaleSettingsClient { - subClient, _ := NewAutoscaleSettingsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewAzureMonitorWorkspacesClient creates a new instance of AzureMonitorWorkspacesClient. -func (c *ClientFactory) NewAzureMonitorWorkspacesClient() *AzureMonitorWorkspacesClient { - subClient, _ := NewAzureMonitorWorkspacesClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewBaselinesClient creates a new instance of BaselinesClient. -func (c *ClientFactory) NewBaselinesClient() *BaselinesClient { - subClient, _ := NewBaselinesClient(c.credential, c.options) - return subClient -} - -// NewDataCollectionEndpointsClient creates a new instance of DataCollectionEndpointsClient. -func (c *ClientFactory) NewDataCollectionEndpointsClient() *DataCollectionEndpointsClient { - subClient, _ := NewDataCollectionEndpointsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewDataCollectionRuleAssociationsClient creates a new instance of DataCollectionRuleAssociationsClient. -func (c *ClientFactory) NewDataCollectionRuleAssociationsClient() *DataCollectionRuleAssociationsClient { - subClient, _ := NewDataCollectionRuleAssociationsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewDataCollectionRulesClient creates a new instance of DataCollectionRulesClient. -func (c *ClientFactory) NewDataCollectionRulesClient() *DataCollectionRulesClient { - subClient, _ := NewDataCollectionRulesClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewDiagnosticSettingsCategoryClient creates a new instance of DiagnosticSettingsCategoryClient. -func (c *ClientFactory) NewDiagnosticSettingsCategoryClient() *DiagnosticSettingsCategoryClient { - subClient, _ := NewDiagnosticSettingsCategoryClient(c.credential, c.options) - return subClient -} - -// NewDiagnosticSettingsClient creates a new instance of DiagnosticSettingsClient. -func (c *ClientFactory) NewDiagnosticSettingsClient() *DiagnosticSettingsClient { - subClient, _ := NewDiagnosticSettingsClient(c.credential, c.options) - return subClient -} - -// NewEventCategoriesClient creates a new instance of EventCategoriesClient. -func (c *ClientFactory) NewEventCategoriesClient() *EventCategoriesClient { - subClient, _ := NewEventCategoriesClient(c.credential, c.options) - return subClient -} - -// NewLogProfilesClient creates a new instance of LogProfilesClient. -func (c *ClientFactory) NewLogProfilesClient() *LogProfilesClient { - subClient, _ := NewLogProfilesClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewMetricAlertsClient creates a new instance of MetricAlertsClient. -func (c *ClientFactory) NewMetricAlertsClient() *MetricAlertsClient { - subClient, _ := NewMetricAlertsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewMetricAlertsStatusClient creates a new instance of MetricAlertsStatusClient. -func (c *ClientFactory) NewMetricAlertsStatusClient() *MetricAlertsStatusClient { - subClient, _ := NewMetricAlertsStatusClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewMetricDefinitionsClient creates a new instance of MetricDefinitionsClient. -func (c *ClientFactory) NewMetricDefinitionsClient() *MetricDefinitionsClient { - subClient, _ := NewMetricDefinitionsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewMetricNamespacesClient creates a new instance of MetricNamespacesClient. -func (c *ClientFactory) NewMetricNamespacesClient() *MetricNamespacesClient { - subClient, _ := NewMetricNamespacesClient(c.credential, c.options) - return subClient -} - -// NewMetricsClient creates a new instance of MetricsClient. -func (c *ClientFactory) NewMetricsClient() *MetricsClient { - subClient, _ := NewMetricsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewOperationsClient creates a new instance of OperationsClient. -func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) - return subClient -} - -// NewOperationsForMonitorClient creates a new instance of OperationsForMonitorClient. -func (c *ClientFactory) NewOperationsForMonitorClient() *OperationsForMonitorClient { - subClient, _ := NewOperationsForMonitorClient(c.credential, c.options) - return subClient -} - -// NewPredictiveMetricClient creates a new instance of PredictiveMetricClient. -func (c *ClientFactory) NewPredictiveMetricClient() *PredictiveMetricClient { - subClient, _ := NewPredictiveMetricClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient. -func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { - subClient, _ := NewPrivateEndpointConnectionsClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient. -func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { - subClient, _ := NewPrivateLinkResourcesClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewPrivateLinkScopeOperationStatusClient creates a new instance of PrivateLinkScopeOperationStatusClient. -func (c *ClientFactory) NewPrivateLinkScopeOperationStatusClient() *PrivateLinkScopeOperationStatusClient { - subClient, _ := NewPrivateLinkScopeOperationStatusClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewPrivateLinkScopedResourcesClient creates a new instance of PrivateLinkScopedResourcesClient. -func (c *ClientFactory) NewPrivateLinkScopedResourcesClient() *PrivateLinkScopedResourcesClient { - subClient, _ := NewPrivateLinkScopedResourcesClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewPrivateLinkScopesClient creates a new instance of PrivateLinkScopesClient. -func (c *ClientFactory) NewPrivateLinkScopesClient() *PrivateLinkScopesClient { - subClient, _ := NewPrivateLinkScopesClient(c.subscriptionID, c.credential, c.options) - return subClient + return &ActionGroupsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewScheduledQueryRulesClient creates a new instance of ScheduledQueryRulesClient. func (c *ClientFactory) NewScheduledQueryRulesClient() *ScheduledQueryRulesClient { - subClient, _ := NewScheduledQueryRulesClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewTenantActionGroupsClient creates a new instance of TenantActionGroupsClient. -func (c *ClientFactory) NewTenantActionGroupsClient() *TenantActionGroupsClient { - subClient, _ := NewTenantActionGroupsClient(c.credential, c.options) - return subClient -} - -// NewTenantActivityLogsClient creates a new instance of TenantActivityLogsClient. -func (c *ClientFactory) NewTenantActivityLogsClient() *TenantActivityLogsClient { - subClient, _ := NewTenantActivityLogsClient(c.credential, c.options) - return subClient -} - -// NewVMInsightsClient creates a new instance of VMInsightsClient. -func (c *ClientFactory) NewVMInsightsClient() *VMInsightsClient { - subClient, _ := NewVMInsightsClient(c.credential, c.options) - return subClient + return &ScheduledQueryRulesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } diff --git a/sdk/resourcemanager/monitor/armmonitor/constants.go b/sdk/resourcemanager/monitor/armmonitor/constants.go index 352de0354f9d..2786d2feede2 100644 --- a/sdk/resourcemanager/monitor/armmonitor/constants.go +++ b/sdk/resourcemanager/monitor/armmonitor/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,85 +7,9 @@ package armmonitor const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - moduleVersion = "v0.11.0" -) - -// AccessMode - Access mode types. -type AccessMode string - -const ( - AccessModeOpen AccessMode = "Open" - AccessModePrivateOnly AccessMode = "PrivateOnly" -) - -// PossibleAccessModeValues returns the possible values for the AccessMode const type. -func PossibleAccessModeValues() []AccessMode { - return []AccessMode{ - AccessModeOpen, - AccessModePrivateOnly, - } -} - -// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. -type ActionType string - -const ( - ActionTypeInternal ActionType = "Internal" + moduleVersion = "v0.12.0" ) -// PossibleActionTypeValues returns the possible values for the ActionType const type. -func PossibleActionTypeValues() []ActionType { - return []ActionType{ - ActionTypeInternal, - } -} - -// AggregationType - the aggregation type of the metric. -type AggregationType string - -const ( - AggregationTypeAverage AggregationType = "Average" - AggregationTypeCount AggregationType = "Count" - AggregationTypeMaximum AggregationType = "Maximum" - AggregationTypeMinimum AggregationType = "Minimum" - AggregationTypeNone AggregationType = "None" - AggregationTypeTotal AggregationType = "Total" -) - -// PossibleAggregationTypeValues returns the possible values for the AggregationType const type. -func PossibleAggregationTypeValues() []AggregationType { - return []AggregationType{ - AggregationTypeAverage, - AggregationTypeCount, - AggregationTypeMaximum, - AggregationTypeMinimum, - AggregationTypeNone, - AggregationTypeTotal, - } -} - -// AggregationTypeEnum - the criteria time aggregation types. -type AggregationTypeEnum string - -const ( - AggregationTypeEnumAverage AggregationTypeEnum = "Average" - AggregationTypeEnumCount AggregationTypeEnum = "Count" - AggregationTypeEnumMaximum AggregationTypeEnum = "Maximum" - AggregationTypeEnumMinimum AggregationTypeEnum = "Minimum" - AggregationTypeEnumTotal AggregationTypeEnum = "Total" -) - -// PossibleAggregationTypeEnumValues returns the possible values for the AggregationTypeEnum const type. -func PossibleAggregationTypeEnumValues() []AggregationTypeEnum { - return []AggregationTypeEnum{ - AggregationTypeEnumAverage, - AggregationTypeEnumCount, - AggregationTypeEnumMaximum, - AggregationTypeEnumMinimum, - AggregationTypeEnumTotal, - } -} - // AlertSeverity - Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. Relevant and required // only for rules of the kind LogAlert. type AlertSeverity int64 @@ -112,69 +33,12 @@ func PossibleAlertSeverityValues() []AlertSeverity { } } -// BaselineSensitivity - the sensitivity of the baseline. -type BaselineSensitivity string - -const ( - BaselineSensitivityHigh BaselineSensitivity = "High" - BaselineSensitivityLow BaselineSensitivity = "Low" - BaselineSensitivityMedium BaselineSensitivity = "Medium" -) - -// PossibleBaselineSensitivityValues returns the possible values for the BaselineSensitivity const type. -func PossibleBaselineSensitivityValues() []BaselineSensitivity { - return []BaselineSensitivity{ - BaselineSensitivityHigh, - BaselineSensitivityLow, - BaselineSensitivityMedium, - } -} - -// CategoryType - The type of the diagnostic settings category. -type CategoryType string - -const ( - CategoryTypeLogs CategoryType = "Logs" - CategoryTypeMetrics CategoryType = "Metrics" -) - -// PossibleCategoryTypeValues returns the possible values for the CategoryType const type. -func PossibleCategoryTypeValues() []CategoryType { - return []CategoryType{ - CategoryTypeLogs, - CategoryTypeMetrics, - } -} - -// ComparisonOperationType - the operator that is used to compare the metric data and the threshold. -type ComparisonOperationType string - -const ( - ComparisonOperationTypeEquals ComparisonOperationType = "Equals" - ComparisonOperationTypeGreaterThan ComparisonOperationType = "GreaterThan" - ComparisonOperationTypeGreaterThanOrEqual ComparisonOperationType = "GreaterThanOrEqual" - ComparisonOperationTypeLessThan ComparisonOperationType = "LessThan" - ComparisonOperationTypeLessThanOrEqual ComparisonOperationType = "LessThanOrEqual" - ComparisonOperationTypeNotEquals ComparisonOperationType = "NotEquals" -) - -// PossibleComparisonOperationTypeValues returns the possible values for the ComparisonOperationType const type. -func PossibleComparisonOperationTypeValues() []ComparisonOperationType { - return []ComparisonOperationType{ - ComparisonOperationTypeEquals, - ComparisonOperationTypeGreaterThan, - ComparisonOperationTypeGreaterThanOrEqual, - ComparisonOperationTypeLessThan, - ComparisonOperationTypeLessThanOrEqual, - ComparisonOperationTypeNotEquals, - } -} - -// ConditionOperator - Operators allowed in the rule condition. +// ConditionOperator - The criteria operator. Relevant and required only for rules of the kind LogAlert. type ConditionOperator string const ( ConditionOperatorEquals ConditionOperator = "Equals" + ConditionOperatorGreaterOrLessThan ConditionOperator = "GreaterOrLessThan" ConditionOperatorGreaterThan ConditionOperator = "GreaterThan" ConditionOperatorGreaterThanOrEqual ConditionOperator = "GreaterThanOrEqual" ConditionOperatorLessThan ConditionOperator = "LessThan" @@ -185,6 +49,7 @@ const ( func PossibleConditionOperatorValues() []ConditionOperator { return []ConditionOperator{ ConditionOperatorEquals, + ConditionOperatorGreaterOrLessThan, ConditionOperatorGreaterThan, ConditionOperatorGreaterThanOrEqual, ConditionOperatorLessThan, @@ -228,23 +93,6 @@ func PossibleCriterionTypeValues() []CriterionType { } } -// DataStatus - The status of VM Insights data from the resource. When reported as present the data array will contain information -// about the data containers to which data for the specified resource is being routed. -type DataStatus string - -const ( - DataStatusNotPresent DataStatus = "notPresent" - DataStatusPresent DataStatus = "present" -) - -// PossibleDataStatusValues returns the possible values for the DataStatus const type. -func PossibleDataStatusValues() []DataStatus { - return []DataStatus{ - DataStatusNotPresent, - DataStatusPresent, - } -} - // DimensionOperator - Operator for dimension values type DimensionOperator string @@ -261,65 +109,6 @@ func PossibleDimensionOperatorValues() []DimensionOperator { } } -// DynamicThresholdOperator - The operator used to compare the metric value against the threshold. -type DynamicThresholdOperator string - -const ( - DynamicThresholdOperatorGreaterOrLessThan DynamicThresholdOperator = "GreaterOrLessThan" - DynamicThresholdOperatorGreaterThan DynamicThresholdOperator = "GreaterThan" - DynamicThresholdOperatorLessThan DynamicThresholdOperator = "LessThan" -) - -// PossibleDynamicThresholdOperatorValues returns the possible values for the DynamicThresholdOperator const type. -func PossibleDynamicThresholdOperatorValues() []DynamicThresholdOperator { - return []DynamicThresholdOperator{ - DynamicThresholdOperatorGreaterOrLessThan, - DynamicThresholdOperatorGreaterThan, - DynamicThresholdOperatorLessThan, - } -} - -// DynamicThresholdSensitivity - The extent of deviation required to trigger an alert. This will affect how tight the threshold -// is to the metric series pattern. -type DynamicThresholdSensitivity string - -const ( - DynamicThresholdSensitivityHigh DynamicThresholdSensitivity = "High" - DynamicThresholdSensitivityLow DynamicThresholdSensitivity = "Low" - DynamicThresholdSensitivityMedium DynamicThresholdSensitivity = "Medium" -) - -// PossibleDynamicThresholdSensitivityValues returns the possible values for the DynamicThresholdSensitivity const type. -func PossibleDynamicThresholdSensitivityValues() []DynamicThresholdSensitivity { - return []DynamicThresholdSensitivity{ - DynamicThresholdSensitivityHigh, - DynamicThresholdSensitivityLow, - DynamicThresholdSensitivityMedium, - } -} - -// EventLevel - the event level -type EventLevel string - -const ( - EventLevelCritical EventLevel = "Critical" - EventLevelError EventLevel = "Error" - EventLevelInformational EventLevel = "Informational" - EventLevelVerbose EventLevel = "Verbose" - EventLevelWarning EventLevel = "Warning" -) - -// PossibleEventLevelValues returns the possible values for the EventLevel const type. -func PossibleEventLevelValues() []EventLevel { - return []EventLevel{ - EventLevelCritical, - EventLevelError, - EventLevelInformational, - EventLevelVerbose, - EventLevelWarning, - } -} - // IdentityType - Type of managed service identity. type IdentityType string @@ -338,416 +127,35 @@ func PossibleIdentityTypeValues() []IdentityType { } } -// Kind - Indicates the type of scheduled query rule. The default is LogAlert. -type Kind string - -const ( - KindLogAlert Kind = "LogAlert" - KindLogToMetric Kind = "LogToMetric" -) - -// PossibleKindValues returns the possible values for the Kind const type. -func PossibleKindValues() []Kind { - return []Kind{ - KindLogAlert, - KindLogToMetric, - } -} - -// KnownColumnDefinitionType - The type of the column data. -type KnownColumnDefinitionType string - -const ( - KnownColumnDefinitionTypeBoolean KnownColumnDefinitionType = "boolean" - KnownColumnDefinitionTypeDatetime KnownColumnDefinitionType = "datetime" - KnownColumnDefinitionTypeDynamic KnownColumnDefinitionType = "dynamic" - KnownColumnDefinitionTypeInt KnownColumnDefinitionType = "int" - KnownColumnDefinitionTypeLong KnownColumnDefinitionType = "long" - KnownColumnDefinitionTypeReal KnownColumnDefinitionType = "real" - KnownColumnDefinitionTypeString KnownColumnDefinitionType = "string" -) - -// PossibleKnownColumnDefinitionTypeValues returns the possible values for the KnownColumnDefinitionType const type. -func PossibleKnownColumnDefinitionTypeValues() []KnownColumnDefinitionType { - return []KnownColumnDefinitionType{ - KnownColumnDefinitionTypeBoolean, - KnownColumnDefinitionTypeDatetime, - KnownColumnDefinitionTypeDynamic, - KnownColumnDefinitionTypeInt, - KnownColumnDefinitionTypeLong, - KnownColumnDefinitionTypeReal, - KnownColumnDefinitionTypeString, - } -} - -// KnownDataCollectionEndpointProvisioningState - The resource provisioning state. This property is READ-ONLY. -type KnownDataCollectionEndpointProvisioningState string - -const ( - KnownDataCollectionEndpointProvisioningStateCanceled KnownDataCollectionEndpointProvisioningState = "Canceled" - KnownDataCollectionEndpointProvisioningStateCreating KnownDataCollectionEndpointProvisioningState = "Creating" - KnownDataCollectionEndpointProvisioningStateDeleting KnownDataCollectionEndpointProvisioningState = "Deleting" - KnownDataCollectionEndpointProvisioningStateFailed KnownDataCollectionEndpointProvisioningState = "Failed" - KnownDataCollectionEndpointProvisioningStateSucceeded KnownDataCollectionEndpointProvisioningState = "Succeeded" - KnownDataCollectionEndpointProvisioningStateUpdating KnownDataCollectionEndpointProvisioningState = "Updating" -) - -// PossibleKnownDataCollectionEndpointProvisioningStateValues returns the possible values for the KnownDataCollectionEndpointProvisioningState const type. -func PossibleKnownDataCollectionEndpointProvisioningStateValues() []KnownDataCollectionEndpointProvisioningState { - return []KnownDataCollectionEndpointProvisioningState{ - KnownDataCollectionEndpointProvisioningStateCanceled, - KnownDataCollectionEndpointProvisioningStateCreating, - KnownDataCollectionEndpointProvisioningStateDeleting, - KnownDataCollectionEndpointProvisioningStateFailed, - KnownDataCollectionEndpointProvisioningStateSucceeded, - KnownDataCollectionEndpointProvisioningStateUpdating, - } -} - -// KnownDataCollectionEndpointResourceKind - The kind of the resource. -type KnownDataCollectionEndpointResourceKind string - -const ( - KnownDataCollectionEndpointResourceKindLinux KnownDataCollectionEndpointResourceKind = "Linux" - KnownDataCollectionEndpointResourceKindWindows KnownDataCollectionEndpointResourceKind = "Windows" -) - -// PossibleKnownDataCollectionEndpointResourceKindValues returns the possible values for the KnownDataCollectionEndpointResourceKind const type. -func PossibleKnownDataCollectionEndpointResourceKindValues() []KnownDataCollectionEndpointResourceKind { - return []KnownDataCollectionEndpointResourceKind{ - KnownDataCollectionEndpointResourceKindLinux, - KnownDataCollectionEndpointResourceKindWindows, - } -} - -// KnownDataCollectionRuleAssociationProvisioningState - The resource provisioning state. -type KnownDataCollectionRuleAssociationProvisioningState string - -const ( - KnownDataCollectionRuleAssociationProvisioningStateCanceled KnownDataCollectionRuleAssociationProvisioningState = "Canceled" - KnownDataCollectionRuleAssociationProvisioningStateCreating KnownDataCollectionRuleAssociationProvisioningState = "Creating" - KnownDataCollectionRuleAssociationProvisioningStateDeleting KnownDataCollectionRuleAssociationProvisioningState = "Deleting" - KnownDataCollectionRuleAssociationProvisioningStateFailed KnownDataCollectionRuleAssociationProvisioningState = "Failed" - KnownDataCollectionRuleAssociationProvisioningStateSucceeded KnownDataCollectionRuleAssociationProvisioningState = "Succeeded" - KnownDataCollectionRuleAssociationProvisioningStateUpdating KnownDataCollectionRuleAssociationProvisioningState = "Updating" -) - -// PossibleKnownDataCollectionRuleAssociationProvisioningStateValues returns the possible values for the KnownDataCollectionRuleAssociationProvisioningState const type. -func PossibleKnownDataCollectionRuleAssociationProvisioningStateValues() []KnownDataCollectionRuleAssociationProvisioningState { - return []KnownDataCollectionRuleAssociationProvisioningState{ - KnownDataCollectionRuleAssociationProvisioningStateCanceled, - KnownDataCollectionRuleAssociationProvisioningStateCreating, - KnownDataCollectionRuleAssociationProvisioningStateDeleting, - KnownDataCollectionRuleAssociationProvisioningStateFailed, - KnownDataCollectionRuleAssociationProvisioningStateSucceeded, - KnownDataCollectionRuleAssociationProvisioningStateUpdating, - } -} - -// KnownDataCollectionRuleProvisioningState - The resource provisioning state. -type KnownDataCollectionRuleProvisioningState string - -const ( - KnownDataCollectionRuleProvisioningStateCanceled KnownDataCollectionRuleProvisioningState = "Canceled" - KnownDataCollectionRuleProvisioningStateCreating KnownDataCollectionRuleProvisioningState = "Creating" - KnownDataCollectionRuleProvisioningStateDeleting KnownDataCollectionRuleProvisioningState = "Deleting" - KnownDataCollectionRuleProvisioningStateFailed KnownDataCollectionRuleProvisioningState = "Failed" - KnownDataCollectionRuleProvisioningStateSucceeded KnownDataCollectionRuleProvisioningState = "Succeeded" - KnownDataCollectionRuleProvisioningStateUpdating KnownDataCollectionRuleProvisioningState = "Updating" -) - -// PossibleKnownDataCollectionRuleProvisioningStateValues returns the possible values for the KnownDataCollectionRuleProvisioningState const type. -func PossibleKnownDataCollectionRuleProvisioningStateValues() []KnownDataCollectionRuleProvisioningState { - return []KnownDataCollectionRuleProvisioningState{ - KnownDataCollectionRuleProvisioningStateCanceled, - KnownDataCollectionRuleProvisioningStateCreating, - KnownDataCollectionRuleProvisioningStateDeleting, - KnownDataCollectionRuleProvisioningStateFailed, - KnownDataCollectionRuleProvisioningStateSucceeded, - KnownDataCollectionRuleProvisioningStateUpdating, - } -} - -// KnownDataCollectionRuleResourceKind - The kind of the resource. -type KnownDataCollectionRuleResourceKind string - -const ( - KnownDataCollectionRuleResourceKindLinux KnownDataCollectionRuleResourceKind = "Linux" - KnownDataCollectionRuleResourceKindWindows KnownDataCollectionRuleResourceKind = "Windows" -) - -// PossibleKnownDataCollectionRuleResourceKindValues returns the possible values for the KnownDataCollectionRuleResourceKind const type. -func PossibleKnownDataCollectionRuleResourceKindValues() []KnownDataCollectionRuleResourceKind { - return []KnownDataCollectionRuleResourceKind{ - KnownDataCollectionRuleResourceKindLinux, - KnownDataCollectionRuleResourceKindWindows, - } -} - -type KnownDataFlowStreams string - -const ( - KnownDataFlowStreamsMicrosoftEvent KnownDataFlowStreams = "Microsoft-Event" - KnownDataFlowStreamsMicrosoftInsightsMetrics KnownDataFlowStreams = "Microsoft-InsightsMetrics" - KnownDataFlowStreamsMicrosoftPerf KnownDataFlowStreams = "Microsoft-Perf" - KnownDataFlowStreamsMicrosoftSyslog KnownDataFlowStreams = "Microsoft-Syslog" - KnownDataFlowStreamsMicrosoftWindowsEvent KnownDataFlowStreams = "Microsoft-WindowsEvent" -) - -// PossibleKnownDataFlowStreamsValues returns the possible values for the KnownDataFlowStreams const type. -func PossibleKnownDataFlowStreamsValues() []KnownDataFlowStreams { - return []KnownDataFlowStreams{ - KnownDataFlowStreamsMicrosoftEvent, - KnownDataFlowStreamsMicrosoftInsightsMetrics, - KnownDataFlowStreamsMicrosoftPerf, - KnownDataFlowStreamsMicrosoftSyslog, - KnownDataFlowStreamsMicrosoftWindowsEvent, - } -} - -type KnownExtensionDataSourceStreams string - -const ( - KnownExtensionDataSourceStreamsMicrosoftEvent KnownExtensionDataSourceStreams = "Microsoft-Event" - KnownExtensionDataSourceStreamsMicrosoftInsightsMetrics KnownExtensionDataSourceStreams = "Microsoft-InsightsMetrics" - KnownExtensionDataSourceStreamsMicrosoftPerf KnownExtensionDataSourceStreams = "Microsoft-Perf" - KnownExtensionDataSourceStreamsMicrosoftSyslog KnownExtensionDataSourceStreams = "Microsoft-Syslog" - KnownExtensionDataSourceStreamsMicrosoftWindowsEvent KnownExtensionDataSourceStreams = "Microsoft-WindowsEvent" -) - -// PossibleKnownExtensionDataSourceStreamsValues returns the possible values for the KnownExtensionDataSourceStreams const type. -func PossibleKnownExtensionDataSourceStreamsValues() []KnownExtensionDataSourceStreams { - return []KnownExtensionDataSourceStreams{ - KnownExtensionDataSourceStreamsMicrosoftEvent, - KnownExtensionDataSourceStreamsMicrosoftInsightsMetrics, - KnownExtensionDataSourceStreamsMicrosoftPerf, - KnownExtensionDataSourceStreamsMicrosoftSyslog, - KnownExtensionDataSourceStreamsMicrosoftWindowsEvent, - } -} - -// KnownLocationSpecProvisioningStatus - The resource provisioning state in this location. -type KnownLocationSpecProvisioningStatus string - -const ( - KnownLocationSpecProvisioningStatusCanceled KnownLocationSpecProvisioningStatus = "Canceled" - KnownLocationSpecProvisioningStatusCreating KnownLocationSpecProvisioningStatus = "Creating" - KnownLocationSpecProvisioningStatusDeleting KnownLocationSpecProvisioningStatus = "Deleting" - KnownLocationSpecProvisioningStatusFailed KnownLocationSpecProvisioningStatus = "Failed" - KnownLocationSpecProvisioningStatusSucceeded KnownLocationSpecProvisioningStatus = "Succeeded" - KnownLocationSpecProvisioningStatusUpdating KnownLocationSpecProvisioningStatus = "Updating" -) - -// PossibleKnownLocationSpecProvisioningStatusValues returns the possible values for the KnownLocationSpecProvisioningStatus const type. -func PossibleKnownLocationSpecProvisioningStatusValues() []KnownLocationSpecProvisioningStatus { - return []KnownLocationSpecProvisioningStatus{ - KnownLocationSpecProvisioningStatusCanceled, - KnownLocationSpecProvisioningStatusCreating, - KnownLocationSpecProvisioningStatusDeleting, - KnownLocationSpecProvisioningStatusFailed, - KnownLocationSpecProvisioningStatusSucceeded, - KnownLocationSpecProvisioningStatusUpdating, - } -} - -// KnownLogFileTextSettingsRecordStartTimestampFormat - One of the supported timestamp formats -type KnownLogFileTextSettingsRecordStartTimestampFormat string - -const ( - KnownLogFileTextSettingsRecordStartTimestampFormatDdMMMYyyyHHMmSsZzz KnownLogFileTextSettingsRecordStartTimestampFormat = "dd/MMM/yyyy:HH:mm:ss zzz" - KnownLogFileTextSettingsRecordStartTimestampFormatDdMMyyHHMmSs KnownLogFileTextSettingsRecordStartTimestampFormat = "ddMMyy HH:mm:ss" - KnownLogFileTextSettingsRecordStartTimestampFormatISO8601 KnownLogFileTextSettingsRecordStartTimestampFormat = "ISO 8601" - KnownLogFileTextSettingsRecordStartTimestampFormatMDYYYYHHMMSSAMPM KnownLogFileTextSettingsRecordStartTimestampFormat = "M/D/YYYY HH:MM:SS AM/PM" - KnownLogFileTextSettingsRecordStartTimestampFormatMMMDHhMmSs KnownLogFileTextSettingsRecordStartTimestampFormat = "MMM d hh:mm:ss" - KnownLogFileTextSettingsRecordStartTimestampFormatMonDDYYYYHHMMSS KnownLogFileTextSettingsRecordStartTimestampFormat = "Mon DD, YYYY HH:MM:SS" - KnownLogFileTextSettingsRecordStartTimestampFormatYYYYMMDDHHMMSS KnownLogFileTextSettingsRecordStartTimestampFormat = "YYYY-MM-DD HH:MM:SS" - KnownLogFileTextSettingsRecordStartTimestampFormatYyMMddHHMmSs KnownLogFileTextSettingsRecordStartTimestampFormat = "yyMMdd HH:mm:ss" - KnownLogFileTextSettingsRecordStartTimestampFormatYyyyMMDdTHHMmSsK KnownLogFileTextSettingsRecordStartTimestampFormat = "yyyy-MM-ddTHH:mm:ssK" -) - -// PossibleKnownLogFileTextSettingsRecordStartTimestampFormatValues returns the possible values for the KnownLogFileTextSettingsRecordStartTimestampFormat const type. -func PossibleKnownLogFileTextSettingsRecordStartTimestampFormatValues() []KnownLogFileTextSettingsRecordStartTimestampFormat { - return []KnownLogFileTextSettingsRecordStartTimestampFormat{ - KnownLogFileTextSettingsRecordStartTimestampFormatDdMMMYyyyHHMmSsZzz, - KnownLogFileTextSettingsRecordStartTimestampFormatDdMMyyHHMmSs, - KnownLogFileTextSettingsRecordStartTimestampFormatISO8601, - KnownLogFileTextSettingsRecordStartTimestampFormatMDYYYYHHMMSSAMPM, - KnownLogFileTextSettingsRecordStartTimestampFormatMMMDHhMmSs, - KnownLogFileTextSettingsRecordStartTimestampFormatMonDDYYYYHHMMSS, - KnownLogFileTextSettingsRecordStartTimestampFormatYYYYMMDDHHMMSS, - KnownLogFileTextSettingsRecordStartTimestampFormatYyMMddHHMmSs, - KnownLogFileTextSettingsRecordStartTimestampFormatYyyyMMDdTHHMmSsK, - } -} - -// KnownLogFilesDataSourceFormat - The data format of the log files -type KnownLogFilesDataSourceFormat string - -const ( - KnownLogFilesDataSourceFormatText KnownLogFilesDataSourceFormat = "text" -) - -// PossibleKnownLogFilesDataSourceFormatValues returns the possible values for the KnownLogFilesDataSourceFormat const type. -func PossibleKnownLogFilesDataSourceFormatValues() []KnownLogFilesDataSourceFormat { - return []KnownLogFilesDataSourceFormat{ - KnownLogFilesDataSourceFormatText, - } -} - -type KnownPerfCounterDataSourceStreams string - -const ( - KnownPerfCounterDataSourceStreamsMicrosoftInsightsMetrics KnownPerfCounterDataSourceStreams = "Microsoft-InsightsMetrics" - KnownPerfCounterDataSourceStreamsMicrosoftPerf KnownPerfCounterDataSourceStreams = "Microsoft-Perf" -) - -// PossibleKnownPerfCounterDataSourceStreamsValues returns the possible values for the KnownPerfCounterDataSourceStreams const type. -func PossibleKnownPerfCounterDataSourceStreamsValues() []KnownPerfCounterDataSourceStreams { - return []KnownPerfCounterDataSourceStreams{ - KnownPerfCounterDataSourceStreamsMicrosoftInsightsMetrics, - KnownPerfCounterDataSourceStreamsMicrosoftPerf, - } -} - -type KnownPrometheusForwarderDataSourceStreams string - -const ( - KnownPrometheusForwarderDataSourceStreamsMicrosoftPrometheusMetrics KnownPrometheusForwarderDataSourceStreams = "Microsoft-PrometheusMetrics" -) - -// PossibleKnownPrometheusForwarderDataSourceStreamsValues returns the possible values for the KnownPrometheusForwarderDataSourceStreams const type. -func PossibleKnownPrometheusForwarderDataSourceStreamsValues() []KnownPrometheusForwarderDataSourceStreams { - return []KnownPrometheusForwarderDataSourceStreams{ - KnownPrometheusForwarderDataSourceStreamsMicrosoftPrometheusMetrics, - } -} - -// KnownPublicNetworkAccessOptions - The configuration to set whether network access from public internet to the endpoints -// are allowed. -type KnownPublicNetworkAccessOptions string - -const ( - KnownPublicNetworkAccessOptionsDisabled KnownPublicNetworkAccessOptions = "Disabled" - KnownPublicNetworkAccessOptionsEnabled KnownPublicNetworkAccessOptions = "Enabled" - KnownPublicNetworkAccessOptionsSecuredByPerimeter KnownPublicNetworkAccessOptions = "SecuredByPerimeter" -) - -// PossibleKnownPublicNetworkAccessOptionsValues returns the possible values for the KnownPublicNetworkAccessOptions const type. -func PossibleKnownPublicNetworkAccessOptionsValues() []KnownPublicNetworkAccessOptions { - return []KnownPublicNetworkAccessOptions{ - KnownPublicNetworkAccessOptionsDisabled, - KnownPublicNetworkAccessOptionsEnabled, - KnownPublicNetworkAccessOptionsSecuredByPerimeter, - } -} - -type KnownSyslogDataSourceFacilityNames string - -const ( - KnownSyslogDataSourceFacilityNamesAsterisk KnownSyslogDataSourceFacilityNames = "*" - KnownSyslogDataSourceFacilityNamesAuth KnownSyslogDataSourceFacilityNames = "auth" - KnownSyslogDataSourceFacilityNamesAuthpriv KnownSyslogDataSourceFacilityNames = "authpriv" - KnownSyslogDataSourceFacilityNamesCron KnownSyslogDataSourceFacilityNames = "cron" - KnownSyslogDataSourceFacilityNamesDaemon KnownSyslogDataSourceFacilityNames = "daemon" - KnownSyslogDataSourceFacilityNamesKern KnownSyslogDataSourceFacilityNames = "kern" - KnownSyslogDataSourceFacilityNamesLocal0 KnownSyslogDataSourceFacilityNames = "local0" - KnownSyslogDataSourceFacilityNamesLocal1 KnownSyslogDataSourceFacilityNames = "local1" - KnownSyslogDataSourceFacilityNamesLocal2 KnownSyslogDataSourceFacilityNames = "local2" - KnownSyslogDataSourceFacilityNamesLocal3 KnownSyslogDataSourceFacilityNames = "local3" - KnownSyslogDataSourceFacilityNamesLocal4 KnownSyslogDataSourceFacilityNames = "local4" - KnownSyslogDataSourceFacilityNamesLocal5 KnownSyslogDataSourceFacilityNames = "local5" - KnownSyslogDataSourceFacilityNamesLocal6 KnownSyslogDataSourceFacilityNames = "local6" - KnownSyslogDataSourceFacilityNamesLocal7 KnownSyslogDataSourceFacilityNames = "local7" - KnownSyslogDataSourceFacilityNamesLpr KnownSyslogDataSourceFacilityNames = "lpr" - KnownSyslogDataSourceFacilityNamesMail KnownSyslogDataSourceFacilityNames = "mail" - KnownSyslogDataSourceFacilityNamesMark KnownSyslogDataSourceFacilityNames = "mark" - KnownSyslogDataSourceFacilityNamesNews KnownSyslogDataSourceFacilityNames = "news" - KnownSyslogDataSourceFacilityNamesSyslog KnownSyslogDataSourceFacilityNames = "syslog" - KnownSyslogDataSourceFacilityNamesUser KnownSyslogDataSourceFacilityNames = "user" - KnownSyslogDataSourceFacilityNamesUucp KnownSyslogDataSourceFacilityNames = "uucp" -) - -// PossibleKnownSyslogDataSourceFacilityNamesValues returns the possible values for the KnownSyslogDataSourceFacilityNames const type. -func PossibleKnownSyslogDataSourceFacilityNamesValues() []KnownSyslogDataSourceFacilityNames { - return []KnownSyslogDataSourceFacilityNames{ - KnownSyslogDataSourceFacilityNamesAsterisk, - KnownSyslogDataSourceFacilityNamesAuth, - KnownSyslogDataSourceFacilityNamesAuthpriv, - KnownSyslogDataSourceFacilityNamesCron, - KnownSyslogDataSourceFacilityNamesDaemon, - KnownSyslogDataSourceFacilityNamesKern, - KnownSyslogDataSourceFacilityNamesLocal0, - KnownSyslogDataSourceFacilityNamesLocal1, - KnownSyslogDataSourceFacilityNamesLocal2, - KnownSyslogDataSourceFacilityNamesLocal3, - KnownSyslogDataSourceFacilityNamesLocal4, - KnownSyslogDataSourceFacilityNamesLocal5, - KnownSyslogDataSourceFacilityNamesLocal6, - KnownSyslogDataSourceFacilityNamesLocal7, - KnownSyslogDataSourceFacilityNamesLpr, - KnownSyslogDataSourceFacilityNamesMail, - KnownSyslogDataSourceFacilityNamesMark, - KnownSyslogDataSourceFacilityNamesNews, - KnownSyslogDataSourceFacilityNamesSyslog, - KnownSyslogDataSourceFacilityNamesUser, - KnownSyslogDataSourceFacilityNamesUucp, - } -} - -type KnownSyslogDataSourceLogLevels string - -const ( - KnownSyslogDataSourceLogLevelsAlert KnownSyslogDataSourceLogLevels = "Alert" - KnownSyslogDataSourceLogLevelsAsterisk KnownSyslogDataSourceLogLevels = "*" - KnownSyslogDataSourceLogLevelsCritical KnownSyslogDataSourceLogLevels = "Critical" - KnownSyslogDataSourceLogLevelsDebug KnownSyslogDataSourceLogLevels = "Debug" - KnownSyslogDataSourceLogLevelsEmergency KnownSyslogDataSourceLogLevels = "Emergency" - KnownSyslogDataSourceLogLevelsError KnownSyslogDataSourceLogLevels = "Error" - KnownSyslogDataSourceLogLevelsInfo KnownSyslogDataSourceLogLevels = "Info" - KnownSyslogDataSourceLogLevelsNotice KnownSyslogDataSourceLogLevels = "Notice" - KnownSyslogDataSourceLogLevelsWarning KnownSyslogDataSourceLogLevels = "Warning" -) - -// PossibleKnownSyslogDataSourceLogLevelsValues returns the possible values for the KnownSyslogDataSourceLogLevels const type. -func PossibleKnownSyslogDataSourceLogLevelsValues() []KnownSyslogDataSourceLogLevels { - return []KnownSyslogDataSourceLogLevels{ - KnownSyslogDataSourceLogLevelsAlert, - KnownSyslogDataSourceLogLevelsAsterisk, - KnownSyslogDataSourceLogLevelsCritical, - KnownSyslogDataSourceLogLevelsDebug, - KnownSyslogDataSourceLogLevelsEmergency, - KnownSyslogDataSourceLogLevelsError, - KnownSyslogDataSourceLogLevelsInfo, - KnownSyslogDataSourceLogLevelsNotice, - KnownSyslogDataSourceLogLevelsWarning, - } -} - -type KnownSyslogDataSourceStreams string +// IncidentManagementService - The incident management service type +type IncidentManagementService string const ( - KnownSyslogDataSourceStreamsMicrosoftSyslog KnownSyslogDataSourceStreams = "Microsoft-Syslog" + IncidentManagementServiceIcm IncidentManagementService = "Icm" ) -// PossibleKnownSyslogDataSourceStreamsValues returns the possible values for the KnownSyslogDataSourceStreams const type. -func PossibleKnownSyslogDataSourceStreamsValues() []KnownSyslogDataSourceStreams { - return []KnownSyslogDataSourceStreams{ - KnownSyslogDataSourceStreamsMicrosoftSyslog, +// PossibleIncidentManagementServiceValues returns the possible values for the IncidentManagementService const type. +func PossibleIncidentManagementServiceValues() []IncidentManagementService { + return []IncidentManagementService{ + IncidentManagementServiceIcm, } } -type KnownWindowsEventLogDataSourceStreams string +// Kind - Indicates the type of scheduled query rule. The default is LogAlert. +type Kind string const ( - KnownWindowsEventLogDataSourceStreamsMicrosoftEvent KnownWindowsEventLogDataSourceStreams = "Microsoft-Event" - KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent KnownWindowsEventLogDataSourceStreams = "Microsoft-WindowsEvent" + KindLogAlert Kind = "LogAlert" + KindLogToMetric Kind = "LogToMetric" + KindSimpleLogAlert Kind = "SimpleLogAlert" ) -// PossibleKnownWindowsEventLogDataSourceStreamsValues returns the possible values for the KnownWindowsEventLogDataSourceStreams const type. -func PossibleKnownWindowsEventLogDataSourceStreamsValues() []KnownWindowsEventLogDataSourceStreams { - return []KnownWindowsEventLogDataSourceStreams{ - KnownWindowsEventLogDataSourceStreamsMicrosoftEvent, - KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent, +// PossibleKindValues returns the possible values for the Kind const type. +func PossibleKindValues() []Kind { + return []Kind{ + KindLogAlert, + KindLogToMetric, + KindSimpleLogAlert, } } @@ -771,321 +179,6 @@ func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { } } -// MetricAggregationType - the aggregation type of the metric. -type MetricAggregationType string - -const ( - MetricAggregationTypeAverage MetricAggregationType = "Average" - MetricAggregationTypeCount MetricAggregationType = "Count" - MetricAggregationTypeMaximum MetricAggregationType = "Maximum" - MetricAggregationTypeMinimum MetricAggregationType = "Minimum" - MetricAggregationTypeNone MetricAggregationType = "None" - MetricAggregationTypeTotal MetricAggregationType = "Total" -) - -// PossibleMetricAggregationTypeValues returns the possible values for the MetricAggregationType const type. -func PossibleMetricAggregationTypeValues() []MetricAggregationType { - return []MetricAggregationType{ - MetricAggregationTypeAverage, - MetricAggregationTypeCount, - MetricAggregationTypeMaximum, - MetricAggregationTypeMinimum, - MetricAggregationTypeNone, - MetricAggregationTypeTotal, - } -} - -// MetricClass - The class of the metric. -type MetricClass string - -const ( - MetricClassAvailability MetricClass = "Availability" - MetricClassErrors MetricClass = "Errors" - MetricClassLatency MetricClass = "Latency" - MetricClassSaturation MetricClass = "Saturation" - MetricClassTransactions MetricClass = "Transactions" -) - -// PossibleMetricClassValues returns the possible values for the MetricClass const type. -func PossibleMetricClassValues() []MetricClass { - return []MetricClass{ - MetricClassAvailability, - MetricClassErrors, - MetricClassLatency, - MetricClassSaturation, - MetricClassTransactions, - } -} - -// MetricResultType - Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's -// description for details. -type MetricResultType string - -const ( - MetricResultTypeData MetricResultType = "Data" - MetricResultTypeMetadata MetricResultType = "Metadata" -) - -// PossibleMetricResultTypeValues returns the possible values for the MetricResultType const type. -func PossibleMetricResultTypeValues() []MetricResultType { - return []MetricResultType{ - MetricResultTypeData, - MetricResultTypeMetadata, - } -} - -// MetricStatisticType - the metric statistic type. How the metrics from multiple instances are combined. -type MetricStatisticType string - -const ( - MetricStatisticTypeAverage MetricStatisticType = "Average" - MetricStatisticTypeCount MetricStatisticType = "Count" - MetricStatisticTypeMax MetricStatisticType = "Max" - MetricStatisticTypeMin MetricStatisticType = "Min" - MetricStatisticTypeSum MetricStatisticType = "Sum" -) - -// PossibleMetricStatisticTypeValues returns the possible values for the MetricStatisticType const type. -func PossibleMetricStatisticTypeValues() []MetricStatisticType { - return []MetricStatisticType{ - MetricStatisticTypeAverage, - MetricStatisticTypeCount, - MetricStatisticTypeMax, - MetricStatisticTypeMin, - MetricStatisticTypeSum, - } -} - -// MetricUnit - The unit of the metric. -type MetricUnit string - -const ( - MetricUnitBitsPerSecond MetricUnit = "BitsPerSecond" - MetricUnitByteSeconds MetricUnit = "ByteSeconds" - MetricUnitBytes MetricUnit = "Bytes" - MetricUnitBytesPerSecond MetricUnit = "BytesPerSecond" - MetricUnitCores MetricUnit = "Cores" - MetricUnitCount MetricUnit = "Count" - MetricUnitCountPerSecond MetricUnit = "CountPerSecond" - MetricUnitMilliCores MetricUnit = "MilliCores" - MetricUnitMilliSeconds MetricUnit = "MilliSeconds" - MetricUnitNanoCores MetricUnit = "NanoCores" - MetricUnitPercent MetricUnit = "Percent" - MetricUnitSeconds MetricUnit = "Seconds" - MetricUnitUnspecified MetricUnit = "Unspecified" -) - -// PossibleMetricUnitValues returns the possible values for the MetricUnit const type. -func PossibleMetricUnitValues() []MetricUnit { - return []MetricUnit{ - MetricUnitBitsPerSecond, - MetricUnitByteSeconds, - MetricUnitBytes, - MetricUnitBytesPerSecond, - MetricUnitCores, - MetricUnitCount, - MetricUnitCountPerSecond, - MetricUnitMilliCores, - MetricUnitMilliSeconds, - MetricUnitNanoCores, - MetricUnitPercent, - MetricUnitSeconds, - MetricUnitUnspecified, - } -} - -// NamespaceClassification - Kind of namespace -type NamespaceClassification string - -const ( - NamespaceClassificationCustom NamespaceClassification = "Custom" - NamespaceClassificationPlatform NamespaceClassification = "Platform" - NamespaceClassificationQos NamespaceClassification = "Qos" -) - -// PossibleNamespaceClassificationValues returns the possible values for the NamespaceClassification const type. -func PossibleNamespaceClassificationValues() []NamespaceClassification { - return []NamespaceClassification{ - NamespaceClassificationCustom, - NamespaceClassificationPlatform, - NamespaceClassificationQos, - } -} - -// Odatatype - specifies the type of the alert criteria. -type Odatatype string - -const ( - OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria Odatatype = "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria" - OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria Odatatype = "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria" - OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria Odatatype = "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria" -) - -// PossibleOdatatypeValues returns the possible values for the Odatatype const type. -func PossibleOdatatypeValues() []Odatatype { - return []Odatatype{ - OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria, - OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria, - OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria, - } -} - -// OnboardingStatus - The onboarding status for the resource. Note that, a higher level scope, e.g., resource group or subscription, -// is considered onboarded if at least one resource under it is onboarded. -type OnboardingStatus string - -const ( - OnboardingStatusNotOnboarded OnboardingStatus = "notOnboarded" - OnboardingStatusOnboarded OnboardingStatus = "onboarded" - OnboardingStatusUnknown OnboardingStatus = "unknown" -) - -// PossibleOnboardingStatusValues returns the possible values for the OnboardingStatus const type. -func PossibleOnboardingStatusValues() []OnboardingStatus { - return []OnboardingStatus{ - OnboardingStatusNotOnboarded, - OnboardingStatusOnboarded, - OnboardingStatusUnknown, - } -} - -// Operator - the criteria operator. -type Operator string - -const ( - OperatorEquals Operator = "Equals" - OperatorGreaterThan Operator = "GreaterThan" - OperatorGreaterThanOrEqual Operator = "GreaterThanOrEqual" - OperatorLessThan Operator = "LessThan" - OperatorLessThanOrEqual Operator = "LessThanOrEqual" -) - -// PossibleOperatorValues returns the possible values for the Operator const type. -func PossibleOperatorValues() []Operator { - return []Operator{ - OperatorEquals, - OperatorGreaterThan, - OperatorGreaterThanOrEqual, - OperatorLessThan, - OperatorLessThanOrEqual, - } -} - -// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default -// value is "user,system" -type Origin string - -const ( - OriginSystem Origin = "system" - OriginUser Origin = "user" - OriginUserSystem Origin = "user,system" -) - -// PossibleOriginValues returns the possible values for the Origin const type. -func PossibleOriginValues() []Origin { - return []Origin{ - OriginSystem, - OriginUser, - OriginUserSystem, - } -} - -// PredictiveAutoscalePolicyScaleMode - the predictive autoscale mode -type PredictiveAutoscalePolicyScaleMode string - -const ( - PredictiveAutoscalePolicyScaleModeDisabled PredictiveAutoscalePolicyScaleMode = "Disabled" - PredictiveAutoscalePolicyScaleModeEnabled PredictiveAutoscalePolicyScaleMode = "Enabled" - PredictiveAutoscalePolicyScaleModeForecastOnly PredictiveAutoscalePolicyScaleMode = "ForecastOnly" -) - -// PossiblePredictiveAutoscalePolicyScaleModeValues returns the possible values for the PredictiveAutoscalePolicyScaleMode const type. -func PossiblePredictiveAutoscalePolicyScaleModeValues() []PredictiveAutoscalePolicyScaleMode { - return []PredictiveAutoscalePolicyScaleMode{ - PredictiveAutoscalePolicyScaleModeDisabled, - PredictiveAutoscalePolicyScaleModeEnabled, - PredictiveAutoscalePolicyScaleModeForecastOnly, - } -} - -// PrivateEndpointConnectionProvisioningState - The current provisioning state. -type PrivateEndpointConnectionProvisioningState string - -const ( - PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" - PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" - PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" - PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" -) - -// PossiblePrivateEndpointConnectionProvisioningStateValues returns the possible values for the PrivateEndpointConnectionProvisioningState const type. -func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { - return []PrivateEndpointConnectionProvisioningState{ - PrivateEndpointConnectionProvisioningStateCreating, - PrivateEndpointConnectionProvisioningStateDeleting, - PrivateEndpointConnectionProvisioningStateFailed, - PrivateEndpointConnectionProvisioningStateSucceeded, - } -} - -// PrivateEndpointServiceConnectionStatus - The private endpoint connection status. -type PrivateEndpointServiceConnectionStatus string - -const ( - PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" - PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" - PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" -) - -// PossiblePrivateEndpointServiceConnectionStatusValues returns the possible values for the PrivateEndpointServiceConnectionStatus const type. -func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointServiceConnectionStatus { - return []PrivateEndpointServiceConnectionStatus{ - PrivateEndpointServiceConnectionStatusApproved, - PrivateEndpointServiceConnectionStatusPending, - PrivateEndpointServiceConnectionStatusRejected, - } -} - -// ProvisioningState - The provisioning state of the Azure Monitor workspace. Set to Succeeded if everything is healthy. -type ProvisioningState string - -const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" - ProvisioningStateDeleting ProvisioningState = "Deleting" - ProvisioningStateFailed ProvisioningState = "Failed" - ProvisioningStateSucceeded ProvisioningState = "Succeeded" -) - -// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. -func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ - ProvisioningStateCanceled, - ProvisioningStateCreating, - ProvisioningStateDeleting, - ProvisioningStateFailed, - ProvisioningStateSucceeded, - } -} - -// PublicNetworkAccess - This determines if traffic is allowed over public network. By default it is enabled. -type PublicNetworkAccess string - -const ( - PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" - PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" - PublicNetworkAccessSecuredByPerimeter PublicNetworkAccess = "SecuredByPerimeter" -) - -// PossiblePublicNetworkAccessValues returns the possible values for the PublicNetworkAccess const type. -func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { - return []PublicNetworkAccess{ - PublicNetworkAccessDisabled, - PublicNetworkAccessEnabled, - PublicNetworkAccessSecuredByPerimeter, - } -} - // ReceiverStatus - Indicates the status of the receiver. Receivers that are not Enabled will not receive any communications. type ReceiverStatus string @@ -1104,106 +197,6 @@ func PossibleReceiverStatusValues() []ReceiverStatus { } } -// RecurrenceFrequency - the recurrence frequency. How often the schedule profile should take effect. This value must be Week, -// meaning each week will have the same set of profiles. For example, to set a daily schedule, set -// schedule to every day of the week. The frequency property specifies that the schedule is repeated weekly. -type RecurrenceFrequency string - -const ( - RecurrenceFrequencyDay RecurrenceFrequency = "Day" - RecurrenceFrequencyHour RecurrenceFrequency = "Hour" - RecurrenceFrequencyMinute RecurrenceFrequency = "Minute" - RecurrenceFrequencyMonth RecurrenceFrequency = "Month" - RecurrenceFrequencyNone RecurrenceFrequency = "None" - RecurrenceFrequencySecond RecurrenceFrequency = "Second" - RecurrenceFrequencyWeek RecurrenceFrequency = "Week" - RecurrenceFrequencyYear RecurrenceFrequency = "Year" -) - -// PossibleRecurrenceFrequencyValues returns the possible values for the RecurrenceFrequency const type. -func PossibleRecurrenceFrequencyValues() []RecurrenceFrequency { - return []RecurrenceFrequency{ - RecurrenceFrequencyDay, - RecurrenceFrequencyHour, - RecurrenceFrequencyMinute, - RecurrenceFrequencyMonth, - RecurrenceFrequencyNone, - RecurrenceFrequencySecond, - RecurrenceFrequencyWeek, - RecurrenceFrequencyYear, - } -} - -type ResultType string - -const ( - ResultTypeData ResultType = "Data" - ResultTypeMetadata ResultType = "Metadata" -) - -// PossibleResultTypeValues returns the possible values for the ResultType const type. -func PossibleResultTypeValues() []ResultType { - return []ResultType{ - ResultTypeData, - ResultTypeMetadata, - } -} - -// ScaleDirection - the scale direction. Whether the scaling action increases or decreases the number of instances. -type ScaleDirection string - -const ( - ScaleDirectionDecrease ScaleDirection = "Decrease" - ScaleDirectionIncrease ScaleDirection = "Increase" - ScaleDirectionNone ScaleDirection = "None" -) - -// PossibleScaleDirectionValues returns the possible values for the ScaleDirection const type. -func PossibleScaleDirectionValues() []ScaleDirection { - return []ScaleDirection{ - ScaleDirectionDecrease, - ScaleDirectionIncrease, - ScaleDirectionNone, - } -} - -// ScaleRuleMetricDimensionOperationType - the dimension operator. Only 'Equals' and 'NotEquals' are supported. 'Equals' being -// equal to any of the values. 'NotEquals' being not equal to all of the values -type ScaleRuleMetricDimensionOperationType string - -const ( - ScaleRuleMetricDimensionOperationTypeEquals ScaleRuleMetricDimensionOperationType = "Equals" - ScaleRuleMetricDimensionOperationTypeNotEquals ScaleRuleMetricDimensionOperationType = "NotEquals" -) - -// PossibleScaleRuleMetricDimensionOperationTypeValues returns the possible values for the ScaleRuleMetricDimensionOperationType const type. -func PossibleScaleRuleMetricDimensionOperationTypeValues() []ScaleRuleMetricDimensionOperationType { - return []ScaleRuleMetricDimensionOperationType{ - ScaleRuleMetricDimensionOperationTypeEquals, - ScaleRuleMetricDimensionOperationTypeNotEquals, - } -} - -// ScaleType - the type of action that should occur when the scale rule fires. -type ScaleType string - -const ( - ScaleTypeChangeCount ScaleType = "ChangeCount" - ScaleTypeExactCount ScaleType = "ExactCount" - ScaleTypePercentChangeCount ScaleType = "PercentChangeCount" - ScaleTypeServiceAllowedNextValue ScaleType = "ServiceAllowedNextValue" -) - -// PossibleScaleTypeValues returns the possible values for the ScaleType const type. -func PossibleScaleTypeValues() []ScaleType { - return []ScaleType{ - ScaleTypeChangeCount, - ScaleTypeExactCount, - ScaleTypePercentChangeCount, - ScaleTypeServiceAllowedNextValue, - } -} - // TimeAggregation - Aggregation type. Relevant and required only for rules of the kind LogAlert. type TimeAggregation string @@ -1225,88 +218,3 @@ func PossibleTimeAggregationValues() []TimeAggregation { TimeAggregationTotal, } } - -// TimeAggregationOperator - Aggregation operators allowed in a rule. -type TimeAggregationOperator string - -const ( - TimeAggregationOperatorAverage TimeAggregationOperator = "Average" - TimeAggregationOperatorLast TimeAggregationOperator = "Last" - TimeAggregationOperatorMaximum TimeAggregationOperator = "Maximum" - TimeAggregationOperatorMinimum TimeAggregationOperator = "Minimum" - TimeAggregationOperatorTotal TimeAggregationOperator = "Total" -) - -// PossibleTimeAggregationOperatorValues returns the possible values for the TimeAggregationOperator const type. -func PossibleTimeAggregationOperatorValues() []TimeAggregationOperator { - return []TimeAggregationOperator{ - TimeAggregationOperatorAverage, - TimeAggregationOperatorLast, - TimeAggregationOperatorMaximum, - TimeAggregationOperatorMinimum, - TimeAggregationOperatorTotal, - } -} - -// TimeAggregationType - time aggregation type. How the data that is collected should be combined over time. The default value -// is Average. -type TimeAggregationType string - -const ( - TimeAggregationTypeAverage TimeAggregationType = "Average" - TimeAggregationTypeCount TimeAggregationType = "Count" - TimeAggregationTypeLast TimeAggregationType = "Last" - TimeAggregationTypeMaximum TimeAggregationType = "Maximum" - TimeAggregationTypeMinimum TimeAggregationType = "Minimum" - TimeAggregationTypeTotal TimeAggregationType = "Total" -) - -// PossibleTimeAggregationTypeValues returns the possible values for the TimeAggregationType const type. -func PossibleTimeAggregationTypeValues() []TimeAggregationType { - return []TimeAggregationType{ - TimeAggregationTypeAverage, - TimeAggregationTypeCount, - TimeAggregationTypeLast, - TimeAggregationTypeMaximum, - TimeAggregationTypeMinimum, - TimeAggregationTypeTotal, - } -} - -// Unit - The unit of the metric. -type Unit string - -const ( - UnitBitsPerSecond Unit = "BitsPerSecond" - UnitByteSeconds Unit = "ByteSeconds" - UnitBytes Unit = "Bytes" - UnitBytesPerSecond Unit = "BytesPerSecond" - UnitCores Unit = "Cores" - UnitCount Unit = "Count" - UnitCountPerSecond Unit = "CountPerSecond" - UnitMilliCores Unit = "MilliCores" - UnitMilliSeconds Unit = "MilliSeconds" - UnitNanoCores Unit = "NanoCores" - UnitPercent Unit = "Percent" - UnitSeconds Unit = "Seconds" - UnitUnspecified Unit = "Unspecified" -) - -// PossibleUnitValues returns the possible values for the Unit const type. -func PossibleUnitValues() []Unit { - return []Unit{ - UnitBitsPerSecond, - UnitByteSeconds, - UnitBytes, - UnitBytesPerSecond, - UnitCores, - UnitCount, - UnitCountPerSecond, - UnitMilliCores, - UnitMilliSeconds, - UnitNanoCores, - UnitPercent, - UnitSeconds, - UnitUnspecified, - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client.go deleted file mode 100644 index 7ec4fe0471b7..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client.go +++ /dev/null @@ -1,421 +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 armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// DataCollectionEndpointsClient contains the methods for the DataCollectionEndpoints group. -// Don't use this type directly, use NewDataCollectionEndpointsClient() instead. -type DataCollectionEndpointsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewDataCollectionEndpointsClient creates a new instance of DataCollectionEndpointsClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewDataCollectionEndpointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DataCollectionEndpointsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &DataCollectionEndpointsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Create - Creates or updates a data collection endpoint. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-06-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - dataCollectionEndpointName - The name of the data collection endpoint. The name is case insensitive. -// - options - DataCollectionEndpointsClientCreateOptions contains the optional parameters for the DataCollectionEndpointsClient.Create -// method. -func (client *DataCollectionEndpointsClient) Create(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientCreateOptions) (DataCollectionEndpointsClientCreateResponse, error) { - var err error - const operationName = "DataCollectionEndpointsClient.Create" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, dataCollectionEndpointName, options) - if err != nil { - return DataCollectionEndpointsClientCreateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DataCollectionEndpointsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return DataCollectionEndpointsClientCreateResponse{}, err - } - resp, err := client.createHandleResponse(httpResp) - return resp, err -} - -// createCreateRequest creates the Create request. -func (client *DataCollectionEndpointsClient) createCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if dataCollectionEndpointName == "" { - return nil, errors.New("parameter dataCollectionEndpointName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{dataCollectionEndpointName}", url.PathEscape(dataCollectionEndpointName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Body != nil { - if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// createHandleResponse handles the Create response. -func (client *DataCollectionEndpointsClient) createHandleResponse(resp *http.Response) (DataCollectionEndpointsClientCreateResponse, error) { - result := DataCollectionEndpointsClientCreateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionEndpointResource); err != nil { - return DataCollectionEndpointsClientCreateResponse{}, err - } - return result, nil -} - -// Delete - Deletes a data collection endpoint. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-06-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - dataCollectionEndpointName - The name of the data collection endpoint. The name is case insensitive. -// - options - DataCollectionEndpointsClientDeleteOptions contains the optional parameters for the DataCollectionEndpointsClient.Delete -// method. -func (client *DataCollectionEndpointsClient) Delete(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientDeleteOptions) (DataCollectionEndpointsClientDeleteResponse, error) { - var err error - const operationName = "DataCollectionEndpointsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, dataCollectionEndpointName, options) - if err != nil { - return DataCollectionEndpointsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DataCollectionEndpointsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return DataCollectionEndpointsClientDeleteResponse{}, err - } - return DataCollectionEndpointsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *DataCollectionEndpointsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if dataCollectionEndpointName == "" { - return nil, errors.New("parameter dataCollectionEndpointName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{dataCollectionEndpointName}", url.PathEscape(dataCollectionEndpointName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Returns the specified data collection endpoint. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-06-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - dataCollectionEndpointName - The name of the data collection endpoint. The name is case insensitive. -// - options - DataCollectionEndpointsClientGetOptions contains the optional parameters for the DataCollectionEndpointsClient.Get -// method. -func (client *DataCollectionEndpointsClient) Get(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientGetOptions) (DataCollectionEndpointsClientGetResponse, error) { - var err error - const operationName = "DataCollectionEndpointsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, dataCollectionEndpointName, options) - if err != nil { - return DataCollectionEndpointsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DataCollectionEndpointsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return DataCollectionEndpointsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *DataCollectionEndpointsClient) getCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if dataCollectionEndpointName == "" { - return nil, errors.New("parameter dataCollectionEndpointName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{dataCollectionEndpointName}", url.PathEscape(dataCollectionEndpointName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *DataCollectionEndpointsClient) getHandleResponse(resp *http.Response) (DataCollectionEndpointsClientGetResponse, error) { - result := DataCollectionEndpointsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionEndpointResource); err != nil { - return DataCollectionEndpointsClientGetResponse{}, err - } - return result, nil -} - -// NewListByResourceGroupPager - Lists all data collection endpoints in the specified resource group. -// -// Generated from API version 2022-06-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - options - DataCollectionEndpointsClientListByResourceGroupOptions contains the optional parameters for the DataCollectionEndpointsClient.NewListByResourceGroupPager -// method. -func (client *DataCollectionEndpointsClient) NewListByResourceGroupPager(resourceGroupName string, options *DataCollectionEndpointsClientListByResourceGroupOptions) *runtime.Pager[DataCollectionEndpointsClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[DataCollectionEndpointsClientListByResourceGroupResponse]{ - More: func(page DataCollectionEndpointsClientListByResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *DataCollectionEndpointsClientListByResourceGroupResponse) (DataCollectionEndpointsClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DataCollectionEndpointsClient.NewListByResourceGroupPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - }, nil) - if err != nil { - return DataCollectionEndpointsClientListByResourceGroupResponse{}, err - } - return client.listByResourceGroupHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *DataCollectionEndpointsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DataCollectionEndpointsClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *DataCollectionEndpointsClient) listByResourceGroupHandleResponse(resp *http.Response) (DataCollectionEndpointsClientListByResourceGroupResponse, error) { - result := DataCollectionEndpointsClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionEndpointResourceListResult); err != nil { - return DataCollectionEndpointsClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionPager - Lists all data collection endpoints in the specified subscription -// -// Generated from API version 2022-06-01 -// - options - DataCollectionEndpointsClientListBySubscriptionOptions contains the optional parameters for the DataCollectionEndpointsClient.NewListBySubscriptionPager -// method. -func (client *DataCollectionEndpointsClient) NewListBySubscriptionPager(options *DataCollectionEndpointsClientListBySubscriptionOptions) *runtime.Pager[DataCollectionEndpointsClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[DataCollectionEndpointsClientListBySubscriptionResponse]{ - More: func(page DataCollectionEndpointsClientListBySubscriptionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *DataCollectionEndpointsClientListBySubscriptionResponse) (DataCollectionEndpointsClientListBySubscriptionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DataCollectionEndpointsClient.NewListBySubscriptionPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listBySubscriptionCreateRequest(ctx, options) - }, nil) - if err != nil { - return DataCollectionEndpointsClientListBySubscriptionResponse{}, err - } - return client.listBySubscriptionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *DataCollectionEndpointsClient) listBySubscriptionCreateRequest(ctx context.Context, options *DataCollectionEndpointsClientListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionEndpoints" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *DataCollectionEndpointsClient) listBySubscriptionHandleResponse(resp *http.Response) (DataCollectionEndpointsClientListBySubscriptionResponse, error) { - result := DataCollectionEndpointsClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionEndpointResourceListResult); err != nil { - return DataCollectionEndpointsClientListBySubscriptionResponse{}, err - } - return result, nil -} - -// Update - Updates part of a data collection endpoint. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-06-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - dataCollectionEndpointName - The name of the data collection endpoint. The name is case insensitive. -// - options - DataCollectionEndpointsClientUpdateOptions contains the optional parameters for the DataCollectionEndpointsClient.Update -// method. -func (client *DataCollectionEndpointsClient) Update(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientUpdateOptions) (DataCollectionEndpointsClientUpdateResponse, error) { - var err error - const operationName = "DataCollectionEndpointsClient.Update" - 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, dataCollectionEndpointName, options) - if err != nil { - return DataCollectionEndpointsClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DataCollectionEndpointsClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return DataCollectionEndpointsClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *DataCollectionEndpointsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionEndpointsClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if dataCollectionEndpointName == "" { - return nil, errors.New("parameter dataCollectionEndpointName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{dataCollectionEndpointName}", url.PathEscape(dataCollectionEndpointName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Body != nil { - if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *DataCollectionEndpointsClient) updateHandleResponse(resp *http.Response) (DataCollectionEndpointsClientUpdateResponse, error) { - result := DataCollectionEndpointsClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionEndpointResource); err != nil { - return DataCollectionEndpointsClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client_example_test.go deleted file mode 100644 index 18d81e003a18..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionendpoints_client_example_test.go +++ /dev/null @@ -1,378 +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 armmonitor_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/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionEndpointsListByResourceGroup.json -func ExampleDataCollectionEndpointsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataCollectionEndpointsClient().NewListByResourceGroupPager("myResourceGroup", 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.DataCollectionEndpointResourceListResult = armmonitor.DataCollectionEndpointResourceListResult{ - // Value: []*armmonitor.DataCollectionEndpointResource{ - // { - // Name: to.Ptr("myCollectionEndpoint"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.control.monitor.azure.com"), - // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.ingest.monitor.azure.com"), - // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), - // }, - // }, - // SystemData: &armmonitor.DataCollectionEndpointResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // }, - // { - // Name: to.Ptr("herCollectionEndpoint"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/herCollectionEndpoint"), - // Location: to.Ptr("westus"), - // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ - // Endpoint: to.Ptr("https://hercollectionendpoint-xywz.eastus-1.control.monitor.azure.com"), - // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://hercollectionendpoint-xywz.eastus-1.ingest.monitor.azure.com"), - // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsDisabled), - // }, - // }, - // SystemData: &armmonitor.DataCollectionEndpointResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionEndpointsListBySubscription.json -func ExampleDataCollectionEndpointsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataCollectionEndpointsClient().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.DataCollectionEndpointResourceListResult = armmonitor.DataCollectionEndpointResourceListResult{ - // Value: []*armmonitor.DataCollectionEndpointResource{ - // { - // Name: to.Ptr("myCollectionEndpoint"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.control.monitor.azure.com"), - // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.ingest.monitor.azure.com"), - // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), - // }, - // }, - // SystemData: &armmonitor.DataCollectionEndpointResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // }, - // { - // Name: to.Ptr("herCollectionEndpoint"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/herResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/herCollectionEndpoint"), - // Location: to.Ptr("westus"), - // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ - // Endpoint: to.Ptr("https://hercollectionendpoint-xywz.eastus-1.control.monitor.azure.com"), - // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://hercollectionendpoint-xywz.eastus-1.ingest.monitor.azure.com"), - // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsDisabled), - // }, - // }, - // SystemData: &armmonitor.DataCollectionEndpointResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionEndpointsGet.json -func ExampleDataCollectionEndpointsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionEndpointsClient().Get(ctx, "myResourceGroup", "myCollectionEndpoint", 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.DataCollectionEndpointResource = armmonitor.DataCollectionEndpointResource{ - // Name: to.Ptr("myCollectionEndpoint"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.control.monitor.azure.com"), - // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.ingest.monitor.azure.com"), - // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), - // }, - // }, - // SystemData: &armmonitor.DataCollectionEndpointResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionEndpointsCreate.json -func ExampleDataCollectionEndpointsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionEndpointsClient().Create(ctx, "myResourceGroup", "myCollectionEndpoint", &armmonitor.DataCollectionEndpointsClientCreateOptions{Body: &armmonitor.DataCollectionEndpointResource{ - Location: to.Ptr("eastus"), - Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), - }, - }, - }, - }) - 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.DataCollectionEndpointResource = armmonitor.DataCollectionEndpointResource{ - // Name: to.Ptr("myCollectionEndpoint"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.control.monitor.azure.com"), - // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.ingest.monitor.azure.com"), - // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), - // }, - // }, - // SystemData: &armmonitor.DataCollectionEndpointResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionEndpointsUpdate.json -func ExampleDataCollectionEndpointsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionEndpointsClient().Update(ctx, "myResourceGroup", "myCollectionEndpoint", &armmonitor.DataCollectionEndpointsClientUpdateOptions{Body: &armmonitor.ResourceForUpdate{ - Tags: map[string]*string{ - "tag1": to.Ptr("A"), - "tag2": to.Ptr("B"), - "tag3": to.Ptr("C"), - }, - }, - }) - 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.DataCollectionEndpointResource = armmonitor.DataCollectionEndpointResource{ - // Name: to.Ptr("myCollectionEndpoint"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionEndpoints"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionEndpointResourceProperties{ - // ConfigurationAccess: &armmonitor.DataCollectionEndpointConfigurationAccess{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.control.monitor.azure.com"), - // }, - // LogsIngestion: &armmonitor.DataCollectionEndpointLogsIngestion{ - // Endpoint: to.Ptr("https://mycollectionendpoint-abcd.eastus-1.ingest.monitor.azure.com"), - // }, - // NetworkACLs: &armmonitor.DataCollectionEndpointNetworkACLs{ - // PublicNetworkAccess: to.Ptr(armmonitor.KnownPublicNetworkAccessOptionsEnabled), - // }, - // }, - // SystemData: &armmonitor.DataCollectionEndpointResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // "tag3": to.Ptr("C"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionEndpointsDelete.json -func ExampleDataCollectionEndpointsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDataCollectionEndpointsClient().Delete(ctx, "myResourceGroup", "myCollectionEndpoint", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client.go deleted file mode 100644 index 820b5876aabb..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client.go +++ /dev/null @@ -1,397 +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 armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// DataCollectionRuleAssociationsClient contains the methods for the DataCollectionRuleAssociations group. -// Don't use this type directly, use NewDataCollectionRuleAssociationsClient() instead. -type DataCollectionRuleAssociationsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewDataCollectionRuleAssociationsClient creates a new instance of DataCollectionRuleAssociationsClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewDataCollectionRuleAssociationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DataCollectionRuleAssociationsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &DataCollectionRuleAssociationsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Create - Creates or updates an association. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-06-01 -// - resourceURI - The identifier of the resource. -// - associationName - The name of the association. The name is case insensitive. -// - options - DataCollectionRuleAssociationsClientCreateOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.Create -// method. -func (client *DataCollectionRuleAssociationsClient) Create(ctx context.Context, resourceURI string, associationName string, options *DataCollectionRuleAssociationsClientCreateOptions) (DataCollectionRuleAssociationsClientCreateResponse, error) { - var err error - const operationName = "DataCollectionRuleAssociationsClient.Create" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceURI, associationName, options) - if err != nil { - return DataCollectionRuleAssociationsClientCreateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DataCollectionRuleAssociationsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return DataCollectionRuleAssociationsClientCreateResponse{}, err - } - resp, err := client.createHandleResponse(httpResp) - return resp, err -} - -// createCreateRequest creates the Create request. -func (client *DataCollectionRuleAssociationsClient) createCreateRequest(ctx context.Context, resourceURI string, associationName string, options *DataCollectionRuleAssociationsClientCreateOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - if associationName == "" { - return nil, errors.New("parameter associationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{associationName}", url.PathEscape(associationName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Body != nil { - if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// createHandleResponse handles the Create response. -func (client *DataCollectionRuleAssociationsClient) createHandleResponse(resp *http.Response) (DataCollectionRuleAssociationsClientCreateResponse, error) { - result := DataCollectionRuleAssociationsClientCreateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionRuleAssociationProxyOnlyResource); err != nil { - return DataCollectionRuleAssociationsClientCreateResponse{}, err - } - return result, nil -} - -// Delete - Deletes an association. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-06-01 -// - resourceURI - The identifier of the resource. -// - associationName - The name of the association. The name is case insensitive. -// - options - DataCollectionRuleAssociationsClientDeleteOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.Delete -// method. -func (client *DataCollectionRuleAssociationsClient) Delete(ctx context.Context, resourceURI string, associationName string, options *DataCollectionRuleAssociationsClientDeleteOptions) (DataCollectionRuleAssociationsClientDeleteResponse, error) { - var err error - const operationName = "DataCollectionRuleAssociationsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceURI, associationName, options) - if err != nil { - return DataCollectionRuleAssociationsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DataCollectionRuleAssociationsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return DataCollectionRuleAssociationsClientDeleteResponse{}, err - } - return DataCollectionRuleAssociationsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *DataCollectionRuleAssociationsClient) deleteCreateRequest(ctx context.Context, resourceURI string, associationName string, options *DataCollectionRuleAssociationsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - if associationName == "" { - return nil, errors.New("parameter associationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{associationName}", url.PathEscape(associationName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Returns the specified association. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-06-01 -// - resourceURI - The identifier of the resource. -// - associationName - The name of the association. The name is case insensitive. -// - options - DataCollectionRuleAssociationsClientGetOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.Get -// method. -func (client *DataCollectionRuleAssociationsClient) Get(ctx context.Context, resourceURI string, associationName string, options *DataCollectionRuleAssociationsClientGetOptions) (DataCollectionRuleAssociationsClientGetResponse, error) { - var err error - const operationName = "DataCollectionRuleAssociationsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceURI, associationName, options) - if err != nil { - return DataCollectionRuleAssociationsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DataCollectionRuleAssociationsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return DataCollectionRuleAssociationsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *DataCollectionRuleAssociationsClient) getCreateRequest(ctx context.Context, resourceURI string, associationName string, options *DataCollectionRuleAssociationsClientGetOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - if associationName == "" { - return nil, errors.New("parameter associationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{associationName}", url.PathEscape(associationName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *DataCollectionRuleAssociationsClient) getHandleResponse(resp *http.Response) (DataCollectionRuleAssociationsClientGetResponse, error) { - result := DataCollectionRuleAssociationsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionRuleAssociationProxyOnlyResource); err != nil { - return DataCollectionRuleAssociationsClientGetResponse{}, err - } - return result, nil -} - -// NewListByDataCollectionEndpointPager - Lists associations for the specified data collection endpoint. -// -// Generated from API version 2022-06-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - dataCollectionEndpointName - The name of the data collection endpoint. The name is case insensitive. -// - options - DataCollectionRuleAssociationsClientListByDataCollectionEndpointOptions contains the optional parameters for -// the DataCollectionRuleAssociationsClient.NewListByDataCollectionEndpointPager method. -func (client *DataCollectionRuleAssociationsClient) NewListByDataCollectionEndpointPager(resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionRuleAssociationsClientListByDataCollectionEndpointOptions) *runtime.Pager[DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse] { - return runtime.NewPager(runtime.PagingHandler[DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse]{ - More: func(page DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse) (DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DataCollectionRuleAssociationsClient.NewListByDataCollectionEndpointPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listByDataCollectionEndpointCreateRequest(ctx, resourceGroupName, dataCollectionEndpointName, options) - }, nil) - if err != nil { - return DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse{}, err - } - return client.listByDataCollectionEndpointHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByDataCollectionEndpointCreateRequest creates the ListByDataCollectionEndpoint request. -func (client *DataCollectionRuleAssociationsClient) listByDataCollectionEndpointCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *DataCollectionRuleAssociationsClientListByDataCollectionEndpointOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionEndpoints/{dataCollectionEndpointName}/associations" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if dataCollectionEndpointName == "" { - return nil, errors.New("parameter dataCollectionEndpointName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{dataCollectionEndpointName}", url.PathEscape(dataCollectionEndpointName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByDataCollectionEndpointHandleResponse handles the ListByDataCollectionEndpoint response. -func (client *DataCollectionRuleAssociationsClient) listByDataCollectionEndpointHandleResponse(resp *http.Response) (DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse, error) { - result := DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionRuleAssociationProxyOnlyResourceListResult); err != nil { - return DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse{}, err - } - return result, nil -} - -// NewListByResourcePager - Lists associations for the specified resource. -// -// Generated from API version 2022-06-01 -// - resourceURI - The identifier of the resource. -// - options - DataCollectionRuleAssociationsClientListByResourceOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.NewListByResourcePager -// method. -func (client *DataCollectionRuleAssociationsClient) NewListByResourcePager(resourceURI string, options *DataCollectionRuleAssociationsClientListByResourceOptions) *runtime.Pager[DataCollectionRuleAssociationsClientListByResourceResponse] { - return runtime.NewPager(runtime.PagingHandler[DataCollectionRuleAssociationsClientListByResourceResponse]{ - More: func(page DataCollectionRuleAssociationsClientListByResourceResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *DataCollectionRuleAssociationsClientListByResourceResponse) (DataCollectionRuleAssociationsClientListByResourceResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DataCollectionRuleAssociationsClient.NewListByResourcePager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listByResourceCreateRequest(ctx, resourceURI, options) - }, nil) - if err != nil { - return DataCollectionRuleAssociationsClientListByResourceResponse{}, err - } - return client.listByResourceHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByResourceCreateRequest creates the ListByResource request. -func (client *DataCollectionRuleAssociationsClient) listByResourceCreateRequest(ctx context.Context, resourceURI string, options *DataCollectionRuleAssociationsClientListByResourceOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceHandleResponse handles the ListByResource response. -func (client *DataCollectionRuleAssociationsClient) listByResourceHandleResponse(resp *http.Response) (DataCollectionRuleAssociationsClientListByResourceResponse, error) { - result := DataCollectionRuleAssociationsClientListByResourceResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionRuleAssociationProxyOnlyResourceListResult); err != nil { - return DataCollectionRuleAssociationsClientListByResourceResponse{}, err - } - return result, nil -} - -// NewListByRulePager - Lists associations for the specified data collection rule. -// -// Generated from API version 2022-06-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - dataCollectionRuleName - The name of the data collection rule. The name is case insensitive. -// - options - DataCollectionRuleAssociationsClientListByRuleOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.NewListByRulePager -// method. -func (client *DataCollectionRuleAssociationsClient) NewListByRulePager(resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRuleAssociationsClientListByRuleOptions) *runtime.Pager[DataCollectionRuleAssociationsClientListByRuleResponse] { - return runtime.NewPager(runtime.PagingHandler[DataCollectionRuleAssociationsClientListByRuleResponse]{ - More: func(page DataCollectionRuleAssociationsClientListByRuleResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *DataCollectionRuleAssociationsClientListByRuleResponse) (DataCollectionRuleAssociationsClientListByRuleResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DataCollectionRuleAssociationsClient.NewListByRulePager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listByRuleCreateRequest(ctx, resourceGroupName, dataCollectionRuleName, options) - }, nil) - if err != nil { - return DataCollectionRuleAssociationsClientListByRuleResponse{}, err - } - return client.listByRuleHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByRuleCreateRequest creates the ListByRule request. -func (client *DataCollectionRuleAssociationsClient) listByRuleCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRuleAssociationsClientListByRuleOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}/associations" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if dataCollectionRuleName == "" { - return nil, errors.New("parameter dataCollectionRuleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{dataCollectionRuleName}", url.PathEscape(dataCollectionRuleName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByRuleHandleResponse handles the ListByRule response. -func (client *DataCollectionRuleAssociationsClient) listByRuleHandleResponse(resp *http.Response) (DataCollectionRuleAssociationsClientListByRuleResponse, error) { - result := DataCollectionRuleAssociationsClientListByRuleResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionRuleAssociationProxyOnlyResourceListResult); err != nil { - return DataCollectionRuleAssociationsClientListByRuleResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client_example_test.go deleted file mode 100644 index 75d9d8aacedc..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionruleassociations_client_example_test.go +++ /dev/null @@ -1,291 +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 armmonitor_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/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRuleAssociationsListByResource.json -func ExampleDataCollectionRuleAssociationsClient_NewListByResourcePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataCollectionRuleAssociationsClient().NewListByResourcePager("subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", 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.DataCollectionRuleAssociationProxyOnlyResourceListResult = armmonitor.DataCollectionRuleAssociationProxyOnlyResourceListResult{ - // Value: []*armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ - // { - // Name: to.Ptr("myRuleAssociation"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/myRuleAssociation"), - // Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - // DataCollectionRuleID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleAssociationProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("herRuleAssociation"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), - // Etag: to.Ptr("3afa167b-3255-432b-b66d-e74a348468af"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/herRuleAssociation"), - // Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - // DataCollectionRuleID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/herCollectionRule"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleAssociationProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("myEndpointAssociation"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), - // Etag: to.Ptr("562d96b1-29e9-4250-b2fd-8bebfdf77a9d"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/myEndpointAssociation"), - // Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - // DataCollectionEndpointID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionEndpoints/myCollectionEndpoint"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleAssociationProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRuleAssociationsListByRule.json -func ExampleDataCollectionRuleAssociationsClient_NewListByRulePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataCollectionRuleAssociationsClient().NewListByRulePager("myResourceGroup", "myCollectionRule", 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.DataCollectionRuleAssociationProxyOnlyResourceListResult = armmonitor.DataCollectionRuleAssociationProxyOnlyResourceListResult{ - // Value: []*armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ - // { - // Name: to.Ptr("myAssociation"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/myAssociation"), - // Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - // DataCollectionRuleID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleAssociationProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRuleAssociationsListByDataCollectionEndpoint.json -func ExampleDataCollectionRuleAssociationsClient_NewListByDataCollectionEndpointPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataCollectionRuleAssociationsClient().NewListByDataCollectionEndpointPager("myResourceGroup", "myDataCollectionEndpointName", 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.DataCollectionRuleAssociationProxyOnlyResourceListResult = armmonitor.DataCollectionRuleAssociationProxyOnlyResourceListResult{ - // Value: []*armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ - // { - // Name: to.Ptr("myAssociation"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/myAssociation"), - // Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - // DataCollectionRuleID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleAssociationProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRuleAssociationsGet.json -func ExampleDataCollectionRuleAssociationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionRuleAssociationsClient().Get(ctx, "subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", "myAssociation", 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.DataCollectionRuleAssociationProxyOnlyResource = armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ - // Name: to.Ptr("myAssociation"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/myAssociation"), - // Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - // DataCollectionRuleID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleAssociationProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRuleAssociationsCreate.json -func ExampleDataCollectionRuleAssociationsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionRuleAssociationsClient().Create(ctx, "subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", "myAssociation", &armmonitor.DataCollectionRuleAssociationsClientCreateOptions{Body: &armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ - Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - DataCollectionRuleID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - }, - }, - }) - 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.DataCollectionRuleAssociationProxyOnlyResource = armmonitor.DataCollectionRuleAssociationProxyOnlyResource{ - // Name: to.Ptr("myAssociation"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRuleAssociations"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm/providers/Microsoft.Insights/dataCollectionRuleAssociations/myAssociation"), - // Properties: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceProperties{ - // DataCollectionRuleID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleAssociationProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleAssociationProxyOnlyResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRuleAssociationsDelete.json -func ExampleDataCollectionRuleAssociationsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDataCollectionRuleAssociationsClient().Delete(ctx, "subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", "myAssociation", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client.go deleted file mode 100644 index bac67caf57ba..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client.go +++ /dev/null @@ -1,420 +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 armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// DataCollectionRulesClient contains the methods for the DataCollectionRules group. -// Don't use this type directly, use NewDataCollectionRulesClient() instead. -type DataCollectionRulesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewDataCollectionRulesClient creates a new instance of DataCollectionRulesClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewDataCollectionRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DataCollectionRulesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &DataCollectionRulesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Create - Creates or updates a data collection rule. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-06-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - dataCollectionRuleName - The name of the data collection rule. The name is case insensitive. -// - options - DataCollectionRulesClientCreateOptions contains the optional parameters for the DataCollectionRulesClient.Create -// method. -func (client *DataCollectionRulesClient) Create(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRulesClientCreateOptions) (DataCollectionRulesClientCreateResponse, error) { - var err error - const operationName = "DataCollectionRulesClient.Create" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, dataCollectionRuleName, options) - if err != nil { - return DataCollectionRulesClientCreateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DataCollectionRulesClientCreateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return DataCollectionRulesClientCreateResponse{}, err - } - resp, err := client.createHandleResponse(httpResp) - return resp, err -} - -// createCreateRequest creates the Create request. -func (client *DataCollectionRulesClient) createCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRulesClientCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if dataCollectionRuleName == "" { - return nil, errors.New("parameter dataCollectionRuleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{dataCollectionRuleName}", url.PathEscape(dataCollectionRuleName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Body != nil { - if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// createHandleResponse handles the Create response. -func (client *DataCollectionRulesClient) createHandleResponse(resp *http.Response) (DataCollectionRulesClientCreateResponse, error) { - result := DataCollectionRulesClientCreateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionRuleResource); err != nil { - return DataCollectionRulesClientCreateResponse{}, err - } - return result, nil -} - -// Delete - Deletes a data collection rule. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-06-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - dataCollectionRuleName - The name of the data collection rule. The name is case insensitive. -// - options - DataCollectionRulesClientDeleteOptions contains the optional parameters for the DataCollectionRulesClient.Delete -// method. -func (client *DataCollectionRulesClient) Delete(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRulesClientDeleteOptions) (DataCollectionRulesClientDeleteResponse, error) { - var err error - const operationName = "DataCollectionRulesClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, dataCollectionRuleName, options) - if err != nil { - return DataCollectionRulesClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DataCollectionRulesClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return DataCollectionRulesClientDeleteResponse{}, err - } - return DataCollectionRulesClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *DataCollectionRulesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRulesClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if dataCollectionRuleName == "" { - return nil, errors.New("parameter dataCollectionRuleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{dataCollectionRuleName}", url.PathEscape(dataCollectionRuleName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Returns the specified data collection rule. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-06-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - dataCollectionRuleName - The name of the data collection rule. The name is case insensitive. -// - options - DataCollectionRulesClientGetOptions contains the optional parameters for the DataCollectionRulesClient.Get method. -func (client *DataCollectionRulesClient) Get(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRulesClientGetOptions) (DataCollectionRulesClientGetResponse, error) { - var err error - const operationName = "DataCollectionRulesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, dataCollectionRuleName, options) - if err != nil { - return DataCollectionRulesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DataCollectionRulesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return DataCollectionRulesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *DataCollectionRulesClient) getCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRulesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if dataCollectionRuleName == "" { - return nil, errors.New("parameter dataCollectionRuleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{dataCollectionRuleName}", url.PathEscape(dataCollectionRuleName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *DataCollectionRulesClient) getHandleResponse(resp *http.Response) (DataCollectionRulesClientGetResponse, error) { - result := DataCollectionRulesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionRuleResource); err != nil { - return DataCollectionRulesClientGetResponse{}, err - } - return result, nil -} - -// NewListByResourceGroupPager - Lists all data collection rules in the specified resource group. -// -// Generated from API version 2022-06-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - options - DataCollectionRulesClientListByResourceGroupOptions contains the optional parameters for the DataCollectionRulesClient.NewListByResourceGroupPager -// method. -func (client *DataCollectionRulesClient) NewListByResourceGroupPager(resourceGroupName string, options *DataCollectionRulesClientListByResourceGroupOptions) *runtime.Pager[DataCollectionRulesClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[DataCollectionRulesClientListByResourceGroupResponse]{ - More: func(page DataCollectionRulesClientListByResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *DataCollectionRulesClientListByResourceGroupResponse) (DataCollectionRulesClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DataCollectionRulesClient.NewListByResourceGroupPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - }, nil) - if err != nil { - return DataCollectionRulesClientListByResourceGroupResponse{}, err - } - return client.listByResourceGroupHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *DataCollectionRulesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *DataCollectionRulesClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *DataCollectionRulesClient) listByResourceGroupHandleResponse(resp *http.Response) (DataCollectionRulesClientListByResourceGroupResponse, error) { - result := DataCollectionRulesClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionRuleResourceListResult); err != nil { - return DataCollectionRulesClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionPager - Lists all data collection rules in the specified subscription. -// -// Generated from API version 2022-06-01 -// - options - DataCollectionRulesClientListBySubscriptionOptions contains the optional parameters for the DataCollectionRulesClient.NewListBySubscriptionPager -// method. -func (client *DataCollectionRulesClient) NewListBySubscriptionPager(options *DataCollectionRulesClientListBySubscriptionOptions) *runtime.Pager[DataCollectionRulesClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[DataCollectionRulesClientListBySubscriptionResponse]{ - More: func(page DataCollectionRulesClientListBySubscriptionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *DataCollectionRulesClientListBySubscriptionResponse) (DataCollectionRulesClientListBySubscriptionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DataCollectionRulesClient.NewListBySubscriptionPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listBySubscriptionCreateRequest(ctx, options) - }, nil) - if err != nil { - return DataCollectionRulesClientListBySubscriptionResponse{}, err - } - return client.listBySubscriptionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *DataCollectionRulesClient) listBySubscriptionCreateRequest(ctx context.Context, options *DataCollectionRulesClientListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *DataCollectionRulesClient) listBySubscriptionHandleResponse(resp *http.Response) (DataCollectionRulesClientListBySubscriptionResponse, error) { - result := DataCollectionRulesClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionRuleResourceListResult); err != nil { - return DataCollectionRulesClientListBySubscriptionResponse{}, err - } - return result, nil -} - -// Update - Updates part of a data collection rule. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-06-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - dataCollectionRuleName - The name of the data collection rule. The name is case insensitive. -// - options - DataCollectionRulesClientUpdateOptions contains the optional parameters for the DataCollectionRulesClient.Update -// method. -func (client *DataCollectionRulesClient) Update(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRulesClientUpdateOptions) (DataCollectionRulesClientUpdateResponse, error) { - var err error - const operationName = "DataCollectionRulesClient.Update" - 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, dataCollectionRuleName, options) - if err != nil { - return DataCollectionRulesClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DataCollectionRulesClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return DataCollectionRulesClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *DataCollectionRulesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *DataCollectionRulesClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/dataCollectionRules/{dataCollectionRuleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if dataCollectionRuleName == "" { - return nil, errors.New("parameter dataCollectionRuleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{dataCollectionRuleName}", url.PathEscape(dataCollectionRuleName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-06-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Body != nil { - if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *DataCollectionRulesClient) updateHandleResponse(resp *http.Response) (DataCollectionRulesClientUpdateResponse, error) { - result := DataCollectionRulesClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionRuleResource); err != nil { - return DataCollectionRulesClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client_example_test.go deleted file mode 100644 index 34f152aaad68..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/datacollectionrules_client_example_test.go +++ /dev/null @@ -1,864 +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 armmonitor_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/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRulesListByResourceGroup.json -func ExampleDataCollectionRulesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataCollectionRulesClient().NewListByResourceGroupPager("myResourceGroup", 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.DataCollectionRuleResourceListResult = armmonitor.DataCollectionRuleResourceListResult{ - // Value: []*armmonitor.DataCollectionRuleResource{ - // { - // Name: to.Ptr("myCollectionRule"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRules"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionRuleResourceProperties{ - // DataFlows: []*armmonitor.DataFlow{ - // { - // Destinations: []*string{ - // to.Ptr("centralWorkspace")}, - // Streams: []*armmonitor.KnownDataFlowStreams{ - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftSyslog), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent)}, - // }}, - // DataSources: &armmonitor.DataCollectionRuleDataSources{ - // PerformanceCounters: []*armmonitor.PerfCounterDataSource{ - // { - // Name: to.Ptr("cloudTeamCoreCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Processor(_Total)\\% Processor Time"), - // to.Ptr("\\Memory\\Committed Bytes"), - // to.Ptr("\\LogicalDisk(_Total)\\Free Megabytes"), - // to.Ptr("\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](15), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }, - // { - // Name: to.Ptr("appTeamExtraCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Process(_Total)\\Thread Count")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](30), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }}, - // Syslog: []*armmonitor.SyslogDataSource{ - // { - // Name: to.Ptr("cronSyslog"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesCron)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsDebug), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }, - // { - // Name: to.Ptr("syslogBase"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesSyslog)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsAlert), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }}, - // WindowsEventLogs: []*armmonitor.WindowsEventLogDataSource{ - // { - // Name: to.Ptr("cloudSecurityTeamEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("Security!")}, - // }, - // { - // Name: to.Ptr("appTeam1AppEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("System![System[(Level = 1 or Level = 2 or Level = 3)]]"), - // to.Ptr("Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]")}, - // }}, - // }, - // Destinations: &armmonitor.DataCollectionRuleDestinations{ - // LogAnalytics: []*armmonitor.LogAnalyticsDestination{ - // { - // Name: to.Ptr("centralWorkspace"), - // WorkspaceID: to.Ptr("9ba8bc53-bd36-4156-8667-e983e7ae0e4f"), - // WorkspaceResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/centralTeamWorkspace"), - // }}, - // }, - // ImmutableID: to.Ptr("dcr-b74e0d383fc9415abaa584ec41adece3"), - // }, - // SystemData: &armmonitor.DataCollectionRuleResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // }, - // { - // Name: to.Ptr("herCollectionRule"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRules"), - // Etag: to.Ptr("3afa167b-3255-432b-b66d-e74a348468af"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/herCollectionRule"), - // Location: to.Ptr("westus"), - // Properties: &armmonitor.DataCollectionRuleResourceProperties{ - // DataFlows: []*armmonitor.DataFlow{ - // { - // Destinations: []*string{ - // to.Ptr("herWorkspace")}, - // Streams: []*armmonitor.KnownDataFlowStreams{ - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent)}, - // }}, - // DataSources: &armmonitor.DataCollectionRuleDataSources{ - // PerformanceCounters: []*armmonitor.PerfCounterDataSource{ - // { - // Name: to.Ptr("herPerfCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Processor(_Total)\\% Processor Time"), - // to.Ptr("\\LogicalDisk(_Total)\\Free Megabytes"), - // to.Ptr("\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](30), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }}, - // WindowsEventLogs: []*armmonitor.WindowsEventLogDataSource{ - // { - // Name: to.Ptr("herWindowsEventLogs"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("Security!*"), - // to.Ptr("System!*[System[(Level = 1 or Level = 2 or Level = 3)]]"), - // to.Ptr("Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]")}, - // }}, - // }, - // Destinations: &armmonitor.DataCollectionRuleDestinations{ - // LogAnalytics: []*armmonitor.LogAnalyticsDestination{ - // { - // Name: to.Ptr("herWorkspace"), - // WorkspaceID: to.Ptr("c49b982a-c4f7-40c4-bd13-d6588f1b4015"), - // WorkspaceResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/herResourceGroup/providers/Microsoft.OperationalInsights/workspaces/herTeamWorkspace"), - // }}, - // }, - // ImmutableID: to.Ptr("dcr-ca1e6d9dad844b2c94e7961c42af917a"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("C"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRulesListBySubscription.json -func ExampleDataCollectionRulesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataCollectionRulesClient().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.DataCollectionRuleResourceListResult = armmonitor.DataCollectionRuleResourceListResult{ - // Value: []*armmonitor.DataCollectionRuleResource{ - // { - // Name: to.Ptr("myCollectionRule"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRules"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionRuleResourceProperties{ - // DataFlows: []*armmonitor.DataFlow{ - // { - // Destinations: []*string{ - // to.Ptr("centralWorkspace")}, - // Streams: []*armmonitor.KnownDataFlowStreams{ - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftSyslog), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent)}, - // }}, - // DataSources: &armmonitor.DataCollectionRuleDataSources{ - // PerformanceCounters: []*armmonitor.PerfCounterDataSource{ - // { - // Name: to.Ptr("cloudTeamCoreCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Processor(_Total)\\% Processor Time"), - // to.Ptr("\\Memory\\Committed Bytes"), - // to.Ptr("\\LogicalDisk(_Total)\\Free Megabytes"), - // to.Ptr("\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](15), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }, - // { - // Name: to.Ptr("appTeamExtraCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Process(_Total)\\Thread Count")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](30), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }}, - // Syslog: []*armmonitor.SyslogDataSource{ - // { - // Name: to.Ptr("cronSyslog"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesCron)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsDebug), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }, - // { - // Name: to.Ptr("syslogBase"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesSyslog)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsAlert), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }}, - // WindowsEventLogs: []*armmonitor.WindowsEventLogDataSource{ - // { - // Name: to.Ptr("cloudSecurityTeamEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("Security!")}, - // }, - // { - // Name: to.Ptr("appTeam1AppEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("System![System[(Level = 1 or Level = 2 or Level = 3)]]"), - // to.Ptr("Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]")}, - // }}, - // }, - // Destinations: &armmonitor.DataCollectionRuleDestinations{ - // LogAnalytics: []*armmonitor.LogAnalyticsDestination{ - // { - // Name: to.Ptr("centralWorkspace"), - // WorkspaceID: to.Ptr("9ba8bc53-bd36-4156-8667-e983e7ae0e4f"), - // WorkspaceResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/centralTeamWorkspace"), - // }}, - // }, - // ImmutableID: to.Ptr("dcr-b74e0d383fc9415abaa584ec41adece3"), - // }, - // SystemData: &armmonitor.DataCollectionRuleResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // }, - // { - // Name: to.Ptr("herCollectionRule"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRules"), - // Etag: to.Ptr("3afa167b-3255-432b-b66d-e74a348468af"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/herResourceGroup/providers/Microsoft.Insights/dataCollectionRules/herCollectionRule"), - // Location: to.Ptr("westus"), - // Properties: &armmonitor.DataCollectionRuleResourceProperties{ - // DataFlows: []*armmonitor.DataFlow{ - // { - // Destinations: []*string{ - // to.Ptr("herWorkspace")}, - // Streams: []*armmonitor.KnownDataFlowStreams{ - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent)}, - // }}, - // DataSources: &armmonitor.DataCollectionRuleDataSources{ - // PerformanceCounters: []*armmonitor.PerfCounterDataSource{ - // { - // Name: to.Ptr("herPerfCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Processor(_Total)\\% Processor Time"), - // to.Ptr("\\LogicalDisk(_Total)\\Free Megabytes"), - // to.Ptr("\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](30), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }}, - // WindowsEventLogs: []*armmonitor.WindowsEventLogDataSource{ - // { - // Name: to.Ptr("herWindowsEventLogs"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("Security!*"), - // to.Ptr("System!*[System[(Level = 1 or Level = 2 or Level = 3)]]"), - // to.Ptr("Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]")}, - // }}, - // }, - // Destinations: &armmonitor.DataCollectionRuleDestinations{ - // LogAnalytics: []*armmonitor.LogAnalyticsDestination{ - // { - // Name: to.Ptr("herWorkspace"), - // WorkspaceID: to.Ptr("c49b982a-c4f7-40c4-bd13-d6588f1b4015"), - // WorkspaceResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/herResourceGroup/providers/Microsoft.OperationalInsights/workspaces/herTeamWorkspace"), - // }}, - // }, - // ImmutableID: to.Ptr("dcr-ca1e6d9dad844b2c94e7961c42af917a"), - // ProvisioningState: to.Ptr(armmonitor.KnownDataCollectionRuleProvisioningStateSucceeded), - // }, - // SystemData: &armmonitor.DataCollectionRuleResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("C"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRulesGet.json -func ExampleDataCollectionRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionRulesClient().Get(ctx, "myResourceGroup", "myCollectionRule", 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.DataCollectionRuleResource = armmonitor.DataCollectionRuleResource{ - // Name: to.Ptr("myCollectionRule"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRules"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionRuleResourceProperties{ - // DataFlows: []*armmonitor.DataFlow{ - // { - // Destinations: []*string{ - // to.Ptr("centralWorkspace")}, - // Streams: []*armmonitor.KnownDataFlowStreams{ - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftSyslog), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent)}, - // }}, - // DataSources: &armmonitor.DataCollectionRuleDataSources{ - // PerformanceCounters: []*armmonitor.PerfCounterDataSource{ - // { - // Name: to.Ptr("cloudTeamCoreCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Processor(_Total)\\% Processor Time"), - // to.Ptr("\\Memory\\Committed Bytes"), - // to.Ptr("\\LogicalDisk(_Total)\\Free Megabytes"), - // to.Ptr("\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](15), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }, - // { - // Name: to.Ptr("appTeamExtraCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Process(_Total)\\Thread Count")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](30), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }}, - // Syslog: []*armmonitor.SyslogDataSource{ - // { - // Name: to.Ptr("cronSyslog"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesCron)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsDebug), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }, - // { - // Name: to.Ptr("syslogBase"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesSyslog)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsAlert), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }}, - // WindowsEventLogs: []*armmonitor.WindowsEventLogDataSource{ - // { - // Name: to.Ptr("cloudSecurityTeamEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("Security!")}, - // }, - // { - // Name: to.Ptr("appTeam1AppEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("System![System[(Level = 1 or Level = 2 or Level = 3)]]"), - // to.Ptr("Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]")}, - // }}, - // }, - // Destinations: &armmonitor.DataCollectionRuleDestinations{ - // LogAnalytics: []*armmonitor.LogAnalyticsDestination{ - // { - // Name: to.Ptr("centralWorkspace"), - // WorkspaceID: to.Ptr("9ba8bc53-bd36-4156-8667-e983e7ae0e4f"), - // WorkspaceResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/centralTeamWorkspace"), - // }}, - // }, - // ImmutableID: to.Ptr("dcr-b74e0d383fc9415abaa584ec41adece3"), - // }, - // SystemData: &armmonitor.DataCollectionRuleResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRulesCreate.json -func ExampleDataCollectionRulesClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionRulesClient().Create(ctx, "myResourceGroup", "myCollectionRule", &armmonitor.DataCollectionRulesClientCreateOptions{Body: &armmonitor.DataCollectionRuleResource{ - Location: to.Ptr("eastus"), - Properties: &armmonitor.DataCollectionRuleResourceProperties{ - DataFlows: []*armmonitor.DataFlow{ - { - Destinations: []*string{ - to.Ptr("centralWorkspace")}, - Streams: []*armmonitor.KnownDataFlowStreams{ - to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftSyslog), - to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent)}, - }}, - DataSources: &armmonitor.DataCollectionRuleDataSources{ - PerformanceCounters: []*armmonitor.PerfCounterDataSource{ - { - Name: to.Ptr("cloudTeamCoreCounters"), - CounterSpecifiers: []*string{ - to.Ptr("\\Processor(_Total)\\% Processor Time"), - to.Ptr("\\Memory\\Committed Bytes"), - to.Ptr("\\LogicalDisk(_Total)\\Free Megabytes"), - to.Ptr("\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")}, - SamplingFrequencyInSeconds: to.Ptr[int32](15), - Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - }, - { - Name: to.Ptr("appTeamExtraCounters"), - CounterSpecifiers: []*string{ - to.Ptr("\\Process(_Total)\\Thread Count")}, - SamplingFrequencyInSeconds: to.Ptr[int32](30), - Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - }}, - Syslog: []*armmonitor.SyslogDataSource{ - { - Name: to.Ptr("cronSyslog"), - FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesCron)}, - LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsDebug), - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - }, - { - Name: to.Ptr("syslogBase"), - FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesSyslog)}, - LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsAlert), - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - }}, - WindowsEventLogs: []*armmonitor.WindowsEventLogDataSource{ - { - Name: to.Ptr("cloudSecurityTeamEvents"), - Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - XPathQueries: []*string{ - to.Ptr("Security!")}, - }, - { - Name: to.Ptr("appTeam1AppEvents"), - Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - XPathQueries: []*string{ - to.Ptr("System![System[(Level = 1 or Level = 2 or Level = 3)]]"), - to.Ptr("Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]")}, - }}, - }, - Destinations: &armmonitor.DataCollectionRuleDestinations{ - LogAnalytics: []*armmonitor.LogAnalyticsDestination{ - { - Name: to.Ptr("centralWorkspace"), - WorkspaceResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/centralTeamWorkspace"), - }}, - }, - }, - }, - }) - 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.DataCollectionRuleResource = armmonitor.DataCollectionRuleResource{ - // Name: to.Ptr("myCollectionRule"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRules"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionRuleResourceProperties{ - // DataFlows: []*armmonitor.DataFlow{ - // { - // Destinations: []*string{ - // to.Ptr("centralWorkspace")}, - // Streams: []*armmonitor.KnownDataFlowStreams{ - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftSyslog), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent)}, - // }}, - // DataSources: &armmonitor.DataCollectionRuleDataSources{ - // PerformanceCounters: []*armmonitor.PerfCounterDataSource{ - // { - // Name: to.Ptr("cloudTeamCoreCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Processor(_Total)\\% Processor Time"), - // to.Ptr("\\Memory\\Committed Bytes"), - // to.Ptr("\\LogicalDisk(_Total)\\Free Megabytes"), - // to.Ptr("\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](15), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }, - // { - // Name: to.Ptr("appTeamExtraCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Process(_Total)\\Thread Count")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](30), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }}, - // Syslog: []*armmonitor.SyslogDataSource{ - // { - // Name: to.Ptr("cronSyslog"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesCron)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsDebug), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }, - // { - // Name: to.Ptr("syslogBase"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesSyslog)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsAlert), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }}, - // WindowsEventLogs: []*armmonitor.WindowsEventLogDataSource{ - // { - // Name: to.Ptr("cloudSecurityTeamEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("Security!")}, - // }, - // { - // Name: to.Ptr("appTeam1AppEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("System![System[(Level = 1 or Level = 2 or Level = 3)]]"), - // to.Ptr("Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]")}, - // }}, - // }, - // Destinations: &armmonitor.DataCollectionRuleDestinations{ - // LogAnalytics: []*armmonitor.LogAnalyticsDestination{ - // { - // Name: to.Ptr("centralWorkspace"), - // WorkspaceID: to.Ptr("9ba8bc53-bd36-4156-8667-e983e7ae0e4f"), - // WorkspaceResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/centralTeamWorkspace"), - // }}, - // }, - // ImmutableID: to.Ptr("dcr-b74e0d383fc9415abaa584ec41adece3"), - // }, - // SystemData: &armmonitor.DataCollectionRuleResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRulesUpdate.json -func ExampleDataCollectionRulesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataCollectionRulesClient().Update(ctx, "myResourceGroup", "myCollectionRule", &armmonitor.DataCollectionRulesClientUpdateOptions{Body: &armmonitor.ResourceForUpdate{ - Tags: map[string]*string{ - "tag1": to.Ptr("A"), - "tag2": to.Ptr("B"), - "tag3": to.Ptr("C"), - }, - }, - }) - 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.DataCollectionRuleResource = armmonitor.DataCollectionRuleResource{ - // Name: to.Ptr("myCollectionRule"), - // Type: to.Ptr("Microsoft.Insights/dataCollectionRules"), - // Etag: to.Ptr("070057da-0000-0000-0000-5ba70d6c0000"), - // ID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.DataCollectionRuleResourceProperties{ - // DataFlows: []*armmonitor.DataFlow{ - // { - // Destinations: []*string{ - // to.Ptr("centralWorkspace")}, - // Streams: []*armmonitor.KnownDataFlowStreams{ - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftPerf), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftSyslog), - // to.Ptr(armmonitor.KnownDataFlowStreamsMicrosoftWindowsEvent)}, - // }}, - // DataSources: &armmonitor.DataCollectionRuleDataSources{ - // PerformanceCounters: []*armmonitor.PerfCounterDataSource{ - // { - // Name: to.Ptr("cloudTeamCoreCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Processor(_Total)\\% Processor Time"), - // to.Ptr("\\Memory\\Committed Bytes"), - // to.Ptr("\\LogicalDisk(_Total)\\Free Megabytes"), - // to.Ptr("\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](15), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }, - // { - // Name: to.Ptr("appTeamExtraCounters"), - // CounterSpecifiers: []*string{ - // to.Ptr("\\Process(_Total)\\Thread Count")}, - // SamplingFrequencyInSeconds: to.Ptr[int32](30), - // Streams: []*armmonitor.KnownPerfCounterDataSourceStreams{ - // to.Ptr(armmonitor.KnownPerfCounterDataSourceStreamsMicrosoftPerf)}, - // }}, - // Syslog: []*armmonitor.SyslogDataSource{ - // { - // Name: to.Ptr("cronSyslog"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesCron)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsDebug), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }, - // { - // Name: to.Ptr("syslogBase"), - // FacilityNames: []*armmonitor.KnownSyslogDataSourceFacilityNames{ - // to.Ptr(armmonitor.KnownSyslogDataSourceFacilityNamesSyslog)}, - // LogLevels: []*armmonitor.KnownSyslogDataSourceLogLevels{ - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsAlert), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsCritical), - // to.Ptr(armmonitor.KnownSyslogDataSourceLogLevelsEmergency)}, - // Streams: []*armmonitor.KnownSyslogDataSourceStreams{ - // to.Ptr(armmonitor.KnownSyslogDataSourceStreamsMicrosoftSyslog)}, - // }}, - // WindowsEventLogs: []*armmonitor.WindowsEventLogDataSource{ - // { - // Name: to.Ptr("cloudSecurityTeamEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("Security!")}, - // }, - // { - // Name: to.Ptr("appTeam1AppEvents"), - // Streams: []*armmonitor.KnownWindowsEventLogDataSourceStreams{ - // to.Ptr(armmonitor.KnownWindowsEventLogDataSourceStreamsMicrosoftWindowsEvent)}, - // XPathQueries: []*string{ - // to.Ptr("System![System[(Level = 1 or Level = 2 or Level = 3)]]"), - // to.Ptr("Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]")}, - // }}, - // }, - // Destinations: &armmonitor.DataCollectionRuleDestinations{ - // LogAnalytics: []*armmonitor.LogAnalyticsDestination{ - // { - // Name: to.Ptr("centralWorkspace"), - // WorkspaceID: to.Ptr("9ba8bc53-bd36-4156-8667-e983e7ae0e4f"), - // WorkspaceResourceID: to.Ptr("/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/centralTeamWorkspace"), - // }}, - // }, - // ImmutableID: to.Ptr("dcr-b74e0d383fc9415abaa584ec41adece3"), - // }, - // SystemData: &armmonitor.DataCollectionRuleResourceSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-01T12:34:56.123Z"); return t}()), - // CreatedBy: to.Ptr("user1"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T12:34:56.123Z"); return t}()), - // LastModifiedBy: to.Ptr("user2"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // Tags: map[string]*string{ - // "tag1": to.Ptr("A"), - // "tag2": to.Ptr("B"), - // "tag3": to.Ptr("C"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/DataCollectionRulesDelete.json -func ExampleDataCollectionRulesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDataCollectionRulesClient().Delete(ctx, "myResourceGroup", "myCollectionRule", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client.go b/sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client.go deleted file mode 100644 index 38f727b02b43..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client.go +++ /dev/null @@ -1,262 +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 armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// DiagnosticSettingsClient contains the methods for the DiagnosticSettings group. -// Don't use this type directly, use NewDiagnosticSettingsClient() instead. -type DiagnosticSettingsClient struct { - internal *arm.Client -} - -// NewDiagnosticSettingsClient creates a new instance of DiagnosticSettingsClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewDiagnosticSettingsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*DiagnosticSettingsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &DiagnosticSettingsClient{ - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Creates or updates diagnostic settings for the specified resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-05-01-preview -// - resourceURI - The identifier of the resource. -// - name - The name of the diagnostic setting. -// - parameters - Parameters supplied to the operation. -// - options - DiagnosticSettingsClientCreateOrUpdateOptions contains the optional parameters for the DiagnosticSettingsClient.CreateOrUpdate -// method. -func (client *DiagnosticSettingsClient) CreateOrUpdate(ctx context.Context, resourceURI string, name string, parameters DiagnosticSettingsResource, options *DiagnosticSettingsClientCreateOrUpdateOptions) (DiagnosticSettingsClientCreateOrUpdateResponse, error) { - var err error - const operationName = "DiagnosticSettingsClient.CreateOrUpdate" - 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, resourceURI, name, parameters, options) - if err != nil { - return DiagnosticSettingsClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DiagnosticSettingsClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return DiagnosticSettingsClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *DiagnosticSettingsClient) createOrUpdateCreateRequest(ctx context.Context, resourceURI string, name string, parameters DiagnosticSettingsResource, options *DiagnosticSettingsClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - if name == "" { - return nil, errors.New("parameter name cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *DiagnosticSettingsClient) createOrUpdateHandleResponse(resp *http.Response) (DiagnosticSettingsClientCreateOrUpdateResponse, error) { - result := DiagnosticSettingsClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticSettingsResource); err != nil { - return DiagnosticSettingsClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Deletes existing diagnostic settings for the specified resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-05-01-preview -// - resourceURI - The identifier of the resource. -// - name - The name of the diagnostic setting. -// - options - DiagnosticSettingsClientDeleteOptions contains the optional parameters for the DiagnosticSettingsClient.Delete -// method. -func (client *DiagnosticSettingsClient) Delete(ctx context.Context, resourceURI string, name string, options *DiagnosticSettingsClientDeleteOptions) (DiagnosticSettingsClientDeleteResponse, error) { - var err error - const operationName = "DiagnosticSettingsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceURI, name, options) - if err != nil { - return DiagnosticSettingsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DiagnosticSettingsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return DiagnosticSettingsClientDeleteResponse{}, err - } - return DiagnosticSettingsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *DiagnosticSettingsClient) deleteCreateRequest(ctx context.Context, resourceURI string, name string, options *DiagnosticSettingsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - if name == "" { - return nil, errors.New("parameter name cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets the active diagnostic settings for the specified resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-05-01-preview -// - resourceURI - The identifier of the resource. -// - name - The name of the diagnostic setting. -// - options - DiagnosticSettingsClientGetOptions contains the optional parameters for the DiagnosticSettingsClient.Get method. -func (client *DiagnosticSettingsClient) Get(ctx context.Context, resourceURI string, name string, options *DiagnosticSettingsClientGetOptions) (DiagnosticSettingsClientGetResponse, error) { - var err error - const operationName = "DiagnosticSettingsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceURI, name, options) - if err != nil { - return DiagnosticSettingsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DiagnosticSettingsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return DiagnosticSettingsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *DiagnosticSettingsClient) getCreateRequest(ctx context.Context, resourceURI string, name string, options *DiagnosticSettingsClientGetOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - if name == "" { - return nil, errors.New("parameter name cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *DiagnosticSettingsClient) getHandleResponse(resp *http.Response) (DiagnosticSettingsClientGetResponse, error) { - result := DiagnosticSettingsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticSettingsResource); err != nil { - return DiagnosticSettingsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Gets the active diagnostic settings list for the specified resource. -// -// Generated from API version 2021-05-01-preview -// - resourceURI - The identifier of the resource. -// - options - DiagnosticSettingsClientListOptions contains the optional parameters for the DiagnosticSettingsClient.NewListPager -// method. -func (client *DiagnosticSettingsClient) NewListPager(resourceURI string, options *DiagnosticSettingsClientListOptions) *runtime.Pager[DiagnosticSettingsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[DiagnosticSettingsClientListResponse]{ - More: func(page DiagnosticSettingsClientListResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *DiagnosticSettingsClientListResponse) (DiagnosticSettingsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DiagnosticSettingsClient.NewListPager") - req, err := client.listCreateRequest(ctx, resourceURI, options) - if err != nil { - return DiagnosticSettingsClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DiagnosticSettingsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DiagnosticSettingsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *DiagnosticSettingsClient) listCreateRequest(ctx context.Context, resourceURI string, options *DiagnosticSettingsClientListOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *DiagnosticSettingsClient) listHandleResponse(resp *http.Response) (DiagnosticSettingsClientListResponse, error) { - result := DiagnosticSettingsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticSettingsResourceCollection); err != nil { - return DiagnosticSettingsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client_example_test.go deleted file mode 100644 index 6bfb57627706..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettings_client_example_test.go +++ /dev/null @@ -1,404 +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 armmonitor_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/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/getDiagnosticSetting.json -func ExampleDiagnosticSettingsClient_Get_getsTheDiagnosticSetting() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiagnosticSettingsClient().Get(ctx, "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", "mysetting", 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.DiagnosticSettingsResource = armmonitor.DiagnosticSettingsResource{ - // Name: to.Ptr("mysetting"), - // Type: to.Ptr("Microsoft.Insights/diagnosticSettings"), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/providers/microsoft.insights/diagnosticSettings/mysetting"), - // Properties: &armmonitor.DiagnosticSettings{ - // EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule"), - // Logs: []*armmonitor.LogSettings{ - // { - // CategoryGroup: to.Ptr("allLogs"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - // Metrics: []*armmonitor.MetricSettings{ - // { - // Category: to.Ptr("WorkflowMetrics"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - // WorkspaceID: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/getDiagnosticSettingCategory.json -func ExampleDiagnosticSettingsClient_Get_getsTheDiagnosticSettingForCategory() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiagnosticSettingsClient().Get(ctx, "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", "mysetting", 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.DiagnosticSettingsResource = armmonitor.DiagnosticSettingsResource{ - // Name: to.Ptr("mysetting"), - // Type: to.Ptr(""), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/diagnosticSettings/service"), - // Properties: &armmonitor.DiagnosticSettings{ - // EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule"), - // Logs: []*armmonitor.LogSettings{ - // { - // Category: to.Ptr("WorkflowRuntime"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - // Metrics: []*armmonitor.MetricSettings{ - // { - // Category: to.Ptr("WorkflowMetrics"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - // WorkspaceID: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/createOrUpdateDiagnosticSetting.json -func ExampleDiagnosticSettingsClient_CreateOrUpdate_createsOrUpdatesTheDiagnosticSetting() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiagnosticSettingsClient().CreateOrUpdate(ctx, "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", "mysetting", armmonitor.DiagnosticSettingsResource{ - Properties: &armmonitor.DiagnosticSettings{ - EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule"), - EventHubName: to.Ptr("myeventhub"), - LogAnalyticsDestinationType: to.Ptr("Dedicated"), - Logs: []*armmonitor.LogSettings{ - { - CategoryGroup: to.Ptr("allLogs"), - Enabled: to.Ptr(true), - RetentionPolicy: &armmonitor.RetentionPolicy{ - Days: to.Ptr[int32](0), - Enabled: to.Ptr(false), - }, - }}, - MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - Metrics: []*armmonitor.MetricSettings{ - { - Category: to.Ptr("WorkflowMetrics"), - Enabled: to.Ptr(true), - RetentionPolicy: &armmonitor.RetentionPolicy{ - Days: to.Ptr[int32](0), - Enabled: to.Ptr(false), - }, - }}, - StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - WorkspaceID: to.Ptr(""), - }, - }, 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.DiagnosticSettingsResource = armmonitor.DiagnosticSettingsResource{ - // Name: to.Ptr("mysetting"), - // Type: to.Ptr("Microsoft.Insights/diagnosticSettings"), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/providers/microsoft.insights/diagnosticSettings/mysetting"), - // Properties: &armmonitor.DiagnosticSettings{ - // EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule"), - // EventHubName: to.Ptr("myeventhub"), - // LogAnalyticsDestinationType: to.Ptr("Dedicated"), - // Logs: []*armmonitor.LogSettings{ - // { - // CategoryGroup: to.Ptr("allLogs"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - // Metrics: []*armmonitor.MetricSettings{ - // { - // Category: to.Ptr("WorkflowMetrics"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - // WorkspaceID: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/createOrUpdateDiagnosticSettingCategory.json -func ExampleDiagnosticSettingsClient_CreateOrUpdate_createsOrUpdatesTheDiagnosticSettingForCategory() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiagnosticSettingsClient().CreateOrUpdate(ctx, "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", "mysetting", armmonitor.DiagnosticSettingsResource{ - Properties: &armmonitor.DiagnosticSettings{ - EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule"), - EventHubName: to.Ptr("myeventhub"), - LogAnalyticsDestinationType: to.Ptr("Dedicated"), - Logs: []*armmonitor.LogSettings{ - { - Category: to.Ptr("WorkflowRuntime"), - Enabled: to.Ptr(true), - RetentionPolicy: &armmonitor.RetentionPolicy{ - Days: to.Ptr[int32](0), - Enabled: to.Ptr(false), - }, - }}, - MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - Metrics: []*armmonitor.MetricSettings{ - { - Category: to.Ptr("WorkflowMetrics"), - Enabled: to.Ptr(true), - RetentionPolicy: &armmonitor.RetentionPolicy{ - Days: to.Ptr[int32](0), - Enabled: to.Ptr(false), - }, - }}, - StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - WorkspaceID: to.Ptr(""), - }, - }, 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.DiagnosticSettingsResource = armmonitor.DiagnosticSettingsResource{ - // Name: to.Ptr("mysetting"), - // Type: to.Ptr(""), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/diagnosticSettings/mysetting"), - // Properties: &armmonitor.DiagnosticSettings{ - // EventHubAuthorizationRuleID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule"), - // EventHubName: to.Ptr("myeventhub"), - // LogAnalyticsDestinationType: to.Ptr("Dedicated"), - // Logs: []*armmonitor.LogSettings{ - // { - // Category: to.Ptr("WorkflowRuntime"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - // Metrics: []*armmonitor.MetricSettings{ - // { - // Category: to.Ptr("WorkflowMetrics"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - // WorkspaceID: to.Ptr(""), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/deleteDiagnosticSetting.json -func ExampleDiagnosticSettingsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDiagnosticSettingsClient().Delete(ctx, "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", "mysetting", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/listDiagnosticSettings.json -func ExampleDiagnosticSettingsClient_NewListPager_getsTheDiagnosticSetting() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiagnosticSettingsClient().NewListPager("subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", 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.DiagnosticSettingsResourceCollection = armmonitor.DiagnosticSettingsResourceCollection{ - // Value: []*armmonitor.DiagnosticSettingsResource{ - // { - // Name: to.Ptr("mysetting"), - // Type: to.Ptr("Microsoft.Insights/diagnosticSettings"), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/providers/microsoft.insights/diagnosticSettings/mysetting"), - // Properties: &armmonitor.DiagnosticSettings{ - // EventHubAuthorizationRuleID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/andy1101/providers/Microsoft.EventHub/namespaces/andy1101/authorizationrules/RootManageSharedAccessKey"), - // Logs: []*armmonitor.LogSettings{ - // { - // CategoryGroup: to.Ptr("allLogs"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - // Metrics: []*armmonitor.MetricSettings{ - // { - // Category: to.Ptr("WorkflowMetrics"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - // WorkspaceID: to.Ptr(""), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/listDiagnosticSettingsCategory.json -func ExampleDiagnosticSettingsClient_NewListPager_getsTheDiagnosticSettingForCategory() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiagnosticSettingsClient().NewListPager("subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", 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.DiagnosticSettingsResourceCollection = armmonitor.DiagnosticSettingsResourceCollection{ - // Value: []*armmonitor.DiagnosticSettingsResource{ - // { - // Name: to.Ptr("mysetting"), - // Type: to.Ptr("microsoft.logic/workflows"), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/diagnosticSettings/mysetting"), - // Properties: &armmonitor.DiagnosticSettings{ - // EventHubAuthorizationRuleID: to.Ptr("/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/andy1101/providers/Microsoft.EventHub/namespaces/andy1101/authorizationrules/RootManageSharedAccessKey"), - // Logs: []*armmonitor.LogSettings{ - // { - // Category: to.Ptr("WorkflowRuntime"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // MarketplacePartnerID: to.Ptr("/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1"), - // Metrics: []*armmonitor.MetricSettings{ - // { - // Category: to.Ptr("WorkflowMetrics"), - // Enabled: to.Ptr(true), - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](0), - // Enabled: to.Ptr(false), - // }, - // }}, - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1"), - // WorkspaceID: to.Ptr(""), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client.go b/sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client.go deleted file mode 100644 index e9a6fee568c2..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client.go +++ /dev/null @@ -1,153 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// DiagnosticSettingsCategoryClient contains the methods for the DiagnosticSettingsCategory group. -// Don't use this type directly, use NewDiagnosticSettingsCategoryClient() instead. -type DiagnosticSettingsCategoryClient struct { - internal *arm.Client -} - -// NewDiagnosticSettingsCategoryClient creates a new instance of DiagnosticSettingsCategoryClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewDiagnosticSettingsCategoryClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*DiagnosticSettingsCategoryClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &DiagnosticSettingsCategoryClient{ - internal: cl, - } - return client, nil -} - -// Get - Gets the diagnostic settings category for the specified resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-05-01-preview -// - resourceURI - The identifier of the resource. -// - name - The name of the diagnostic setting. -// - options - DiagnosticSettingsCategoryClientGetOptions contains the optional parameters for the DiagnosticSettingsCategoryClient.Get -// method. -func (client *DiagnosticSettingsCategoryClient) Get(ctx context.Context, resourceURI string, name string, options *DiagnosticSettingsCategoryClientGetOptions) (DiagnosticSettingsCategoryClientGetResponse, error) { - var err error - const operationName = "DiagnosticSettingsCategoryClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceURI, name, options) - if err != nil { - return DiagnosticSettingsCategoryClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DiagnosticSettingsCategoryClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return DiagnosticSettingsCategoryClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *DiagnosticSettingsCategoryClient) getCreateRequest(ctx context.Context, resourceURI string, name string, options *DiagnosticSettingsCategoryClientGetOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - if name == "" { - return nil, errors.New("parameter name cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *DiagnosticSettingsCategoryClient) getHandleResponse(resp *http.Response) (DiagnosticSettingsCategoryClientGetResponse, error) { - result := DiagnosticSettingsCategoryClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticSettingsCategoryResource); err != nil { - return DiagnosticSettingsCategoryClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Lists the diagnostic settings categories for the specified resource. -// -// Generated from API version 2021-05-01-preview -// - resourceURI - The identifier of the resource. -// - options - DiagnosticSettingsCategoryClientListOptions contains the optional parameters for the DiagnosticSettingsCategoryClient.NewListPager -// method. -func (client *DiagnosticSettingsCategoryClient) NewListPager(resourceURI string, options *DiagnosticSettingsCategoryClientListOptions) *runtime.Pager[DiagnosticSettingsCategoryClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[DiagnosticSettingsCategoryClientListResponse]{ - More: func(page DiagnosticSettingsCategoryClientListResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *DiagnosticSettingsCategoryClientListResponse) (DiagnosticSettingsCategoryClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DiagnosticSettingsCategoryClient.NewListPager") - req, err := client.listCreateRequest(ctx, resourceURI, options) - if err != nil { - return DiagnosticSettingsCategoryClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DiagnosticSettingsCategoryClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return DiagnosticSettingsCategoryClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *DiagnosticSettingsCategoryClient) listCreateRequest(ctx context.Context, resourceURI string, options *DiagnosticSettingsCategoryClientListOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *DiagnosticSettingsCategoryClient) listHandleResponse(resp *http.Response) (DiagnosticSettingsCategoryClientListResponse, error) { - result := DiagnosticSettingsCategoryClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticSettingsCategoryResourceCollection); err != nil { - return DiagnosticSettingsCategoryClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client_example_test.go deleted file mode 100644 index 4b667e1fa043..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/diagnosticsettingscategory_client_example_test.go +++ /dev/null @@ -1,94 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/getDiagnosticSettingsCategory.json -func ExampleDiagnosticSettingsCategoryClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDiagnosticSettingsCategoryClient().Get(ctx, "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", "WorkflowRuntime", 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.DiagnosticSettingsCategoryResource = armmonitor.DiagnosticSettingsCategoryResource{ - // Name: to.Ptr("WorkflowRuntime"), - // Type: to.Ptr("microsoft.insights/diagnosticSettingsCategories"), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/providers/microsoft.insights/diagnosticSettingsCategories/WorkflowRuntime"), - // Properties: &armmonitor.DiagnosticSettingsCategory{ - // CategoryGroups: []*string{ - // to.Ptr("allLogs")}, - // CategoryType: to.Ptr(armmonitor.CategoryTypeLogs), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/listDiagnosticSettingsCategories.json -func ExampleDiagnosticSettingsCategoryClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDiagnosticSettingsCategoryClient().NewListPager("subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", 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.DiagnosticSettingsCategoryResourceCollection = armmonitor.DiagnosticSettingsCategoryResourceCollection{ - // Value: []*armmonitor.DiagnosticSettingsCategoryResource{ - // { - // Name: to.Ptr("WorkflowRuntime"), - // Type: to.Ptr("microsoft.insights/diagnosticSettingsCategories"), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/providers/microsoft.insights/diagnosticSettingsCategories/WorkflowRuntime"), - // Properties: &armmonitor.DiagnosticSettingsCategory{ - // CategoryGroups: []*string{ - // to.Ptr("allLogs")}, - // CategoryType: to.Ptr(armmonitor.CategoryTypeLogs), - // }, - // }, - // { - // Name: to.Ptr("WorkflowMetric"), - // Type: to.Ptr("microsoft.insights/diagnosticSettingsCategories"), - // ID: to.Ptr("/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6/providers/microsoft.insights/diagnosticSettingsCategories/WorkflowMetric"), - // Properties: &armmonitor.DiagnosticSettingsCategory{ - // CategoryType: to.Ptr(armmonitor.CategoryTypeMetrics), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/eventcategories_client.go b/sdk/resourcemanager/monitor/armmonitor/eventcategories_client.go deleted file mode 100644 index d89ab8bca7fb..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/eventcategories_client.go +++ /dev/null @@ -1,91 +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 armmonitor - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" -) - -// EventCategoriesClient contains the methods for the EventCategories group. -// Don't use this type directly, use NewEventCategoriesClient() instead. -type EventCategoriesClient struct { - internal *arm.Client -} - -// NewEventCategoriesClient creates a new instance of EventCategoriesClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewEventCategoriesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*EventCategoriesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &EventCategoriesClient{ - internal: cl, - } - return client, nil -} - -// NewListPager - Get the list of available event categories supported in the Activity Logs Service. The current list includes -// the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. -// -// Generated from API version 2015-04-01 -// - options - EventCategoriesClientListOptions contains the optional parameters for the EventCategoriesClient.NewListPager -// method. -func (client *EventCategoriesClient) NewListPager(options *EventCategoriesClientListOptions) *runtime.Pager[EventCategoriesClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[EventCategoriesClientListResponse]{ - More: func(page EventCategoriesClientListResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *EventCategoriesClientListResponse) (EventCategoriesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EventCategoriesClient.NewListPager") - req, err := client.listCreateRequest(ctx, options) - if err != nil { - return EventCategoriesClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return EventCategoriesClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return EventCategoriesClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *EventCategoriesClient) listCreateRequest(ctx context.Context, options *EventCategoriesClientListOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Insights/eventcategories" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-04-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *EventCategoriesClient) listHandleResponse(resp *http.Response) (EventCategoriesClientListResponse, error) { - result := EventCategoriesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.EventCategoryCollection); err != nil { - return EventCategoriesClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/eventcategories_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/eventcategories_client_example_test.go deleted file mode 100644 index 765f747c362c..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/eventcategories_client_example_test.go +++ /dev/null @@ -1,54 +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 armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetEventCategories.json -func ExampleEventCategoriesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewEventCategoriesClient().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.EventCategoryCollection = armmonitor.EventCategoryCollection{ - // Value: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("category1"), - // Value: to.Ptr("category1"), - // }, - // { - // LocalizedValue: to.Ptr("category2"), - // Value: to.Ptr("category2"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/actiongroups_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/actiongroups_server.go index b9ce2adcbcc5..1fcce6a76839 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/actiongroups_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/actiongroups_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. @@ -89,37 +86,56 @@ func (a *ActionGroupsServerTransport) Do(req *http.Request) (*http.Response, err return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "ActionGroupsClient.BeginCreateNotificationsAtActionGroupResourceLevel": - resp, err = a.dispatchBeginCreateNotificationsAtActionGroupResourceLevel(req) - case "ActionGroupsClient.CreateOrUpdate": - resp, err = a.dispatchCreateOrUpdate(req) - case "ActionGroupsClient.Delete": - resp, err = a.dispatchDelete(req) - case "ActionGroupsClient.EnableReceiver": - resp, err = a.dispatchEnableReceiver(req) - case "ActionGroupsClient.Get": - resp, err = a.dispatchGet(req) - case "ActionGroupsClient.GetTestNotificationsAtActionGroupResourceLevel": - resp, err = a.dispatchGetTestNotificationsAtActionGroupResourceLevel(req) - case "ActionGroupsClient.NewListByResourceGroupPager": - resp, err = a.dispatchNewListByResourceGroupPager(req) - case "ActionGroupsClient.NewListBySubscriptionIDPager": - resp, err = a.dispatchNewListBySubscriptionIDPager(req) - case "ActionGroupsClient.Update": - resp, err = a.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return a.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (a *ActionGroupsServerTransport) 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 actionGroupsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = actionGroupsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ActionGroupsClient.BeginCreateNotificationsAtActionGroupResourceLevel": + res.resp, res.err = a.dispatchBeginCreateNotificationsAtActionGroupResourceLevel(req) + case "ActionGroupsClient.CreateOrUpdate": + res.resp, res.err = a.dispatchCreateOrUpdate(req) + case "ActionGroupsClient.Delete": + res.resp, res.err = a.dispatchDelete(req) + case "ActionGroupsClient.EnableReceiver": + res.resp, res.err = a.dispatchEnableReceiver(req) + case "ActionGroupsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "ActionGroupsClient.GetTestNotificationsAtActionGroupResourceLevel": + res.resp, res.err = a.dispatchGetTestNotificationsAtActionGroupResourceLevel(req) + case "ActionGroupsClient.NewListByResourceGroupPager": + res.resp, res.err = a.dispatchNewListByResourceGroupPager(req) + case "ActionGroupsClient.NewListBySubscriptionIDPager": + res.resp, res.err = a.dispatchNewListBySubscriptionIDPager(req) + case "ActionGroupsClient.Update": + res.resp, res.err = a.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *ActionGroupsServerTransport) dispatchBeginCreateNotificationsAtActionGroupResourceLevel(req *http.Request) (*http.Response, error) { @@ -447,3 +463,9 @@ func (a *ActionGroupsServerTransport) dispatchUpdate(req *http.Request) (*http.R } return resp, nil } + +// set this to conditionally intercept incoming requests to ActionGroupsServerTransport +var actionGroupsServerTransportInterceptor 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/monitor/armmonitor/fake/activitylogalerts_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/activitylogalerts_server.go deleted file mode 100644 index afa6587b1626..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/activitylogalerts_server.go +++ /dev/null @@ -1,314 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// ActivityLogAlertsServer is a fake server for instances of the armmonitor.ActivityLogAlertsClient type. -type ActivityLogAlertsServer struct { - // CreateOrUpdate is the fake for method ActivityLogAlertsClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - CreateOrUpdate func(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertRule armmonitor.ActivityLogAlertResource, options *armmonitor.ActivityLogAlertsClientCreateOrUpdateOptions) (resp azfake.Responder[armmonitor.ActivityLogAlertsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method ActivityLogAlertsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, activityLogAlertName string, options *armmonitor.ActivityLogAlertsClientDeleteOptions) (resp azfake.Responder[armmonitor.ActivityLogAlertsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ActivityLogAlertsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, activityLogAlertName string, options *armmonitor.ActivityLogAlertsClientGetOptions) (resp azfake.Responder[armmonitor.ActivityLogAlertsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByResourceGroupPager is the fake for method ActivityLogAlertsClient.NewListByResourceGroupPager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, options *armmonitor.ActivityLogAlertsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmonitor.ActivityLogAlertsClientListByResourceGroupResponse]) - - // NewListBySubscriptionIDPager is the fake for method ActivityLogAlertsClient.NewListBySubscriptionIDPager - // HTTP status codes to indicate success: http.StatusOK - NewListBySubscriptionIDPager func(options *armmonitor.ActivityLogAlertsClientListBySubscriptionIDOptions) (resp azfake.PagerResponder[armmonitor.ActivityLogAlertsClientListBySubscriptionIDResponse]) - - // Update is the fake for method ActivityLogAlertsClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, activityLogAlertName string, activityLogAlertRulePatch armmonitor.AlertRulePatchObject, options *armmonitor.ActivityLogAlertsClientUpdateOptions) (resp azfake.Responder[armmonitor.ActivityLogAlertsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewActivityLogAlertsServerTransport creates a new instance of ActivityLogAlertsServerTransport with the provided implementation. -// The returned ActivityLogAlertsServerTransport instance is connected to an instance of armmonitor.ActivityLogAlertsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewActivityLogAlertsServerTransport(srv *ActivityLogAlertsServer) *ActivityLogAlertsServerTransport { - return &ActivityLogAlertsServerTransport{ - srv: srv, - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmonitor.ActivityLogAlertsClientListByResourceGroupResponse]](), - newListBySubscriptionIDPager: newTracker[azfake.PagerResponder[armmonitor.ActivityLogAlertsClientListBySubscriptionIDResponse]](), - } -} - -// ActivityLogAlertsServerTransport connects instances of armmonitor.ActivityLogAlertsClient to instances of ActivityLogAlertsServer. -// Don't use this type directly, use NewActivityLogAlertsServerTransport instead. -type ActivityLogAlertsServerTransport struct { - srv *ActivityLogAlertsServer - newListByResourceGroupPager *tracker[azfake.PagerResponder[armmonitor.ActivityLogAlertsClientListByResourceGroupResponse]] - newListBySubscriptionIDPager *tracker[azfake.PagerResponder[armmonitor.ActivityLogAlertsClientListBySubscriptionIDResponse]] -} - -// Do implements the policy.Transporter interface for ActivityLogAlertsServerTransport. -func (a *ActivityLogAlertsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ActivityLogAlertsClient.CreateOrUpdate": - resp, err = a.dispatchCreateOrUpdate(req) - case "ActivityLogAlertsClient.Delete": - resp, err = a.dispatchDelete(req) - case "ActivityLogAlertsClient.Get": - resp, err = a.dispatchGet(req) - case "ActivityLogAlertsClient.NewListByResourceGroupPager": - resp, err = a.dispatchNewListByResourceGroupPager(req) - case "ActivityLogAlertsClient.NewListBySubscriptionIDPager": - resp, err = a.dispatchNewListBySubscriptionIDPager(req) - case "ActivityLogAlertsClient.Update": - resp, err = a.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *ActivityLogAlertsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if a.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/activityLogAlerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.ActivityLogAlertResource](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - activityLogAlertNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("activityLogAlertName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, activityLogAlertNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ActivityLogAlertResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *ActivityLogAlertsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if a.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/activityLogAlerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - activityLogAlertNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("activityLogAlertName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Delete(req.Context(), resourceGroupNameParam, activityLogAlertNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *ActivityLogAlertsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if a.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/activityLogAlerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - activityLogAlertNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("activityLogAlertName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, activityLogAlertNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ActivityLogAlertResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *ActivityLogAlertsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListByResourceGroupPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} - } - newListByResourceGroupPager := a.newListByResourceGroupPager.get(req) - if newListByResourceGroupPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/activityLogAlerts` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resp := a.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) - newListByResourceGroupPager = &resp - a.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armmonitor.ActivityLogAlertsClientListByResourceGroupResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListByResourceGroupPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByResourceGroupPager) { - a.newListByResourceGroupPager.remove(req) - } - return resp, nil -} - -func (a *ActivityLogAlertsServerTransport) dispatchNewListBySubscriptionIDPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListBySubscriptionIDPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionIDPager not implemented")} - } - newListBySubscriptionIDPager := a.newListBySubscriptionIDPager.get(req) - if newListBySubscriptionIDPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/activityLogAlerts` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := a.srv.NewListBySubscriptionIDPager(nil) - newListBySubscriptionIDPager = &resp - a.newListBySubscriptionIDPager.add(req, newListBySubscriptionIDPager) - server.PagerResponderInjectNextLinks(newListBySubscriptionIDPager, req, func(page *armmonitor.ActivityLogAlertsClientListBySubscriptionIDResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListBySubscriptionIDPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListBySubscriptionIDPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListBySubscriptionIDPager) { - a.newListBySubscriptionIDPager.remove(req) - } - return resp, nil -} - -func (a *ActivityLogAlertsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if a.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/activityLogAlerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.AlertRulePatchObject](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - activityLogAlertNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("activityLogAlertName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Update(req.Context(), resourceGroupNameParam, activityLogAlertNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ActivityLogAlertResource, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/activitylogs_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/activitylogs_server.go deleted file mode 100644 index c4ee8d74974b..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/activitylogs_server.go +++ /dev/null @@ -1,120 +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 ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// ActivityLogsServer is a fake server for instances of the armmonitor.ActivityLogsClient type. -type ActivityLogsServer struct { - // NewListPager is the fake for method ActivityLogsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(filter string, options *armmonitor.ActivityLogsClientListOptions) (resp azfake.PagerResponder[armmonitor.ActivityLogsClientListResponse]) -} - -// NewActivityLogsServerTransport creates a new instance of ActivityLogsServerTransport with the provided implementation. -// The returned ActivityLogsServerTransport instance is connected to an instance of armmonitor.ActivityLogsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewActivityLogsServerTransport(srv *ActivityLogsServer) *ActivityLogsServerTransport { - return &ActivityLogsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armmonitor.ActivityLogsClientListResponse]](), - } -} - -// ActivityLogsServerTransport connects instances of armmonitor.ActivityLogsClient to instances of ActivityLogsServer. -// Don't use this type directly, use NewActivityLogsServerTransport instead. -type ActivityLogsServerTransport struct { - srv *ActivityLogsServer - newListPager *tracker[azfake.PagerResponder[armmonitor.ActivityLogsClientListResponse]] -} - -// Do implements the policy.Transporter interface for ActivityLogsServerTransport. -func (a *ActivityLogsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ActivityLogsClient.NewListPager": - resp, err = a.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *ActivityLogsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := a.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/eventtypes/management/values` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - filterParam, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - selectUnescaped, err := url.QueryUnescape(qp.Get("$select")) - if err != nil { - return nil, err - } - selectParam := getOptional(selectUnescaped) - var options *armmonitor.ActivityLogsClientListOptions - if selectParam != nil { - options = &armmonitor.ActivityLogsClientListOptions{ - Select: selectParam, - } - } - resp := a.srv.NewListPager(filterParam, options) - newListPager = &resp - a.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armmonitor.ActivityLogsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - a.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/alertruleincidents_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/alertruleincidents_server.go deleted file mode 100644 index 2cc2b603081b..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/alertruleincidents_server.go +++ /dev/null @@ -1,152 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// AlertRuleIncidentsServer is a fake server for instances of the armmonitor.AlertRuleIncidentsClient type. -type AlertRuleIncidentsServer struct { - // Get is the fake for method AlertRuleIncidentsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, ruleName string, incidentName string, options *armmonitor.AlertRuleIncidentsClientGetOptions) (resp azfake.Responder[armmonitor.AlertRuleIncidentsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByAlertRulePager is the fake for method AlertRuleIncidentsClient.NewListByAlertRulePager - // HTTP status codes to indicate success: http.StatusOK - NewListByAlertRulePager func(resourceGroupName string, ruleName string, options *armmonitor.AlertRuleIncidentsClientListByAlertRuleOptions) (resp azfake.PagerResponder[armmonitor.AlertRuleIncidentsClientListByAlertRuleResponse]) -} - -// NewAlertRuleIncidentsServerTransport creates a new instance of AlertRuleIncidentsServerTransport with the provided implementation. -// The returned AlertRuleIncidentsServerTransport instance is connected to an instance of armmonitor.AlertRuleIncidentsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAlertRuleIncidentsServerTransport(srv *AlertRuleIncidentsServer) *AlertRuleIncidentsServerTransport { - return &AlertRuleIncidentsServerTransport{ - srv: srv, - newListByAlertRulePager: newTracker[azfake.PagerResponder[armmonitor.AlertRuleIncidentsClientListByAlertRuleResponse]](), - } -} - -// AlertRuleIncidentsServerTransport connects instances of armmonitor.AlertRuleIncidentsClient to instances of AlertRuleIncidentsServer. -// Don't use this type directly, use NewAlertRuleIncidentsServerTransport instead. -type AlertRuleIncidentsServerTransport struct { - srv *AlertRuleIncidentsServer - newListByAlertRulePager *tracker[azfake.PagerResponder[armmonitor.AlertRuleIncidentsClientListByAlertRuleResponse]] -} - -// Do implements the policy.Transporter interface for AlertRuleIncidentsServerTransport. -func (a *AlertRuleIncidentsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "AlertRuleIncidentsClient.Get": - resp, err = a.dispatchGet(req) - case "AlertRuleIncidentsClient.NewListByAlertRulePager": - resp, err = a.dispatchNewListByAlertRulePager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AlertRuleIncidentsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if a.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/microsoft\.insights/alertrules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/incidents/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - ruleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleName")]) - if err != nil { - return nil, err - } - incidentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("incidentName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, ruleNameParam, incidentNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Incident, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AlertRuleIncidentsServerTransport) dispatchNewListByAlertRulePager(req *http.Request) (*http.Response, error) { - if a.srv.NewListByAlertRulePager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByAlertRulePager not implemented")} - } - newListByAlertRulePager := a.newListByAlertRulePager.get(req) - if newListByAlertRulePager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/microsoft\.insights/alertrules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/incidents` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - ruleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleName")]) - if err != nil { - return nil, err - } - resp := a.srv.NewListByAlertRulePager(resourceGroupNameParam, ruleNameParam, nil) - newListByAlertRulePager = &resp - a.newListByAlertRulePager.add(req, newListByAlertRulePager) - } - resp, err := server.PagerResponderNext(newListByAlertRulePager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListByAlertRulePager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByAlertRulePager) { - a.newListByAlertRulePager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/alertrules_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/alertrules_server.go deleted file mode 100644 index 4e2c26ad9087..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/alertrules_server.go +++ /dev/null @@ -1,307 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// AlertRulesServer is a fake server for instances of the armmonitor.AlertRulesClient type. -type AlertRulesServer struct { - // CreateOrUpdate is the fake for method AlertRulesClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - CreateOrUpdate func(ctx context.Context, resourceGroupName string, ruleName string, parameters armmonitor.AlertRuleResource, options *armmonitor.AlertRulesClientCreateOrUpdateOptions) (resp azfake.Responder[armmonitor.AlertRulesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method AlertRulesClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, ruleName string, options *armmonitor.AlertRulesClientDeleteOptions) (resp azfake.Responder[armmonitor.AlertRulesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method AlertRulesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, ruleName string, options *armmonitor.AlertRulesClientGetOptions) (resp azfake.Responder[armmonitor.AlertRulesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByResourceGroupPager is the fake for method AlertRulesClient.NewListByResourceGroupPager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, options *armmonitor.AlertRulesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmonitor.AlertRulesClientListByResourceGroupResponse]) - - // NewListBySubscriptionPager is the fake for method AlertRulesClient.NewListBySubscriptionPager - // HTTP status codes to indicate success: http.StatusOK - NewListBySubscriptionPager func(options *armmonitor.AlertRulesClientListBySubscriptionOptions) (resp azfake.PagerResponder[armmonitor.AlertRulesClientListBySubscriptionResponse]) - - // Update is the fake for method AlertRulesClient.Update - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Update func(ctx context.Context, resourceGroupName string, ruleName string, alertRulesResource armmonitor.AlertRuleResourcePatch, options *armmonitor.AlertRulesClientUpdateOptions) (resp azfake.Responder[armmonitor.AlertRulesClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewAlertRulesServerTransport creates a new instance of AlertRulesServerTransport with the provided implementation. -// The returned AlertRulesServerTransport instance is connected to an instance of armmonitor.AlertRulesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAlertRulesServerTransport(srv *AlertRulesServer) *AlertRulesServerTransport { - return &AlertRulesServerTransport{ - srv: srv, - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmonitor.AlertRulesClientListByResourceGroupResponse]](), - newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmonitor.AlertRulesClientListBySubscriptionResponse]](), - } -} - -// AlertRulesServerTransport connects instances of armmonitor.AlertRulesClient to instances of AlertRulesServer. -// Don't use this type directly, use NewAlertRulesServerTransport instead. -type AlertRulesServerTransport struct { - srv *AlertRulesServer - newListByResourceGroupPager *tracker[azfake.PagerResponder[armmonitor.AlertRulesClientListByResourceGroupResponse]] - newListBySubscriptionPager *tracker[azfake.PagerResponder[armmonitor.AlertRulesClientListBySubscriptionResponse]] -} - -// Do implements the policy.Transporter interface for AlertRulesServerTransport. -func (a *AlertRulesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "AlertRulesClient.CreateOrUpdate": - resp, err = a.dispatchCreateOrUpdate(req) - case "AlertRulesClient.Delete": - resp, err = a.dispatchDelete(req) - case "AlertRulesClient.Get": - resp, err = a.dispatchGet(req) - case "AlertRulesClient.NewListByResourceGroupPager": - resp, err = a.dispatchNewListByResourceGroupPager(req) - case "AlertRulesClient.NewListBySubscriptionPager": - resp, err = a.dispatchNewListBySubscriptionPager(req) - case "AlertRulesClient.Update": - resp, err = a.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AlertRulesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if a.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/alertrules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.AlertRuleResource](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - ruleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, ruleNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AlertRuleResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AlertRulesServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if a.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/alertrules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - ruleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Delete(req.Context(), resourceGroupNameParam, ruleNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AlertRulesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if a.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/alertrules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - ruleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, ruleNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AlertRuleResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AlertRulesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListByResourceGroupPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} - } - newListByResourceGroupPager := a.newListByResourceGroupPager.get(req) - if newListByResourceGroupPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/alertrules` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resp := a.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) - newListByResourceGroupPager = &resp - a.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - } - resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListByResourceGroupPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByResourceGroupPager) { - a.newListByResourceGroupPager.remove(req) - } - return resp, nil -} - -func (a *AlertRulesServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListBySubscriptionPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} - } - newListBySubscriptionPager := a.newListBySubscriptionPager.get(req) - if newListBySubscriptionPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/alertrules` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := a.srv.NewListBySubscriptionPager(nil) - newListBySubscriptionPager = &resp - a.newListBySubscriptionPager.add(req, newListBySubscriptionPager) - } - resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListBySubscriptionPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListBySubscriptionPager) { - a.newListBySubscriptionPager.remove(req) - } - return resp, nil -} - -func (a *AlertRulesServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if a.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/alertrules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.AlertRuleResourcePatch](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - ruleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Update(req.Context(), resourceGroupNameParam, ruleNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AlertRuleResource, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/autoscalesettings_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/autoscalesettings_server.go deleted file mode 100644 index d28f9819f873..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/autoscalesettings_server.go +++ /dev/null @@ -1,314 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// AutoscaleSettingsServer is a fake server for instances of the armmonitor.AutoscaleSettingsClient type. -type AutoscaleSettingsServer struct { - // CreateOrUpdate is the fake for method AutoscaleSettingsClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - CreateOrUpdate func(ctx context.Context, resourceGroupName string, autoscaleSettingName string, parameters armmonitor.AutoscaleSettingResource, options *armmonitor.AutoscaleSettingsClientCreateOrUpdateOptions) (resp azfake.Responder[armmonitor.AutoscaleSettingsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method AutoscaleSettingsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, autoscaleSettingName string, options *armmonitor.AutoscaleSettingsClientDeleteOptions) (resp azfake.Responder[armmonitor.AutoscaleSettingsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method AutoscaleSettingsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, autoscaleSettingName string, options *armmonitor.AutoscaleSettingsClientGetOptions) (resp azfake.Responder[armmonitor.AutoscaleSettingsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByResourceGroupPager is the fake for method AutoscaleSettingsClient.NewListByResourceGroupPager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, options *armmonitor.AutoscaleSettingsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmonitor.AutoscaleSettingsClientListByResourceGroupResponse]) - - // NewListBySubscriptionPager is the fake for method AutoscaleSettingsClient.NewListBySubscriptionPager - // HTTP status codes to indicate success: http.StatusOK - NewListBySubscriptionPager func(options *armmonitor.AutoscaleSettingsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armmonitor.AutoscaleSettingsClientListBySubscriptionResponse]) - - // Update is the fake for method AutoscaleSettingsClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, autoscaleSettingName string, autoscaleSettingResource armmonitor.AutoscaleSettingResourcePatch, options *armmonitor.AutoscaleSettingsClientUpdateOptions) (resp azfake.Responder[armmonitor.AutoscaleSettingsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewAutoscaleSettingsServerTransport creates a new instance of AutoscaleSettingsServerTransport with the provided implementation. -// The returned AutoscaleSettingsServerTransport instance is connected to an instance of armmonitor.AutoscaleSettingsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAutoscaleSettingsServerTransport(srv *AutoscaleSettingsServer) *AutoscaleSettingsServerTransport { - return &AutoscaleSettingsServerTransport{ - srv: srv, - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmonitor.AutoscaleSettingsClientListByResourceGroupResponse]](), - newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmonitor.AutoscaleSettingsClientListBySubscriptionResponse]](), - } -} - -// AutoscaleSettingsServerTransport connects instances of armmonitor.AutoscaleSettingsClient to instances of AutoscaleSettingsServer. -// Don't use this type directly, use NewAutoscaleSettingsServerTransport instead. -type AutoscaleSettingsServerTransport struct { - srv *AutoscaleSettingsServer - newListByResourceGroupPager *tracker[azfake.PagerResponder[armmonitor.AutoscaleSettingsClientListByResourceGroupResponse]] - newListBySubscriptionPager *tracker[azfake.PagerResponder[armmonitor.AutoscaleSettingsClientListBySubscriptionResponse]] -} - -// Do implements the policy.Transporter interface for AutoscaleSettingsServerTransport. -func (a *AutoscaleSettingsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "AutoscaleSettingsClient.CreateOrUpdate": - resp, err = a.dispatchCreateOrUpdate(req) - case "AutoscaleSettingsClient.Delete": - resp, err = a.dispatchDelete(req) - case "AutoscaleSettingsClient.Get": - resp, err = a.dispatchGet(req) - case "AutoscaleSettingsClient.NewListByResourceGroupPager": - resp, err = a.dispatchNewListByResourceGroupPager(req) - case "AutoscaleSettingsClient.NewListBySubscriptionPager": - resp, err = a.dispatchNewListBySubscriptionPager(req) - case "AutoscaleSettingsClient.Update": - resp, err = a.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AutoscaleSettingsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if a.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/autoscalesettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.AutoscaleSettingResource](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - autoscaleSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("autoscaleSettingName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, autoscaleSettingNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AutoscaleSettingResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AutoscaleSettingsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if a.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/autoscalesettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - autoscaleSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("autoscaleSettingName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Delete(req.Context(), resourceGroupNameParam, autoscaleSettingNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AutoscaleSettingsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if a.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/autoscalesettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - autoscaleSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("autoscaleSettingName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, autoscaleSettingNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AutoscaleSettingResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AutoscaleSettingsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListByResourceGroupPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} - } - newListByResourceGroupPager := a.newListByResourceGroupPager.get(req) - if newListByResourceGroupPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/autoscalesettings` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resp := a.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) - newListByResourceGroupPager = &resp - a.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armmonitor.AutoscaleSettingsClientListByResourceGroupResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListByResourceGroupPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByResourceGroupPager) { - a.newListByResourceGroupPager.remove(req) - } - return resp, nil -} - -func (a *AutoscaleSettingsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListBySubscriptionPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} - } - newListBySubscriptionPager := a.newListBySubscriptionPager.get(req) - if newListBySubscriptionPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/autoscalesettings` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := a.srv.NewListBySubscriptionPager(nil) - newListBySubscriptionPager = &resp - a.newListBySubscriptionPager.add(req, newListBySubscriptionPager) - server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armmonitor.AutoscaleSettingsClientListBySubscriptionResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListBySubscriptionPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListBySubscriptionPager) { - a.newListBySubscriptionPager.remove(req) - } - return resp, nil -} - -func (a *AutoscaleSettingsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if a.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/autoscalesettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.AutoscaleSettingResourcePatch](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - autoscaleSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("autoscaleSettingName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Update(req.Context(), resourceGroupNameParam, autoscaleSettingNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AutoscaleSettingResource, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/azuremonitorworkspaces_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/azuremonitorworkspaces_server.go deleted file mode 100644 index 5cd33be01e72..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/azuremonitorworkspaces_server.go +++ /dev/null @@ -1,321 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// AzureMonitorWorkspacesServer is a fake server for instances of the armmonitor.AzureMonitorWorkspacesClient type. -type AzureMonitorWorkspacesServer struct { - // Create is the fake for method AzureMonitorWorkspacesClient.Create - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Create func(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, azureMonitorWorkspaceProperties armmonitor.AzureMonitorWorkspaceResource, options *armmonitor.AzureMonitorWorkspacesClientCreateOptions) (resp azfake.Responder[armmonitor.AzureMonitorWorkspacesClientCreateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method AzureMonitorWorkspacesClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *armmonitor.AzureMonitorWorkspacesClientDeleteOptions) (resp azfake.Responder[armmonitor.AzureMonitorWorkspacesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method AzureMonitorWorkspacesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *armmonitor.AzureMonitorWorkspacesClientGetOptions) (resp azfake.Responder[armmonitor.AzureMonitorWorkspacesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByResourceGroupPager is the fake for method AzureMonitorWorkspacesClient.NewListByResourceGroupPager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, options *armmonitor.AzureMonitorWorkspacesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmonitor.AzureMonitorWorkspacesClientListByResourceGroupResponse]) - - // NewListBySubscriptionPager is the fake for method AzureMonitorWorkspacesClient.NewListBySubscriptionPager - // HTTP status codes to indicate success: http.StatusOK - NewListBySubscriptionPager func(options *armmonitor.AzureMonitorWorkspacesClientListBySubscriptionOptions) (resp azfake.PagerResponder[armmonitor.AzureMonitorWorkspacesClientListBySubscriptionResponse]) - - // Update is the fake for method AzureMonitorWorkspacesClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, azureMonitorWorkspaceName string, options *armmonitor.AzureMonitorWorkspacesClientUpdateOptions) (resp azfake.Responder[armmonitor.AzureMonitorWorkspacesClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewAzureMonitorWorkspacesServerTransport creates a new instance of AzureMonitorWorkspacesServerTransport with the provided implementation. -// The returned AzureMonitorWorkspacesServerTransport instance is connected to an instance of armmonitor.AzureMonitorWorkspacesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAzureMonitorWorkspacesServerTransport(srv *AzureMonitorWorkspacesServer) *AzureMonitorWorkspacesServerTransport { - return &AzureMonitorWorkspacesServerTransport{ - srv: srv, - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmonitor.AzureMonitorWorkspacesClientListByResourceGroupResponse]](), - newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmonitor.AzureMonitorWorkspacesClientListBySubscriptionResponse]](), - } -} - -// AzureMonitorWorkspacesServerTransport connects instances of armmonitor.AzureMonitorWorkspacesClient to instances of AzureMonitorWorkspacesServer. -// Don't use this type directly, use NewAzureMonitorWorkspacesServerTransport instead. -type AzureMonitorWorkspacesServerTransport struct { - srv *AzureMonitorWorkspacesServer - newListByResourceGroupPager *tracker[azfake.PagerResponder[armmonitor.AzureMonitorWorkspacesClientListByResourceGroupResponse]] - newListBySubscriptionPager *tracker[azfake.PagerResponder[armmonitor.AzureMonitorWorkspacesClientListBySubscriptionResponse]] -} - -// Do implements the policy.Transporter interface for AzureMonitorWorkspacesServerTransport. -func (a *AzureMonitorWorkspacesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "AzureMonitorWorkspacesClient.Create": - resp, err = a.dispatchCreate(req) - case "AzureMonitorWorkspacesClient.Delete": - resp, err = a.dispatchDelete(req) - case "AzureMonitorWorkspacesClient.Get": - resp, err = a.dispatchGet(req) - case "AzureMonitorWorkspacesClient.NewListByResourceGroupPager": - resp, err = a.dispatchNewListByResourceGroupPager(req) - case "AzureMonitorWorkspacesClient.NewListBySubscriptionPager": - resp, err = a.dispatchNewListBySubscriptionPager(req) - case "AzureMonitorWorkspacesClient.Update": - resp, err = a.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AzureMonitorWorkspacesServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if a.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Monitor/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.AzureMonitorWorkspaceResource](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - azureMonitorWorkspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("azureMonitorWorkspaceName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Create(req.Context(), resourceGroupNameParam, azureMonitorWorkspaceNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AzureMonitorWorkspaceResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AzureMonitorWorkspacesServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if a.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Monitor/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - azureMonitorWorkspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("azureMonitorWorkspaceName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Delete(req.Context(), resourceGroupNameParam, azureMonitorWorkspaceNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AzureMonitorWorkspacesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if a.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Monitor/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - azureMonitorWorkspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("azureMonitorWorkspaceName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, azureMonitorWorkspaceNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AzureMonitorWorkspaceResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AzureMonitorWorkspacesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListByResourceGroupPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} - } - newListByResourceGroupPager := a.newListByResourceGroupPager.get(req) - if newListByResourceGroupPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Monitor/accounts` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resp := a.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) - newListByResourceGroupPager = &resp - a.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armmonitor.AzureMonitorWorkspacesClientListByResourceGroupResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListByResourceGroupPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByResourceGroupPager) { - a.newListByResourceGroupPager.remove(req) - } - return resp, nil -} - -func (a *AzureMonitorWorkspacesServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListBySubscriptionPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} - } - newListBySubscriptionPager := a.newListBySubscriptionPager.get(req) - if newListBySubscriptionPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Monitor/accounts` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := a.srv.NewListBySubscriptionPager(nil) - newListBySubscriptionPager = &resp - a.newListBySubscriptionPager.add(req, newListBySubscriptionPager) - server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armmonitor.AzureMonitorWorkspacesClientListBySubscriptionResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListBySubscriptionPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListBySubscriptionPager) { - a.newListBySubscriptionPager.remove(req) - } - return resp, nil -} - -func (a *AzureMonitorWorkspacesServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if a.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Monitor/accounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.AzureMonitorWorkspaceResourceForUpdate](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - azureMonitorWorkspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("azureMonitorWorkspaceName")]) - if err != nil { - return nil, err - } - var options *armmonitor.AzureMonitorWorkspacesClientUpdateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmonitor.AzureMonitorWorkspacesClientUpdateOptions{ - AzureMonitorWorkspaceProperties: &body, - } - } - respr, errRespr := a.srv.Update(req.Context(), resourceGroupNameParam, azureMonitorWorkspaceNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AzureMonitorWorkspaceResource, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/baselines_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/baselines_server.go deleted file mode 100644 index 2207055d2a6d..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/baselines_server.go +++ /dev/null @@ -1,158 +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 ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// BaselinesServer is a fake server for instances of the armmonitor.BaselinesClient type. -type BaselinesServer struct { - // NewListPager is the fake for method BaselinesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceURI string, options *armmonitor.BaselinesClientListOptions) (resp azfake.PagerResponder[armmonitor.BaselinesClientListResponse]) -} - -// NewBaselinesServerTransport creates a new instance of BaselinesServerTransport with the provided implementation. -// The returned BaselinesServerTransport instance is connected to an instance of armmonitor.BaselinesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewBaselinesServerTransport(srv *BaselinesServer) *BaselinesServerTransport { - return &BaselinesServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armmonitor.BaselinesClientListResponse]](), - } -} - -// BaselinesServerTransport connects instances of armmonitor.BaselinesClient to instances of BaselinesServer. -// Don't use this type directly, use NewBaselinesServerTransport instead. -type BaselinesServerTransport struct { - srv *BaselinesServer - newListPager *tracker[azfake.PagerResponder[armmonitor.BaselinesClientListResponse]] -} - -// Do implements the policy.Transporter interface for BaselinesServerTransport. -func (b *BaselinesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "BaselinesClient.NewListPager": - resp, err = b.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (b *BaselinesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if b.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := b.newListPager.get(req) - if newListPager == nil { - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/metricBaselines` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - metricnamesUnescaped, err := url.QueryUnescape(qp.Get("metricnames")) - if err != nil { - return nil, err - } - metricnamesParam := getOptional(metricnamesUnescaped) - metricnamespaceUnescaped, err := url.QueryUnescape(qp.Get("metricnamespace")) - if err != nil { - return nil, err - } - metricnamespaceParam := getOptional(metricnamespaceUnescaped) - timespanUnescaped, err := url.QueryUnescape(qp.Get("timespan")) - if err != nil { - return nil, err - } - timespanParam := getOptional(timespanUnescaped) - intervalUnescaped, err := url.QueryUnescape(qp.Get("interval")) - if err != nil { - return nil, err - } - intervalParam := getOptional(intervalUnescaped) - aggregationUnescaped, err := url.QueryUnescape(qp.Get("aggregation")) - if err != nil { - return nil, err - } - aggregationParam := getOptional(aggregationUnescaped) - sensitivitiesUnescaped, err := url.QueryUnescape(qp.Get("sensitivities")) - if err != nil { - return nil, err - } - sensitivitiesParam := getOptional(sensitivitiesUnescaped) - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - resultTypeUnescaped, err := url.QueryUnescape(qp.Get("resultType")) - if err != nil { - return nil, err - } - resultTypeParam := getOptional(armmonitor.ResultType(resultTypeUnescaped)) - var options *armmonitor.BaselinesClientListOptions - if metricnamesParam != nil || metricnamespaceParam != nil || timespanParam != nil || intervalParam != nil || aggregationParam != nil || sensitivitiesParam != nil || filterParam != nil || resultTypeParam != nil { - options = &armmonitor.BaselinesClientListOptions{ - Metricnames: metricnamesParam, - Metricnamespace: metricnamespaceParam, - Timespan: timespanParam, - Interval: intervalParam, - Aggregation: aggregationParam, - Sensitivities: sensitivitiesParam, - Filter: filterParam, - ResultType: resultTypeParam, - } - } - resp := b.srv.NewListPager(resourceURIParam, options) - newListPager = &resp - b.newListPager.add(req, newListPager) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - b.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - b.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionendpoints_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionendpoints_server.go deleted file mode 100644 index c9c1040975d0..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionendpoints_server.go +++ /dev/null @@ -1,327 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// DataCollectionEndpointsServer is a fake server for instances of the armmonitor.DataCollectionEndpointsClient type. -type DataCollectionEndpointsServer struct { - // Create is the fake for method DataCollectionEndpointsClient.Create - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Create func(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *armmonitor.DataCollectionEndpointsClientCreateOptions) (resp azfake.Responder[armmonitor.DataCollectionEndpointsClientCreateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method DataCollectionEndpointsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *armmonitor.DataCollectionEndpointsClientDeleteOptions) (resp azfake.Responder[armmonitor.DataCollectionEndpointsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method DataCollectionEndpointsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *armmonitor.DataCollectionEndpointsClientGetOptions) (resp azfake.Responder[armmonitor.DataCollectionEndpointsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByResourceGroupPager is the fake for method DataCollectionEndpointsClient.NewListByResourceGroupPager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, options *armmonitor.DataCollectionEndpointsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmonitor.DataCollectionEndpointsClientListByResourceGroupResponse]) - - // NewListBySubscriptionPager is the fake for method DataCollectionEndpointsClient.NewListBySubscriptionPager - // HTTP status codes to indicate success: http.StatusOK - NewListBySubscriptionPager func(options *armmonitor.DataCollectionEndpointsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armmonitor.DataCollectionEndpointsClientListBySubscriptionResponse]) - - // Update is the fake for method DataCollectionEndpointsClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, dataCollectionEndpointName string, options *armmonitor.DataCollectionEndpointsClientUpdateOptions) (resp azfake.Responder[armmonitor.DataCollectionEndpointsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewDataCollectionEndpointsServerTransport creates a new instance of DataCollectionEndpointsServerTransport with the provided implementation. -// The returned DataCollectionEndpointsServerTransport instance is connected to an instance of armmonitor.DataCollectionEndpointsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewDataCollectionEndpointsServerTransport(srv *DataCollectionEndpointsServer) *DataCollectionEndpointsServerTransport { - return &DataCollectionEndpointsServerTransport{ - srv: srv, - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmonitor.DataCollectionEndpointsClientListByResourceGroupResponse]](), - newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmonitor.DataCollectionEndpointsClientListBySubscriptionResponse]](), - } -} - -// DataCollectionEndpointsServerTransport connects instances of armmonitor.DataCollectionEndpointsClient to instances of DataCollectionEndpointsServer. -// Don't use this type directly, use NewDataCollectionEndpointsServerTransport instead. -type DataCollectionEndpointsServerTransport struct { - srv *DataCollectionEndpointsServer - newListByResourceGroupPager *tracker[azfake.PagerResponder[armmonitor.DataCollectionEndpointsClientListByResourceGroupResponse]] - newListBySubscriptionPager *tracker[azfake.PagerResponder[armmonitor.DataCollectionEndpointsClientListBySubscriptionResponse]] -} - -// Do implements the policy.Transporter interface for DataCollectionEndpointsServerTransport. -func (d *DataCollectionEndpointsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "DataCollectionEndpointsClient.Create": - resp, err = d.dispatchCreate(req) - case "DataCollectionEndpointsClient.Delete": - resp, err = d.dispatchDelete(req) - case "DataCollectionEndpointsClient.Get": - resp, err = d.dispatchGet(req) - case "DataCollectionEndpointsClient.NewListByResourceGroupPager": - resp, err = d.dispatchNewListByResourceGroupPager(req) - case "DataCollectionEndpointsClient.NewListBySubscriptionPager": - resp, err = d.dispatchNewListBySubscriptionPager(req) - case "DataCollectionEndpointsClient.Update": - resp, err = d.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (d *DataCollectionEndpointsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if d.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.DataCollectionEndpointResource](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - dataCollectionEndpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataCollectionEndpointName")]) - if err != nil { - return nil, err - } - var options *armmonitor.DataCollectionEndpointsClientCreateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmonitor.DataCollectionEndpointsClientCreateOptions{ - Body: &body, - } - } - respr, errRespr := d.srv.Create(req.Context(), resourceGroupNameParam, dataCollectionEndpointNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DataCollectionEndpointResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DataCollectionEndpointsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if d.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - dataCollectionEndpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataCollectionEndpointName")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.Delete(req.Context(), resourceGroupNameParam, dataCollectionEndpointNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DataCollectionEndpointsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if d.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - dataCollectionEndpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataCollectionEndpointName")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, dataCollectionEndpointNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DataCollectionEndpointResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DataCollectionEndpointsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { - if d.srv.NewListByResourceGroupPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} - } - newListByResourceGroupPager := d.newListByResourceGroupPager.get(req) - if newListByResourceGroupPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionEndpoints` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resp := d.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) - newListByResourceGroupPager = &resp - d.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armmonitor.DataCollectionEndpointsClientListByResourceGroupResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - d.newListByResourceGroupPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByResourceGroupPager) { - d.newListByResourceGroupPager.remove(req) - } - return resp, nil -} - -func (d *DataCollectionEndpointsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { - if d.srv.NewListBySubscriptionPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} - } - newListBySubscriptionPager := d.newListBySubscriptionPager.get(req) - if newListBySubscriptionPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionEndpoints` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := d.srv.NewListBySubscriptionPager(nil) - newListBySubscriptionPager = &resp - d.newListBySubscriptionPager.add(req, newListBySubscriptionPager) - server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armmonitor.DataCollectionEndpointsClientListBySubscriptionResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - d.newListBySubscriptionPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListBySubscriptionPager) { - d.newListBySubscriptionPager.remove(req) - } - return resp, nil -} - -func (d *DataCollectionEndpointsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if d.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.ResourceForUpdate](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - dataCollectionEndpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataCollectionEndpointName")]) - if err != nil { - return nil, err - } - var options *armmonitor.DataCollectionEndpointsClientUpdateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmonitor.DataCollectionEndpointsClientUpdateOptions{ - Body: &body, - } - } - respr, errRespr := d.srv.Update(req.Context(), resourceGroupNameParam, dataCollectionEndpointNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DataCollectionEndpointResource, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionruleassociations_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionruleassociations_server.go deleted file mode 100644 index 989f81389657..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionruleassociations_server.go +++ /dev/null @@ -1,335 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// DataCollectionRuleAssociationsServer is a fake server for instances of the armmonitor.DataCollectionRuleAssociationsClient type. -type DataCollectionRuleAssociationsServer struct { - // Create is the fake for method DataCollectionRuleAssociationsClient.Create - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Create func(ctx context.Context, resourceURI string, associationName string, options *armmonitor.DataCollectionRuleAssociationsClientCreateOptions) (resp azfake.Responder[armmonitor.DataCollectionRuleAssociationsClientCreateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method DataCollectionRuleAssociationsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceURI string, associationName string, options *armmonitor.DataCollectionRuleAssociationsClientDeleteOptions) (resp azfake.Responder[armmonitor.DataCollectionRuleAssociationsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method DataCollectionRuleAssociationsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceURI string, associationName string, options *armmonitor.DataCollectionRuleAssociationsClientGetOptions) (resp azfake.Responder[armmonitor.DataCollectionRuleAssociationsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByDataCollectionEndpointPager is the fake for method DataCollectionRuleAssociationsClient.NewListByDataCollectionEndpointPager - // HTTP status codes to indicate success: http.StatusOK - NewListByDataCollectionEndpointPager func(resourceGroupName string, dataCollectionEndpointName string, options *armmonitor.DataCollectionRuleAssociationsClientListByDataCollectionEndpointOptions) (resp azfake.PagerResponder[armmonitor.DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse]) - - // NewListByResourcePager is the fake for method DataCollectionRuleAssociationsClient.NewListByResourcePager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourcePager func(resourceURI string, options *armmonitor.DataCollectionRuleAssociationsClientListByResourceOptions) (resp azfake.PagerResponder[armmonitor.DataCollectionRuleAssociationsClientListByResourceResponse]) - - // NewListByRulePager is the fake for method DataCollectionRuleAssociationsClient.NewListByRulePager - // HTTP status codes to indicate success: http.StatusOK - NewListByRulePager func(resourceGroupName string, dataCollectionRuleName string, options *armmonitor.DataCollectionRuleAssociationsClientListByRuleOptions) (resp azfake.PagerResponder[armmonitor.DataCollectionRuleAssociationsClientListByRuleResponse]) -} - -// NewDataCollectionRuleAssociationsServerTransport creates a new instance of DataCollectionRuleAssociationsServerTransport with the provided implementation. -// The returned DataCollectionRuleAssociationsServerTransport instance is connected to an instance of armmonitor.DataCollectionRuleAssociationsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewDataCollectionRuleAssociationsServerTransport(srv *DataCollectionRuleAssociationsServer) *DataCollectionRuleAssociationsServerTransport { - return &DataCollectionRuleAssociationsServerTransport{ - srv: srv, - newListByDataCollectionEndpointPager: newTracker[azfake.PagerResponder[armmonitor.DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse]](), - newListByResourcePager: newTracker[azfake.PagerResponder[armmonitor.DataCollectionRuleAssociationsClientListByResourceResponse]](), - newListByRulePager: newTracker[azfake.PagerResponder[armmonitor.DataCollectionRuleAssociationsClientListByRuleResponse]](), - } -} - -// DataCollectionRuleAssociationsServerTransport connects instances of armmonitor.DataCollectionRuleAssociationsClient to instances of DataCollectionRuleAssociationsServer. -// Don't use this type directly, use NewDataCollectionRuleAssociationsServerTransport instead. -type DataCollectionRuleAssociationsServerTransport struct { - srv *DataCollectionRuleAssociationsServer - newListByDataCollectionEndpointPager *tracker[azfake.PagerResponder[armmonitor.DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse]] - newListByResourcePager *tracker[azfake.PagerResponder[armmonitor.DataCollectionRuleAssociationsClientListByResourceResponse]] - newListByRulePager *tracker[azfake.PagerResponder[armmonitor.DataCollectionRuleAssociationsClientListByRuleResponse]] -} - -// Do implements the policy.Transporter interface for DataCollectionRuleAssociationsServerTransport. -func (d *DataCollectionRuleAssociationsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "DataCollectionRuleAssociationsClient.Create": - resp, err = d.dispatchCreate(req) - case "DataCollectionRuleAssociationsClient.Delete": - resp, err = d.dispatchDelete(req) - case "DataCollectionRuleAssociationsClient.Get": - resp, err = d.dispatchGet(req) - case "DataCollectionRuleAssociationsClient.NewListByDataCollectionEndpointPager": - resp, err = d.dispatchNewListByDataCollectionEndpointPager(req) - case "DataCollectionRuleAssociationsClient.NewListByResourcePager": - resp, err = d.dispatchNewListByResourcePager(req) - case "DataCollectionRuleAssociationsClient.NewListByRulePager": - resp, err = d.dispatchNewListByRulePager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (d *DataCollectionRuleAssociationsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if d.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionRuleAssociations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.DataCollectionRuleAssociationProxyOnlyResource](req) - if err != nil { - return nil, err - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - associationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("associationName")]) - if err != nil { - return nil, err - } - var options *armmonitor.DataCollectionRuleAssociationsClientCreateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmonitor.DataCollectionRuleAssociationsClientCreateOptions{ - Body: &body, - } - } - respr, errRespr := d.srv.Create(req.Context(), resourceURIParam, associationNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DataCollectionRuleAssociationProxyOnlyResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DataCollectionRuleAssociationsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if d.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionRuleAssociations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - associationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("associationName")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.Delete(req.Context(), resourceURIParam, associationNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DataCollectionRuleAssociationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if d.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionRuleAssociations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - associationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("associationName")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.Get(req.Context(), resourceURIParam, associationNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DataCollectionRuleAssociationProxyOnlyResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DataCollectionRuleAssociationsServerTransport) dispatchNewListByDataCollectionEndpointPager(req *http.Request) (*http.Response, error) { - if d.srv.NewListByDataCollectionEndpointPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByDataCollectionEndpointPager not implemented")} - } - newListByDataCollectionEndpointPager := d.newListByDataCollectionEndpointPager.get(req) - if newListByDataCollectionEndpointPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/associations` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - dataCollectionEndpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataCollectionEndpointName")]) - if err != nil { - return nil, err - } - resp := d.srv.NewListByDataCollectionEndpointPager(resourceGroupNameParam, dataCollectionEndpointNameParam, nil) - newListByDataCollectionEndpointPager = &resp - d.newListByDataCollectionEndpointPager.add(req, newListByDataCollectionEndpointPager) - server.PagerResponderInjectNextLinks(newListByDataCollectionEndpointPager, req, func(page *armmonitor.DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByDataCollectionEndpointPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - d.newListByDataCollectionEndpointPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByDataCollectionEndpointPager) { - d.newListByDataCollectionEndpointPager.remove(req) - } - return resp, nil -} - -func (d *DataCollectionRuleAssociationsServerTransport) dispatchNewListByResourcePager(req *http.Request) (*http.Response, error) { - if d.srv.NewListByResourcePager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByResourcePager not implemented")} - } - newListByResourcePager := d.newListByResourcePager.get(req) - if newListByResourcePager == nil { - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionRuleAssociations` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - resp := d.srv.NewListByResourcePager(resourceURIParam, nil) - newListByResourcePager = &resp - d.newListByResourcePager.add(req, newListByResourcePager) - server.PagerResponderInjectNextLinks(newListByResourcePager, req, func(page *armmonitor.DataCollectionRuleAssociationsClientListByResourceResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByResourcePager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - d.newListByResourcePager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByResourcePager) { - d.newListByResourcePager.remove(req) - } - return resp, nil -} - -func (d *DataCollectionRuleAssociationsServerTransport) dispatchNewListByRulePager(req *http.Request) (*http.Response, error) { - if d.srv.NewListByRulePager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByRulePager not implemented")} - } - newListByRulePager := d.newListByRulePager.get(req) - if newListByRulePager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/associations` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - dataCollectionRuleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataCollectionRuleName")]) - if err != nil { - return nil, err - } - resp := d.srv.NewListByRulePager(resourceGroupNameParam, dataCollectionRuleNameParam, nil) - newListByRulePager = &resp - d.newListByRulePager.add(req, newListByRulePager) - server.PagerResponderInjectNextLinks(newListByRulePager, req, func(page *armmonitor.DataCollectionRuleAssociationsClientListByRuleResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByRulePager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - d.newListByRulePager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByRulePager) { - d.newListByRulePager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionrules_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionrules_server.go deleted file mode 100644 index 5def3e9fc4e3..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/datacollectionrules_server.go +++ /dev/null @@ -1,327 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// DataCollectionRulesServer is a fake server for instances of the armmonitor.DataCollectionRulesClient type. -type DataCollectionRulesServer struct { - // Create is the fake for method DataCollectionRulesClient.Create - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Create func(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *armmonitor.DataCollectionRulesClientCreateOptions) (resp azfake.Responder[armmonitor.DataCollectionRulesClientCreateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method DataCollectionRulesClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *armmonitor.DataCollectionRulesClientDeleteOptions) (resp azfake.Responder[armmonitor.DataCollectionRulesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method DataCollectionRulesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *armmonitor.DataCollectionRulesClientGetOptions) (resp azfake.Responder[armmonitor.DataCollectionRulesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByResourceGroupPager is the fake for method DataCollectionRulesClient.NewListByResourceGroupPager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, options *armmonitor.DataCollectionRulesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmonitor.DataCollectionRulesClientListByResourceGroupResponse]) - - // NewListBySubscriptionPager is the fake for method DataCollectionRulesClient.NewListBySubscriptionPager - // HTTP status codes to indicate success: http.StatusOK - NewListBySubscriptionPager func(options *armmonitor.DataCollectionRulesClientListBySubscriptionOptions) (resp azfake.PagerResponder[armmonitor.DataCollectionRulesClientListBySubscriptionResponse]) - - // Update is the fake for method DataCollectionRulesClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, dataCollectionRuleName string, options *armmonitor.DataCollectionRulesClientUpdateOptions) (resp azfake.Responder[armmonitor.DataCollectionRulesClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewDataCollectionRulesServerTransport creates a new instance of DataCollectionRulesServerTransport with the provided implementation. -// The returned DataCollectionRulesServerTransport instance is connected to an instance of armmonitor.DataCollectionRulesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewDataCollectionRulesServerTransport(srv *DataCollectionRulesServer) *DataCollectionRulesServerTransport { - return &DataCollectionRulesServerTransport{ - srv: srv, - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmonitor.DataCollectionRulesClientListByResourceGroupResponse]](), - newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmonitor.DataCollectionRulesClientListBySubscriptionResponse]](), - } -} - -// DataCollectionRulesServerTransport connects instances of armmonitor.DataCollectionRulesClient to instances of DataCollectionRulesServer. -// Don't use this type directly, use NewDataCollectionRulesServerTransport instead. -type DataCollectionRulesServerTransport struct { - srv *DataCollectionRulesServer - newListByResourceGroupPager *tracker[azfake.PagerResponder[armmonitor.DataCollectionRulesClientListByResourceGroupResponse]] - newListBySubscriptionPager *tracker[azfake.PagerResponder[armmonitor.DataCollectionRulesClientListBySubscriptionResponse]] -} - -// Do implements the policy.Transporter interface for DataCollectionRulesServerTransport. -func (d *DataCollectionRulesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "DataCollectionRulesClient.Create": - resp, err = d.dispatchCreate(req) - case "DataCollectionRulesClient.Delete": - resp, err = d.dispatchDelete(req) - case "DataCollectionRulesClient.Get": - resp, err = d.dispatchGet(req) - case "DataCollectionRulesClient.NewListByResourceGroupPager": - resp, err = d.dispatchNewListByResourceGroupPager(req) - case "DataCollectionRulesClient.NewListBySubscriptionPager": - resp, err = d.dispatchNewListBySubscriptionPager(req) - case "DataCollectionRulesClient.Update": - resp, err = d.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (d *DataCollectionRulesServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if d.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.DataCollectionRuleResource](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - dataCollectionRuleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataCollectionRuleName")]) - if err != nil { - return nil, err - } - var options *armmonitor.DataCollectionRulesClientCreateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmonitor.DataCollectionRulesClientCreateOptions{ - Body: &body, - } - } - respr, errRespr := d.srv.Create(req.Context(), resourceGroupNameParam, dataCollectionRuleNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DataCollectionRuleResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DataCollectionRulesServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if d.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - dataCollectionRuleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataCollectionRuleName")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.Delete(req.Context(), resourceGroupNameParam, dataCollectionRuleNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DataCollectionRulesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if d.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - dataCollectionRuleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataCollectionRuleName")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, dataCollectionRuleNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DataCollectionRuleResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DataCollectionRulesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { - if d.srv.NewListByResourceGroupPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} - } - newListByResourceGroupPager := d.newListByResourceGroupPager.get(req) - if newListByResourceGroupPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionRules` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resp := d.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) - newListByResourceGroupPager = &resp - d.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armmonitor.DataCollectionRulesClientListByResourceGroupResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - d.newListByResourceGroupPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByResourceGroupPager) { - d.newListByResourceGroupPager.remove(req) - } - return resp, nil -} - -func (d *DataCollectionRulesServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { - if d.srv.NewListBySubscriptionPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} - } - newListBySubscriptionPager := d.newListBySubscriptionPager.get(req) - if newListBySubscriptionPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionRules` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := d.srv.NewListBySubscriptionPager(nil) - newListBySubscriptionPager = &resp - d.newListBySubscriptionPager.add(req, newListBySubscriptionPager) - server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armmonitor.DataCollectionRulesClientListBySubscriptionResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - d.newListBySubscriptionPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListBySubscriptionPager) { - d.newListBySubscriptionPager.remove(req) - } - return resp, nil -} - -func (d *DataCollectionRulesServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if d.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/dataCollectionRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.ResourceForUpdate](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - dataCollectionRuleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("dataCollectionRuleName")]) - if err != nil { - return nil, err - } - var options *armmonitor.DataCollectionRulesClientUpdateOptions - if !reflect.ValueOf(body).IsZero() { - options = &armmonitor.DataCollectionRulesClientUpdateOptions{ - Body: &body, - } - } - respr, errRespr := d.srv.Update(req.Context(), resourceGroupNameParam, dataCollectionRuleNameParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DataCollectionRuleResource, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/diagnosticsettings_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/diagnosticsettings_server.go deleted file mode 100644 index 0ad7741d47d1..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/diagnosticsettings_server.go +++ /dev/null @@ -1,226 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// DiagnosticSettingsServer is a fake server for instances of the armmonitor.DiagnosticSettingsClient type. -type DiagnosticSettingsServer struct { - // CreateOrUpdate is the fake for method DiagnosticSettingsClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK - CreateOrUpdate func(ctx context.Context, resourceURI string, name string, parameters armmonitor.DiagnosticSettingsResource, options *armmonitor.DiagnosticSettingsClientCreateOrUpdateOptions) (resp azfake.Responder[armmonitor.DiagnosticSettingsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method DiagnosticSettingsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceURI string, name string, options *armmonitor.DiagnosticSettingsClientDeleteOptions) (resp azfake.Responder[armmonitor.DiagnosticSettingsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method DiagnosticSettingsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceURI string, name string, options *armmonitor.DiagnosticSettingsClientGetOptions) (resp azfake.Responder[armmonitor.DiagnosticSettingsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method DiagnosticSettingsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceURI string, options *armmonitor.DiagnosticSettingsClientListOptions) (resp azfake.PagerResponder[armmonitor.DiagnosticSettingsClientListResponse]) -} - -// NewDiagnosticSettingsServerTransport creates a new instance of DiagnosticSettingsServerTransport with the provided implementation. -// The returned DiagnosticSettingsServerTransport instance is connected to an instance of armmonitor.DiagnosticSettingsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewDiagnosticSettingsServerTransport(srv *DiagnosticSettingsServer) *DiagnosticSettingsServerTransport { - return &DiagnosticSettingsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armmonitor.DiagnosticSettingsClientListResponse]](), - } -} - -// DiagnosticSettingsServerTransport connects instances of armmonitor.DiagnosticSettingsClient to instances of DiagnosticSettingsServer. -// Don't use this type directly, use NewDiagnosticSettingsServerTransport instead. -type DiagnosticSettingsServerTransport struct { - srv *DiagnosticSettingsServer - newListPager *tracker[azfake.PagerResponder[armmonitor.DiagnosticSettingsClientListResponse]] -} - -// Do implements the policy.Transporter interface for DiagnosticSettingsServerTransport. -func (d *DiagnosticSettingsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "DiagnosticSettingsClient.CreateOrUpdate": - resp, err = d.dispatchCreateOrUpdate(req) - case "DiagnosticSettingsClient.Delete": - resp, err = d.dispatchDelete(req) - case "DiagnosticSettingsClient.Get": - resp, err = d.dispatchGet(req) - case "DiagnosticSettingsClient.NewListPager": - resp, err = d.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (d *DiagnosticSettingsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if d.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/diagnosticSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.DiagnosticSettingsResource](req) - if err != nil { - return nil, err - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.CreateOrUpdate(req.Context(), resourceURIParam, nameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DiagnosticSettingsResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DiagnosticSettingsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if d.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/diagnosticSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.Delete(req.Context(), resourceURIParam, nameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DiagnosticSettingsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if d.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/diagnosticSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.Get(req.Context(), resourceURIParam, nameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DiagnosticSettingsResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DiagnosticSettingsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if d.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := d.newListPager.get(req) - if newListPager == nil { - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/diagnosticSettings` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - resp := d.srv.NewListPager(resourceURIParam, nil) - newListPager = &resp - d.newListPager.add(req, newListPager) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - d.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - d.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/diagnosticsettingscategory_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/diagnosticsettingscategory_server.go deleted file mode 100644 index 70bbd473227a..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/diagnosticsettingscategory_server.go +++ /dev/null @@ -1,144 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// DiagnosticSettingsCategoryServer is a fake server for instances of the armmonitor.DiagnosticSettingsCategoryClient type. -type DiagnosticSettingsCategoryServer struct { - // Get is the fake for method DiagnosticSettingsCategoryClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceURI string, name string, options *armmonitor.DiagnosticSettingsCategoryClientGetOptions) (resp azfake.Responder[armmonitor.DiagnosticSettingsCategoryClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method DiagnosticSettingsCategoryClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceURI string, options *armmonitor.DiagnosticSettingsCategoryClientListOptions) (resp azfake.PagerResponder[armmonitor.DiagnosticSettingsCategoryClientListResponse]) -} - -// NewDiagnosticSettingsCategoryServerTransport creates a new instance of DiagnosticSettingsCategoryServerTransport with the provided implementation. -// The returned DiagnosticSettingsCategoryServerTransport instance is connected to an instance of armmonitor.DiagnosticSettingsCategoryClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewDiagnosticSettingsCategoryServerTransport(srv *DiagnosticSettingsCategoryServer) *DiagnosticSettingsCategoryServerTransport { - return &DiagnosticSettingsCategoryServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armmonitor.DiagnosticSettingsCategoryClientListResponse]](), - } -} - -// DiagnosticSettingsCategoryServerTransport connects instances of armmonitor.DiagnosticSettingsCategoryClient to instances of DiagnosticSettingsCategoryServer. -// Don't use this type directly, use NewDiagnosticSettingsCategoryServerTransport instead. -type DiagnosticSettingsCategoryServerTransport struct { - srv *DiagnosticSettingsCategoryServer - newListPager *tracker[azfake.PagerResponder[armmonitor.DiagnosticSettingsCategoryClientListResponse]] -} - -// Do implements the policy.Transporter interface for DiagnosticSettingsCategoryServerTransport. -func (d *DiagnosticSettingsCategoryServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "DiagnosticSettingsCategoryClient.Get": - resp, err = d.dispatchGet(req) - case "DiagnosticSettingsCategoryClient.NewListPager": - resp, err = d.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (d *DiagnosticSettingsCategoryServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if d.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/diagnosticSettingsCategories/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.Get(req.Context(), resourceURIParam, nameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DiagnosticSettingsCategoryResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (d *DiagnosticSettingsCategoryServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if d.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := d.newListPager.get(req) - if newListPager == nil { - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/diagnosticSettingsCategories` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - resp := d.srv.NewListPager(resourceURIParam, nil) - newListPager = &resp - d.newListPager.add(req, newListPager) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - d.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - d.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/eventcategories_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/eventcategories_server.go deleted file mode 100644 index a7e0402664b4..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/eventcategories_server.go +++ /dev/null @@ -1,92 +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 ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" -) - -// EventCategoriesServer is a fake server for instances of the armmonitor.EventCategoriesClient type. -type EventCategoriesServer struct { - // NewListPager is the fake for method EventCategoriesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armmonitor.EventCategoriesClientListOptions) (resp azfake.PagerResponder[armmonitor.EventCategoriesClientListResponse]) -} - -// NewEventCategoriesServerTransport creates a new instance of EventCategoriesServerTransport with the provided implementation. -// The returned EventCategoriesServerTransport instance is connected to an instance of armmonitor.EventCategoriesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewEventCategoriesServerTransport(srv *EventCategoriesServer) *EventCategoriesServerTransport { - return &EventCategoriesServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armmonitor.EventCategoriesClientListResponse]](), - } -} - -// EventCategoriesServerTransport connects instances of armmonitor.EventCategoriesClient to instances of EventCategoriesServer. -// Don't use this type directly, use NewEventCategoriesServerTransport instead. -type EventCategoriesServerTransport struct { - srv *EventCategoriesServer - newListPager *tracker[azfake.PagerResponder[armmonitor.EventCategoriesClientListResponse]] -} - -// Do implements the policy.Transporter interface for EventCategoriesServerTransport. -func (e *EventCategoriesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "EventCategoriesClient.NewListPager": - resp, err = e.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (e *EventCategoriesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if e.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := e.newListPager.get(req) - if newListPager == nil { - resp := e.srv.NewListPager(nil) - newListPager = &resp - e.newListPager.add(req, newListPager) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - e.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - e.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/internal.go b/sdk/resourcemanager/monitor/armmonitor/fake/internal.go index c63abf57927c..4b65adc76adb 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/internal.go +++ b/sdk/resourcemanager/monitor/armmonitor/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. @@ -11,10 +8,14 @@ package fake import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "net/http" - "reflect" "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } @@ -32,32 +33,6 @@ func contains[T comparable](s []T, v T) bool { return false } -func getHeaderValue(h http.Header, k string) string { - v := h[k] - if len(v) == 0 { - return "" - } - return v[0] -} - -func getOptional[T any](v T) *T { - if reflect.ValueOf(v).IsZero() { - return nil - } - return &v -} - -func parseOptional[T any](v string, parse func(v string) (T, error)) (*T, error) { - if v == "" { - return nil, nil - } - t, err := parse(v) - if err != nil { - return nil, err - } - return &t, err -} - func newTracker[T any]() *tracker[T] { return &tracker[T]{ items: map[string]*T{}, diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/logprofiles_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/logprofiles_server.go deleted file mode 100644 index f3c16afbcafe..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/logprofiles_server.go +++ /dev/null @@ -1,249 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// LogProfilesServer is a fake server for instances of the armmonitor.LogProfilesClient type. -type LogProfilesServer struct { - // CreateOrUpdate is the fake for method LogProfilesClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK - CreateOrUpdate func(ctx context.Context, logProfileName string, parameters armmonitor.LogProfileResource, options *armmonitor.LogProfilesClientCreateOrUpdateOptions) (resp azfake.Responder[armmonitor.LogProfilesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method LogProfilesClient.Delete - // HTTP status codes to indicate success: http.StatusOK - Delete func(ctx context.Context, logProfileName string, options *armmonitor.LogProfilesClientDeleteOptions) (resp azfake.Responder[armmonitor.LogProfilesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method LogProfilesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, logProfileName string, options *armmonitor.LogProfilesClientGetOptions) (resp azfake.Responder[armmonitor.LogProfilesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method LogProfilesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armmonitor.LogProfilesClientListOptions) (resp azfake.PagerResponder[armmonitor.LogProfilesClientListResponse]) - - // Update is the fake for method LogProfilesClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, logProfileName string, logProfilesResource armmonitor.LogProfileResourcePatch, options *armmonitor.LogProfilesClientUpdateOptions) (resp azfake.Responder[armmonitor.LogProfilesClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewLogProfilesServerTransport creates a new instance of LogProfilesServerTransport with the provided implementation. -// The returned LogProfilesServerTransport instance is connected to an instance of armmonitor.LogProfilesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewLogProfilesServerTransport(srv *LogProfilesServer) *LogProfilesServerTransport { - return &LogProfilesServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armmonitor.LogProfilesClientListResponse]](), - } -} - -// LogProfilesServerTransport connects instances of armmonitor.LogProfilesClient to instances of LogProfilesServer. -// Don't use this type directly, use NewLogProfilesServerTransport instead. -type LogProfilesServerTransport struct { - srv *LogProfilesServer - newListPager *tracker[azfake.PagerResponder[armmonitor.LogProfilesClientListResponse]] -} - -// Do implements the policy.Transporter interface for LogProfilesServerTransport. -func (l *LogProfilesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "LogProfilesClient.CreateOrUpdate": - resp, err = l.dispatchCreateOrUpdate(req) - case "LogProfilesClient.Delete": - resp, err = l.dispatchDelete(req) - case "LogProfilesClient.Get": - resp, err = l.dispatchGet(req) - case "LogProfilesClient.NewListPager": - resp, err = l.dispatchNewListPager(req) - case "LogProfilesClient.Update": - resp, err = l.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (l *LogProfilesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if l.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/logprofiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.LogProfileResource](req) - if err != nil { - return nil, err - } - logProfileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("logProfileName")]) - if err != nil { - return nil, err - } - respr, errRespr := l.srv.CreateOrUpdate(req.Context(), logProfileNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).LogProfileResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (l *LogProfilesServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if l.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/logprofiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - logProfileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("logProfileName")]) - if err != nil { - return nil, err - } - respr, errRespr := l.srv.Delete(req.Context(), logProfileNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (l *LogProfilesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if l.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/logprofiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - logProfileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("logProfileName")]) - if err != nil { - return nil, err - } - respr, errRespr := l.srv.Get(req.Context(), logProfileNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).LogProfileResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (l *LogProfilesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if l.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := l.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/logprofiles` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := l.srv.NewListPager(nil) - newListPager = &resp - l.newListPager.add(req, newListPager) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - l.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - l.newListPager.remove(req) - } - return resp, nil -} - -func (l *LogProfilesServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if l.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/logprofiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.LogProfileResourcePatch](req) - if err != nil { - return nil, err - } - logProfileNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("logProfileName")]) - if err != nil { - return nil, err - } - respr, errRespr := l.srv.Update(req.Context(), logProfileNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).LogProfileResource, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/metricalerts_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/metricalerts_server.go deleted file mode 100644 index a4eb7345ea8e..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/metricalerts_server.go +++ /dev/null @@ -1,307 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// MetricAlertsServer is a fake server for instances of the armmonitor.MetricAlertsClient type. -type MetricAlertsServer struct { - // CreateOrUpdate is the fake for method MetricAlertsClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK - CreateOrUpdate func(ctx context.Context, resourceGroupName string, ruleName string, parameters armmonitor.MetricAlertResource, options *armmonitor.MetricAlertsClientCreateOrUpdateOptions) (resp azfake.Responder[armmonitor.MetricAlertsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method MetricAlertsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, ruleName string, options *armmonitor.MetricAlertsClientDeleteOptions) (resp azfake.Responder[armmonitor.MetricAlertsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method MetricAlertsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, ruleName string, options *armmonitor.MetricAlertsClientGetOptions) (resp azfake.Responder[armmonitor.MetricAlertsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByResourceGroupPager is the fake for method MetricAlertsClient.NewListByResourceGroupPager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, options *armmonitor.MetricAlertsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmonitor.MetricAlertsClientListByResourceGroupResponse]) - - // NewListBySubscriptionPager is the fake for method MetricAlertsClient.NewListBySubscriptionPager - // HTTP status codes to indicate success: http.StatusOK - NewListBySubscriptionPager func(options *armmonitor.MetricAlertsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armmonitor.MetricAlertsClientListBySubscriptionResponse]) - - // Update is the fake for method MetricAlertsClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, ruleName string, parameters armmonitor.MetricAlertResourcePatch, options *armmonitor.MetricAlertsClientUpdateOptions) (resp azfake.Responder[armmonitor.MetricAlertsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewMetricAlertsServerTransport creates a new instance of MetricAlertsServerTransport with the provided implementation. -// The returned MetricAlertsServerTransport instance is connected to an instance of armmonitor.MetricAlertsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewMetricAlertsServerTransport(srv *MetricAlertsServer) *MetricAlertsServerTransport { - return &MetricAlertsServerTransport{ - srv: srv, - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmonitor.MetricAlertsClientListByResourceGroupResponse]](), - newListBySubscriptionPager: newTracker[azfake.PagerResponder[armmonitor.MetricAlertsClientListBySubscriptionResponse]](), - } -} - -// MetricAlertsServerTransport connects instances of armmonitor.MetricAlertsClient to instances of MetricAlertsServer. -// Don't use this type directly, use NewMetricAlertsServerTransport instead. -type MetricAlertsServerTransport struct { - srv *MetricAlertsServer - newListByResourceGroupPager *tracker[azfake.PagerResponder[armmonitor.MetricAlertsClientListByResourceGroupResponse]] - newListBySubscriptionPager *tracker[azfake.PagerResponder[armmonitor.MetricAlertsClientListBySubscriptionResponse]] -} - -// Do implements the policy.Transporter interface for MetricAlertsServerTransport. -func (m *MetricAlertsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "MetricAlertsClient.CreateOrUpdate": - resp, err = m.dispatchCreateOrUpdate(req) - case "MetricAlertsClient.Delete": - resp, err = m.dispatchDelete(req) - case "MetricAlertsClient.Get": - resp, err = m.dispatchGet(req) - case "MetricAlertsClient.NewListByResourceGroupPager": - resp, err = m.dispatchNewListByResourceGroupPager(req) - case "MetricAlertsClient.NewListBySubscriptionPager": - resp, err = m.dispatchNewListBySubscriptionPager(req) - case "MetricAlertsClient.Update": - resp, err = m.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (m *MetricAlertsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if m.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/metricAlerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.MetricAlertResource](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - ruleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleName")]) - if err != nil { - return nil, err - } - respr, errRespr := m.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, ruleNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MetricAlertResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (m *MetricAlertsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if m.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/metricAlerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - ruleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleName")]) - if err != nil { - return nil, err - } - respr, errRespr := m.srv.Delete(req.Context(), resourceGroupNameParam, ruleNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (m *MetricAlertsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if m.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/metricAlerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - ruleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleName")]) - if err != nil { - return nil, err - } - respr, errRespr := m.srv.Get(req.Context(), resourceGroupNameParam, ruleNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MetricAlertResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (m *MetricAlertsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { - if m.srv.NewListByResourceGroupPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} - } - newListByResourceGroupPager := m.newListByResourceGroupPager.get(req) - if newListByResourceGroupPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/metricAlerts` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resp := m.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) - newListByResourceGroupPager = &resp - m.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - } - resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - m.newListByResourceGroupPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByResourceGroupPager) { - m.newListByResourceGroupPager.remove(req) - } - return resp, nil -} - -func (m *MetricAlertsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { - if m.srv.NewListBySubscriptionPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} - } - newListBySubscriptionPager := m.newListBySubscriptionPager.get(req) - if newListBySubscriptionPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/metricAlerts` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := m.srv.NewListBySubscriptionPager(nil) - newListBySubscriptionPager = &resp - m.newListBySubscriptionPager.add(req, newListBySubscriptionPager) - } - resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - m.newListBySubscriptionPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListBySubscriptionPager) { - m.newListBySubscriptionPager.remove(req) - } - return resp, nil -} - -func (m *MetricAlertsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if m.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/metricAlerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.MetricAlertResourcePatch](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - ruleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleName")]) - if err != nil { - return nil, err - } - respr, errRespr := m.srv.Update(req.Context(), resourceGroupNameParam, ruleNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MetricAlertResource, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/metricalertsstatus_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/metricalertsstatus_server.go deleted file mode 100644 index 35302dcce43a..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/metricalertsstatus_server.go +++ /dev/null @@ -1,143 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// MetricAlertsStatusServer is a fake server for instances of the armmonitor.MetricAlertsStatusClient type. -type MetricAlertsStatusServer struct { - // List is the fake for method MetricAlertsStatusClient.List - // HTTP status codes to indicate success: http.StatusOK - List func(ctx context.Context, resourceGroupName string, ruleName string, options *armmonitor.MetricAlertsStatusClientListOptions) (resp azfake.Responder[armmonitor.MetricAlertsStatusClientListResponse], errResp azfake.ErrorResponder) - - // ListByName is the fake for method MetricAlertsStatusClient.ListByName - // HTTP status codes to indicate success: http.StatusOK - ListByName func(ctx context.Context, resourceGroupName string, ruleName string, statusName string, options *armmonitor.MetricAlertsStatusClientListByNameOptions) (resp azfake.Responder[armmonitor.MetricAlertsStatusClientListByNameResponse], errResp azfake.ErrorResponder) -} - -// NewMetricAlertsStatusServerTransport creates a new instance of MetricAlertsStatusServerTransport with the provided implementation. -// The returned MetricAlertsStatusServerTransport instance is connected to an instance of armmonitor.MetricAlertsStatusClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewMetricAlertsStatusServerTransport(srv *MetricAlertsStatusServer) *MetricAlertsStatusServerTransport { - return &MetricAlertsStatusServerTransport{srv: srv} -} - -// MetricAlertsStatusServerTransport connects instances of armmonitor.MetricAlertsStatusClient to instances of MetricAlertsStatusServer. -// Don't use this type directly, use NewMetricAlertsStatusServerTransport instead. -type MetricAlertsStatusServerTransport struct { - srv *MetricAlertsStatusServer -} - -// Do implements the policy.Transporter interface for MetricAlertsStatusServerTransport. -func (m *MetricAlertsStatusServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "MetricAlertsStatusClient.List": - resp, err = m.dispatchList(req) - case "MetricAlertsStatusClient.ListByName": - resp, err = m.dispatchListByName(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (m *MetricAlertsStatusServerTransport) dispatchList(req *http.Request) (*http.Response, error) { - if m.srv.List == nil { - return nil, &nonRetriableError{errors.New("fake for method List not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/metricAlerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/status` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - ruleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleName")]) - if err != nil { - return nil, err - } - respr, errRespr := m.srv.List(req.Context(), resourceGroupNameParam, ruleNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MetricAlertStatusCollection, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (m *MetricAlertsStatusServerTransport) dispatchListByName(req *http.Request) (*http.Response, error) { - if m.srv.ListByName == nil { - return nil, &nonRetriableError{errors.New("fake for method ListByName not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/metricAlerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/status/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - ruleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleName")]) - if err != nil { - return nil, err - } - statusNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("statusName")]) - if err != nil { - return nil, err - } - respr, errRespr := m.srv.ListByName(req.Context(), resourceGroupNameParam, ruleNameParam, statusNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MetricAlertStatusCollection, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/metricdefinitions_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/metricdefinitions_server.go deleted file mode 100644 index afd3650b01e3..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/metricdefinitions_server.go +++ /dev/null @@ -1,170 +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 ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// MetricDefinitionsServer is a fake server for instances of the armmonitor.MetricDefinitionsClient type. -type MetricDefinitionsServer struct { - // NewListPager is the fake for method MetricDefinitionsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceURI string, options *armmonitor.MetricDefinitionsClientListOptions) (resp azfake.PagerResponder[armmonitor.MetricDefinitionsClientListResponse]) - - // NewListAtSubscriptionScopePager is the fake for method MetricDefinitionsClient.NewListAtSubscriptionScopePager - // HTTP status codes to indicate success: http.StatusOK - NewListAtSubscriptionScopePager func(region string, options *armmonitor.MetricDefinitionsClientListAtSubscriptionScopeOptions) (resp azfake.PagerResponder[armmonitor.MetricDefinitionsClientListAtSubscriptionScopeResponse]) -} - -// NewMetricDefinitionsServerTransport creates a new instance of MetricDefinitionsServerTransport with the provided implementation. -// The returned MetricDefinitionsServerTransport instance is connected to an instance of armmonitor.MetricDefinitionsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewMetricDefinitionsServerTransport(srv *MetricDefinitionsServer) *MetricDefinitionsServerTransport { - return &MetricDefinitionsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armmonitor.MetricDefinitionsClientListResponse]](), - newListAtSubscriptionScopePager: newTracker[azfake.PagerResponder[armmonitor.MetricDefinitionsClientListAtSubscriptionScopeResponse]](), - } -} - -// MetricDefinitionsServerTransport connects instances of armmonitor.MetricDefinitionsClient to instances of MetricDefinitionsServer. -// Don't use this type directly, use NewMetricDefinitionsServerTransport instead. -type MetricDefinitionsServerTransport struct { - srv *MetricDefinitionsServer - newListPager *tracker[azfake.PagerResponder[armmonitor.MetricDefinitionsClientListResponse]] - newListAtSubscriptionScopePager *tracker[azfake.PagerResponder[armmonitor.MetricDefinitionsClientListAtSubscriptionScopeResponse]] -} - -// Do implements the policy.Transporter interface for MetricDefinitionsServerTransport. -func (m *MetricDefinitionsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "MetricDefinitionsClient.NewListPager": - resp, err = m.dispatchNewListPager(req) - case "MetricDefinitionsClient.NewListAtSubscriptionScopePager": - resp, err = m.dispatchNewListAtSubscriptionScopePager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (m *MetricDefinitionsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if m.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := m.newListPager.get(req) - if newListPager == nil { - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/metricDefinitions` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - metricnamespaceUnescaped, err := url.QueryUnescape(qp.Get("metricnamespace")) - if err != nil { - return nil, err - } - metricnamespaceParam := getOptional(metricnamespaceUnescaped) - var options *armmonitor.MetricDefinitionsClientListOptions - if metricnamespaceParam != nil { - options = &armmonitor.MetricDefinitionsClientListOptions{ - Metricnamespace: metricnamespaceParam, - } - } - resp := m.srv.NewListPager(resourceURIParam, options) - newListPager = &resp - m.newListPager.add(req, newListPager) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - m.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - m.newListPager.remove(req) - } - return resp, nil -} - -func (m *MetricDefinitionsServerTransport) dispatchNewListAtSubscriptionScopePager(req *http.Request) (*http.Response, error) { - if m.srv.NewListAtSubscriptionScopePager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListAtSubscriptionScopePager not implemented")} - } - newListAtSubscriptionScopePager := m.newListAtSubscriptionScopePager.get(req) - if newListAtSubscriptionScopePager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/metricDefinitions` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - regionParam, err := url.QueryUnescape(qp.Get("region")) - if err != nil { - return nil, err - } - metricnamespaceUnescaped, err := url.QueryUnescape(qp.Get("metricnamespace")) - if err != nil { - return nil, err - } - metricnamespaceParam := getOptional(metricnamespaceUnescaped) - var options *armmonitor.MetricDefinitionsClientListAtSubscriptionScopeOptions - if metricnamespaceParam != nil { - options = &armmonitor.MetricDefinitionsClientListAtSubscriptionScopeOptions{ - Metricnamespace: metricnamespaceParam, - } - } - resp := m.srv.NewListAtSubscriptionScopePager(regionParam, options) - newListAtSubscriptionScopePager = &resp - m.newListAtSubscriptionScopePager.add(req, newListAtSubscriptionScopePager) - } - resp, err := server.PagerResponderNext(newListAtSubscriptionScopePager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - m.newListAtSubscriptionScopePager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListAtSubscriptionScopePager) { - m.newListAtSubscriptionScopePager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/metricnamespaces_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/metricnamespaces_server.go deleted file mode 100644 index 5ba4bd337806..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/metricnamespaces_server.go +++ /dev/null @@ -1,116 +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 ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// MetricNamespacesServer is a fake server for instances of the armmonitor.MetricNamespacesClient type. -type MetricNamespacesServer struct { - // NewListPager is the fake for method MetricNamespacesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceURI string, options *armmonitor.MetricNamespacesClientListOptions) (resp azfake.PagerResponder[armmonitor.MetricNamespacesClientListResponse]) -} - -// NewMetricNamespacesServerTransport creates a new instance of MetricNamespacesServerTransport with the provided implementation. -// The returned MetricNamespacesServerTransport instance is connected to an instance of armmonitor.MetricNamespacesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewMetricNamespacesServerTransport(srv *MetricNamespacesServer) *MetricNamespacesServerTransport { - return &MetricNamespacesServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armmonitor.MetricNamespacesClientListResponse]](), - } -} - -// MetricNamespacesServerTransport connects instances of armmonitor.MetricNamespacesClient to instances of MetricNamespacesServer. -// Don't use this type directly, use NewMetricNamespacesServerTransport instead. -type MetricNamespacesServerTransport struct { - srv *MetricNamespacesServer - newListPager *tracker[azfake.PagerResponder[armmonitor.MetricNamespacesClientListResponse]] -} - -// Do implements the policy.Transporter interface for MetricNamespacesServerTransport. -func (m *MetricNamespacesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "MetricNamespacesClient.NewListPager": - resp, err = m.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (m *MetricNamespacesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if m.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := m.newListPager.get(req) - if newListPager == nil { - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/microsoft\.insights/metricNamespaces` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - startTimeUnescaped, err := url.QueryUnescape(qp.Get("startTime")) - if err != nil { - return nil, err - } - startTimeParam := getOptional(startTimeUnescaped) - var options *armmonitor.MetricNamespacesClientListOptions - if startTimeParam != nil { - options = &armmonitor.MetricNamespacesClientListOptions{ - StartTime: startTimeParam, - } - } - resp := m.srv.NewListPager(resourceURIParam, options) - newListPager = &resp - m.newListPager.add(req, newListPager) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - m.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - m.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/metrics_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/metrics_server.go deleted file mode 100644 index 32e178fddda3..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/metrics_server.go +++ /dev/null @@ -1,434 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "reflect" - "regexp" - "strconv" -) - -// MetricsServer is a fake server for instances of the armmonitor.MetricsClient type. -type MetricsServer struct { - // List is the fake for method MetricsClient.List - // HTTP status codes to indicate success: http.StatusOK - List func(ctx context.Context, resourceURI string, options *armmonitor.MetricsClientListOptions) (resp azfake.Responder[armmonitor.MetricsClientListResponse], errResp azfake.ErrorResponder) - - // ListAtSubscriptionScope is the fake for method MetricsClient.ListAtSubscriptionScope - // HTTP status codes to indicate success: http.StatusOK - ListAtSubscriptionScope func(ctx context.Context, region string, options *armmonitor.MetricsClientListAtSubscriptionScopeOptions) (resp azfake.Responder[armmonitor.MetricsClientListAtSubscriptionScopeResponse], errResp azfake.ErrorResponder) - - // ListAtSubscriptionScopePost is the fake for method MetricsClient.ListAtSubscriptionScopePost - // HTTP status codes to indicate success: http.StatusOK - ListAtSubscriptionScopePost func(ctx context.Context, region string, options *armmonitor.MetricsClientListAtSubscriptionScopePostOptions) (resp azfake.Responder[armmonitor.MetricsClientListAtSubscriptionScopePostResponse], errResp azfake.ErrorResponder) -} - -// NewMetricsServerTransport creates a new instance of MetricsServerTransport with the provided implementation. -// The returned MetricsServerTransport instance is connected to an instance of armmonitor.MetricsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewMetricsServerTransport(srv *MetricsServer) *MetricsServerTransport { - return &MetricsServerTransport{srv: srv} -} - -// MetricsServerTransport connects instances of armmonitor.MetricsClient to instances of MetricsServer. -// Don't use this type directly, use NewMetricsServerTransport instead. -type MetricsServerTransport struct { - srv *MetricsServer -} - -// Do implements the policy.Transporter interface for MetricsServerTransport. -func (m *MetricsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "MetricsClient.List": - resp, err = m.dispatchList(req) - case "MetricsClient.ListAtSubscriptionScope": - resp, err = m.dispatchListAtSubscriptionScope(req) - case "MetricsClient.ListAtSubscriptionScopePost": - resp, err = m.dispatchListAtSubscriptionScopePost(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (m *MetricsServerTransport) dispatchList(req *http.Request) (*http.Response, error) { - if m.srv.List == nil { - return nil, &nonRetriableError{errors.New("fake for method List not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/metrics` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - timespanUnescaped, err := url.QueryUnescape(qp.Get("timespan")) - if err != nil { - return nil, err - } - timespanParam := getOptional(timespanUnescaped) - intervalUnescaped, err := url.QueryUnescape(qp.Get("interval")) - if err != nil { - return nil, err - } - intervalParam := getOptional(intervalUnescaped) - metricnamesUnescaped, err := url.QueryUnescape(qp.Get("metricnames")) - if err != nil { - return nil, err - } - metricnamesParam := getOptional(metricnamesUnescaped) - aggregationUnescaped, err := url.QueryUnescape(qp.Get("aggregation")) - if err != nil { - return nil, err - } - aggregationParam := getOptional(aggregationUnescaped) - topUnescaped, err := url.QueryUnescape(qp.Get("top")) - if err != nil { - return nil, err - } - topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { - p, parseErr := strconv.ParseInt(v, 10, 32) - if parseErr != nil { - return 0, parseErr - } - return int32(p), nil - }) - if err != nil { - return nil, err - } - orderbyUnescaped, err := url.QueryUnescape(qp.Get("orderby")) - if err != nil { - return nil, err - } - orderbyParam := getOptional(orderbyUnescaped) - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - resultTypeUnescaped, err := url.QueryUnescape(qp.Get("resultType")) - if err != nil { - return nil, err - } - resultTypeParam := getOptional(armmonitor.ResultType(resultTypeUnescaped)) - metricnamespaceUnescaped, err := url.QueryUnescape(qp.Get("metricnamespace")) - if err != nil { - return nil, err - } - metricnamespaceParam := getOptional(metricnamespaceUnescaped) - autoAdjustTimegrainUnescaped, err := url.QueryUnescape(qp.Get("AutoAdjustTimegrain")) - if err != nil { - return nil, err - } - autoAdjustTimegrainParam, err := parseOptional(autoAdjustTimegrainUnescaped, strconv.ParseBool) - if err != nil { - return nil, err - } - validateDimensionsUnescaped, err := url.QueryUnescape(qp.Get("ValidateDimensions")) - if err != nil { - return nil, err - } - validateDimensionsParam, err := parseOptional(validateDimensionsUnescaped, strconv.ParseBool) - if err != nil { - return nil, err - } - var options *armmonitor.MetricsClientListOptions - if timespanParam != nil || intervalParam != nil || metricnamesParam != nil || aggregationParam != nil || topParam != nil || orderbyParam != nil || filterParam != nil || resultTypeParam != nil || metricnamespaceParam != nil || autoAdjustTimegrainParam != nil || validateDimensionsParam != nil { - options = &armmonitor.MetricsClientListOptions{ - Timespan: timespanParam, - Interval: intervalParam, - Metricnames: metricnamesParam, - Aggregation: aggregationParam, - Top: topParam, - Orderby: orderbyParam, - Filter: filterParam, - ResultType: resultTypeParam, - Metricnamespace: metricnamespaceParam, - AutoAdjustTimegrain: autoAdjustTimegrainParam, - ValidateDimensions: validateDimensionsParam, - } - } - respr, errRespr := m.srv.List(req.Context(), resourceURIParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Response, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (m *MetricsServerTransport) dispatchListAtSubscriptionScope(req *http.Request) (*http.Response, error) { - if m.srv.ListAtSubscriptionScope == nil { - return nil, &nonRetriableError{errors.New("fake for method ListAtSubscriptionScope not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/metrics` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - regionParam, err := url.QueryUnescape(qp.Get("region")) - if err != nil { - return nil, err - } - timespanUnescaped, err := url.QueryUnescape(qp.Get("timespan")) - if err != nil { - return nil, err - } - timespanParam := getOptional(timespanUnescaped) - intervalUnescaped, err := url.QueryUnescape(qp.Get("interval")) - if err != nil { - return nil, err - } - intervalParam := getOptional(intervalUnescaped) - metricnamesUnescaped, err := url.QueryUnescape(qp.Get("metricnames")) - if err != nil { - return nil, err - } - metricnamesParam := getOptional(metricnamesUnescaped) - aggregationUnescaped, err := url.QueryUnescape(qp.Get("aggregation")) - if err != nil { - return nil, err - } - aggregationParam := getOptional(aggregationUnescaped) - topUnescaped, err := url.QueryUnescape(qp.Get("top")) - if err != nil { - return nil, err - } - topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { - p, parseErr := strconv.ParseInt(v, 10, 32) - if parseErr != nil { - return 0, parseErr - } - return int32(p), nil - }) - if err != nil { - return nil, err - } - orderbyUnescaped, err := url.QueryUnescape(qp.Get("orderby")) - if err != nil { - return nil, err - } - orderbyParam := getOptional(orderbyUnescaped) - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - resultTypeUnescaped, err := url.QueryUnescape(qp.Get("resultType")) - if err != nil { - return nil, err - } - resultTypeParam := getOptional(armmonitor.MetricResultType(resultTypeUnescaped)) - metricnamespaceUnescaped, err := url.QueryUnescape(qp.Get("metricnamespace")) - if err != nil { - return nil, err - } - metricnamespaceParam := getOptional(metricnamespaceUnescaped) - autoAdjustTimegrainUnescaped, err := url.QueryUnescape(qp.Get("AutoAdjustTimegrain")) - if err != nil { - return nil, err - } - autoAdjustTimegrainParam, err := parseOptional(autoAdjustTimegrainUnescaped, strconv.ParseBool) - if err != nil { - return nil, err - } - validateDimensionsUnescaped, err := url.QueryUnescape(qp.Get("ValidateDimensions")) - if err != nil { - return nil, err - } - validateDimensionsParam, err := parseOptional(validateDimensionsUnescaped, strconv.ParseBool) - if err != nil { - return nil, err - } - var options *armmonitor.MetricsClientListAtSubscriptionScopeOptions - if timespanParam != nil || intervalParam != nil || metricnamesParam != nil || aggregationParam != nil || topParam != nil || orderbyParam != nil || filterParam != nil || resultTypeParam != nil || metricnamespaceParam != nil || autoAdjustTimegrainParam != nil || validateDimensionsParam != nil { - options = &armmonitor.MetricsClientListAtSubscriptionScopeOptions{ - Timespan: timespanParam, - Interval: intervalParam, - Metricnames: metricnamesParam, - Aggregation: aggregationParam, - Top: topParam, - Orderby: orderbyParam, - Filter: filterParam, - ResultType: resultTypeParam, - Metricnamespace: metricnamespaceParam, - AutoAdjustTimegrain: autoAdjustTimegrainParam, - ValidateDimensions: validateDimensionsParam, - } - } - respr, errRespr := m.srv.ListAtSubscriptionScope(req.Context(), regionParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SubscriptionScopeMetricResponse, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (m *MetricsServerTransport) dispatchListAtSubscriptionScopePost(req *http.Request) (*http.Response, error) { - if m.srv.ListAtSubscriptionScopePost == nil { - return nil, &nonRetriableError{errors.New("fake for method ListAtSubscriptionScopePost not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/metrics` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - body, err := server.UnmarshalRequestAsJSON[armmonitor.SubscriptionScopeMetricsRequestBodyParameters](req) - if err != nil { - return nil, err - } - regionParam, err := url.QueryUnescape(qp.Get("region")) - if err != nil { - return nil, err - } - timespanUnescaped, err := url.QueryUnescape(qp.Get("timespan")) - if err != nil { - return nil, err - } - timespanParam := getOptional(timespanUnescaped) - intervalUnescaped, err := url.QueryUnescape(qp.Get("interval")) - if err != nil { - return nil, err - } - intervalParam := getOptional(intervalUnescaped) - metricnamesUnescaped, err := url.QueryUnescape(qp.Get("metricnames")) - if err != nil { - return nil, err - } - metricnamesParam := getOptional(metricnamesUnescaped) - aggregationUnescaped, err := url.QueryUnescape(qp.Get("aggregation")) - if err != nil { - return nil, err - } - aggregationParam := getOptional(aggregationUnescaped) - topUnescaped, err := url.QueryUnescape(qp.Get("top")) - if err != nil { - return nil, err - } - topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { - p, parseErr := strconv.ParseInt(v, 10, 32) - if parseErr != nil { - return 0, parseErr - } - return int32(p), nil - }) - if err != nil { - return nil, err - } - orderbyUnescaped, err := url.QueryUnescape(qp.Get("orderby")) - if err != nil { - return nil, err - } - orderbyParam := getOptional(orderbyUnescaped) - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - resultTypeUnescaped, err := url.QueryUnescape(qp.Get("resultType")) - if err != nil { - return nil, err - } - resultTypeParam := getOptional(armmonitor.MetricResultType(resultTypeUnescaped)) - metricnamespaceUnescaped, err := url.QueryUnescape(qp.Get("metricnamespace")) - if err != nil { - return nil, err - } - metricnamespaceParam := getOptional(metricnamespaceUnescaped) - autoAdjustTimegrainUnescaped, err := url.QueryUnescape(qp.Get("AutoAdjustTimegrain")) - if err != nil { - return nil, err - } - autoAdjustTimegrainParam, err := parseOptional(autoAdjustTimegrainUnescaped, strconv.ParseBool) - if err != nil { - return nil, err - } - validateDimensionsUnescaped, err := url.QueryUnescape(qp.Get("ValidateDimensions")) - if err != nil { - return nil, err - } - validateDimensionsParam, err := parseOptional(validateDimensionsUnescaped, strconv.ParseBool) - if err != nil { - return nil, err - } - var options *armmonitor.MetricsClientListAtSubscriptionScopePostOptions - if timespanParam != nil || intervalParam != nil || metricnamesParam != nil || aggregationParam != nil || topParam != nil || orderbyParam != nil || filterParam != nil || resultTypeParam != nil || metricnamespaceParam != nil || autoAdjustTimegrainParam != nil || validateDimensionsParam != nil || !reflect.ValueOf(body).IsZero() { - options = &armmonitor.MetricsClientListAtSubscriptionScopePostOptions{ - Timespan: timespanParam, - Interval: intervalParam, - Metricnames: metricnamesParam, - Aggregation: aggregationParam, - Top: topParam, - Orderby: orderbyParam, - Filter: filterParam, - ResultType: resultTypeParam, - Metricnamespace: metricnamespaceParam, - AutoAdjustTimegrain: autoAdjustTimegrainParam, - ValidateDimensions: validateDimensionsParam, - Body: &body, - } - } - respr, errRespr := m.srv.ListAtSubscriptionScopePost(req.Context(), regionParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SubscriptionScopeMetricResponse, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/operations_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/operations_server.go deleted file mode 100644 index 3f4ae743691f..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/operations_server.go +++ /dev/null @@ -1,84 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" -) - -// OperationsServer is a fake server for instances of the armmonitor.OperationsClient type. -type OperationsServer struct { - // List is the fake for method OperationsClient.List - // HTTP status codes to indicate success: http.StatusOK - List func(ctx context.Context, options *armmonitor.OperationsClientListOptions) (resp azfake.Responder[armmonitor.OperationsClientListResponse], errResp azfake.ErrorResponder) -} - -// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. -// The returned OperationsServerTransport instance is connected to an instance of armmonitor.OperationsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { - return &OperationsServerTransport{srv: srv} -} - -// OperationsServerTransport connects instances of armmonitor.OperationsClient to instances of OperationsServer. -// Don't use this type directly, use NewOperationsServerTransport instead. -type OperationsServerTransport struct { - srv *OperationsServer -} - -// Do implements the policy.Transporter interface for OperationsServerTransport. -func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "OperationsClient.List": - resp, err = o.dispatchList(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (o *OperationsServerTransport) dispatchList(req *http.Request) (*http.Response, error) { - if o.srv.List == nil { - return nil, &nonRetriableError{errors.New("fake for method List not implemented")} - } - respr, errRespr := o.srv.List(req.Context(), nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationListResult, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/operationsformonitor_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/operationsformonitor_server.go deleted file mode 100644 index 7139e7b074ac..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/operationsformonitor_server.go +++ /dev/null @@ -1,96 +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 ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" -) - -// OperationsForMonitorServer is a fake server for instances of the armmonitor.OperationsForMonitorClient type. -type OperationsForMonitorServer struct { - // NewListPager is the fake for method OperationsForMonitorClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armmonitor.OperationsForMonitorClientListOptions) (resp azfake.PagerResponder[armmonitor.OperationsForMonitorClientListResponse]) -} - -// NewOperationsForMonitorServerTransport creates a new instance of OperationsForMonitorServerTransport with the provided implementation. -// The returned OperationsForMonitorServerTransport instance is connected to an instance of armmonitor.OperationsForMonitorClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewOperationsForMonitorServerTransport(srv *OperationsForMonitorServer) *OperationsForMonitorServerTransport { - return &OperationsForMonitorServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armmonitor.OperationsForMonitorClientListResponse]](), - } -} - -// OperationsForMonitorServerTransport connects instances of armmonitor.OperationsForMonitorClient to instances of OperationsForMonitorServer. -// Don't use this type directly, use NewOperationsForMonitorServerTransport instead. -type OperationsForMonitorServerTransport struct { - srv *OperationsForMonitorServer - newListPager *tracker[azfake.PagerResponder[armmonitor.OperationsForMonitorClientListResponse]] -} - -// Do implements the policy.Transporter interface for OperationsForMonitorServerTransport. -func (o *OperationsForMonitorServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "OperationsForMonitorClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (o *OperationsForMonitorServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if o.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := o.newListPager.get(req) - if newListPager == nil { - resp := o.srv.NewListPager(nil) - newListPager = &resp - o.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armmonitor.OperationsForMonitorClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - o.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - o.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/predictivemetric_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/predictivemetric_server.go deleted file mode 100644 index 2bceeeeb5b2a..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/predictivemetric_server.go +++ /dev/null @@ -1,121 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// PredictiveMetricServer is a fake server for instances of the armmonitor.PredictiveMetricClient type. -type PredictiveMetricServer struct { - // Get is the fake for method PredictiveMetricClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, autoscaleSettingName string, timespan string, interval string, metricNamespace string, metricName string, aggregation string, options *armmonitor.PredictiveMetricClientGetOptions) (resp azfake.Responder[armmonitor.PredictiveMetricClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewPredictiveMetricServerTransport creates a new instance of PredictiveMetricServerTransport with the provided implementation. -// The returned PredictiveMetricServerTransport instance is connected to an instance of armmonitor.PredictiveMetricClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewPredictiveMetricServerTransport(srv *PredictiveMetricServer) *PredictiveMetricServerTransport { - return &PredictiveMetricServerTransport{srv: srv} -} - -// PredictiveMetricServerTransport connects instances of armmonitor.PredictiveMetricClient to instances of PredictiveMetricServer. -// Don't use this type directly, use NewPredictiveMetricServerTransport instead. -type PredictiveMetricServerTransport struct { - srv *PredictiveMetricServer -} - -// Do implements the policy.Transporter interface for PredictiveMetricServerTransport. -func (p *PredictiveMetricServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "PredictiveMetricClient.Get": - resp, err = p.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *PredictiveMetricServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/autoscalesettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/predictiveMetrics` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - autoscaleSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("autoscaleSettingName")]) - if err != nil { - return nil, err - } - timespanParam, err := url.QueryUnescape(qp.Get("timespan")) - if err != nil { - return nil, err - } - intervalParam, err := url.QueryUnescape(qp.Get("interval")) - if err != nil { - return nil, err - } - metricNamespaceParam, err := url.QueryUnescape(qp.Get("metricNamespace")) - if err != nil { - return nil, err - } - metricNameParam, err := url.QueryUnescape(qp.Get("metricName")) - if err != nil { - return nil, err - } - aggregationParam, err := url.QueryUnescape(qp.Get("aggregation")) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, autoscaleSettingNameParam, timespanParam, intervalParam, metricNamespaceParam, metricNameParam, aggregationParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PredictiveResponse, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/privateendpointconnections_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/privateendpointconnections_server.go deleted file mode 100644 index 7c92dd7db08d..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/privateendpointconnections_server.go +++ /dev/null @@ -1,261 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// PrivateEndpointConnectionsServer is a fake server for instances of the armmonitor.PrivateEndpointConnectionsClient type. -type PrivateEndpointConnectionsServer struct { - // BeginCreateOrUpdate is the fake for method PrivateEndpointConnectionsClient.BeginCreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters armmonitor.PrivateEndpointConnection, options *armmonitor.PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armmonitor.PrivateEndpointConnectionsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method PrivateEndpointConnectionsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, options *armmonitor.PrivateEndpointConnectionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armmonitor.PrivateEndpointConnectionsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method PrivateEndpointConnectionsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, options *armmonitor.PrivateEndpointConnectionsClientGetOptions) (resp azfake.Responder[armmonitor.PrivateEndpointConnectionsClientGetResponse], errResp azfake.ErrorResponder) - - // ListByPrivateLinkScope is the fake for method PrivateEndpointConnectionsClient.ListByPrivateLinkScope - // HTTP status codes to indicate success: http.StatusOK - ListByPrivateLinkScope func(ctx context.Context, resourceGroupName string, scopeName string, options *armmonitor.PrivateEndpointConnectionsClientListByPrivateLinkScopeOptions) (resp azfake.Responder[armmonitor.PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse], errResp azfake.ErrorResponder) -} - -// NewPrivateEndpointConnectionsServerTransport creates a new instance of PrivateEndpointConnectionsServerTransport with the provided implementation. -// The returned PrivateEndpointConnectionsServerTransport instance is connected to an instance of armmonitor.PrivateEndpointConnectionsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewPrivateEndpointConnectionsServerTransport(srv *PrivateEndpointConnectionsServer) *PrivateEndpointConnectionsServerTransport { - return &PrivateEndpointConnectionsServerTransport{ - srv: srv, - beginCreateOrUpdate: newTracker[azfake.PollerResponder[armmonitor.PrivateEndpointConnectionsClientCreateOrUpdateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armmonitor.PrivateEndpointConnectionsClientDeleteResponse]](), - } -} - -// PrivateEndpointConnectionsServerTransport connects instances of armmonitor.PrivateEndpointConnectionsClient to instances of PrivateEndpointConnectionsServer. -// Don't use this type directly, use NewPrivateEndpointConnectionsServerTransport instead. -type PrivateEndpointConnectionsServerTransport struct { - srv *PrivateEndpointConnectionsServer - beginCreateOrUpdate *tracker[azfake.PollerResponder[armmonitor.PrivateEndpointConnectionsClientCreateOrUpdateResponse]] - beginDelete *tracker[azfake.PollerResponder[armmonitor.PrivateEndpointConnectionsClientDeleteResponse]] -} - -// Do implements the policy.Transporter interface for PrivateEndpointConnectionsServerTransport. -func (p *PrivateEndpointConnectionsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "PrivateEndpointConnectionsClient.BeginCreateOrUpdate": - resp, err = p.dispatchBeginCreateOrUpdate(req) - case "PrivateEndpointConnectionsClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "PrivateEndpointConnectionsClient.Get": - resp, err = p.dispatchGet(req) - case "PrivateEndpointConnectionsClient.ListByPrivateLinkScope": - resp, err = p.dispatchListByPrivateLinkScope(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { - if p.srv.BeginCreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} - } - beginCreateOrUpdate := p.beginCreateOrUpdate.get(req) - if beginCreateOrUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/privateLinkScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.PrivateEndpointConnection](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - scopeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeName")]) - if err != nil { - return nil, err - } - privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, scopeNameParam, privateEndpointConnectionNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreateOrUpdate = &respr - p.beginCreateOrUpdate.add(req, beginCreateOrUpdate) - } - - resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - p.beginCreateOrUpdate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginCreateOrUpdate) { - p.beginCreateOrUpdate.remove(req) - } - - return resp, nil -} - -func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if p.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - beginDelete := p.beginDelete.get(req) - if beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/privateLinkScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - scopeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeName")]) - if err != nil { - return nil, err - } - privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, scopeNameParam, privateEndpointConnectionNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginDelete = &respr - p.beginDelete.add(req, beginDelete) - } - - resp, err := server.PollerResponderNext(beginDelete, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - p.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(beginDelete) { - p.beginDelete.remove(req) - } - - return resp, nil -} - -func (p *PrivateEndpointConnectionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/privateLinkScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - scopeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeName")]) - if err != nil { - return nil, err - } - privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, scopeNameParam, privateEndpointConnectionNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnection, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (p *PrivateEndpointConnectionsServerTransport) dispatchListByPrivateLinkScope(req *http.Request) (*http.Response, error) { - if p.srv.ListByPrivateLinkScope == nil { - return nil, &nonRetriableError{errors.New("fake for method ListByPrivateLinkScope not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/privateLinkScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - scopeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.ListByPrivateLinkScope(req.Context(), resourceGroupNameParam, scopeNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnectionListResult, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkresources_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkresources_server.go deleted file mode 100644 index 5aff24a0df43..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkresources_server.go +++ /dev/null @@ -1,143 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// PrivateLinkResourcesServer is a fake server for instances of the armmonitor.PrivateLinkResourcesClient type. -type PrivateLinkResourcesServer struct { - // Get is the fake for method PrivateLinkResourcesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, scopeName string, groupName string, options *armmonitor.PrivateLinkResourcesClientGetOptions) (resp azfake.Responder[armmonitor.PrivateLinkResourcesClientGetResponse], errResp azfake.ErrorResponder) - - // ListByPrivateLinkScope is the fake for method PrivateLinkResourcesClient.ListByPrivateLinkScope - // HTTP status codes to indicate success: http.StatusOK - ListByPrivateLinkScope func(ctx context.Context, resourceGroupName string, scopeName string, options *armmonitor.PrivateLinkResourcesClientListByPrivateLinkScopeOptions) (resp azfake.Responder[armmonitor.PrivateLinkResourcesClientListByPrivateLinkScopeResponse], errResp azfake.ErrorResponder) -} - -// NewPrivateLinkResourcesServerTransport creates a new instance of PrivateLinkResourcesServerTransport with the provided implementation. -// The returned PrivateLinkResourcesServerTransport instance is connected to an instance of armmonitor.PrivateLinkResourcesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewPrivateLinkResourcesServerTransport(srv *PrivateLinkResourcesServer) *PrivateLinkResourcesServerTransport { - return &PrivateLinkResourcesServerTransport{srv: srv} -} - -// PrivateLinkResourcesServerTransport connects instances of armmonitor.PrivateLinkResourcesClient to instances of PrivateLinkResourcesServer. -// Don't use this type directly, use NewPrivateLinkResourcesServerTransport instead. -type PrivateLinkResourcesServerTransport struct { - srv *PrivateLinkResourcesServer -} - -// Do implements the policy.Transporter interface for PrivateLinkResourcesServerTransport. -func (p *PrivateLinkResourcesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "PrivateLinkResourcesClient.Get": - resp, err = p.dispatchGet(req) - case "PrivateLinkResourcesClient.ListByPrivateLinkScope": - resp, err = p.dispatchListByPrivateLinkScope(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *PrivateLinkResourcesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/privateLinkScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - scopeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeName")]) - if err != nil { - return nil, err - } - groupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, scopeNameParam, groupNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateLinkResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (p *PrivateLinkResourcesServerTransport) dispatchListByPrivateLinkScope(req *http.Request) (*http.Response, error) { - if p.srv.ListByPrivateLinkScope == nil { - return nil, &nonRetriableError{errors.New("fake for method ListByPrivateLinkScope not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/privateLinkScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - scopeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.ListByPrivateLinkScope(req.Context(), resourceGroupNameParam, scopeNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateLinkResourceListResult, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkscopedresources_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkscopedresources_server.go deleted file mode 100644 index ca595081aa3e..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkscopedresources_server.go +++ /dev/null @@ -1,272 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// PrivateLinkScopedResourcesServer is a fake server for instances of the armmonitor.PrivateLinkScopedResourcesClient type. -type PrivateLinkScopedResourcesServer struct { - // BeginCreateOrUpdate is the fake for method PrivateLinkScopedResourcesClient.BeginCreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated, http.StatusAccepted - BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, scopeName string, name string, parameters armmonitor.ScopedResource, options *armmonitor.PrivateLinkScopedResourcesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armmonitor.PrivateLinkScopedResourcesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method PrivateLinkScopedResourcesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, scopeName string, name string, options *armmonitor.PrivateLinkScopedResourcesClientBeginDeleteOptions) (resp azfake.PollerResponder[armmonitor.PrivateLinkScopedResourcesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method PrivateLinkScopedResourcesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, scopeName string, name string, options *armmonitor.PrivateLinkScopedResourcesClientGetOptions) (resp azfake.Responder[armmonitor.PrivateLinkScopedResourcesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByPrivateLinkScopePager is the fake for method PrivateLinkScopedResourcesClient.NewListByPrivateLinkScopePager - // HTTP status codes to indicate success: http.StatusOK - NewListByPrivateLinkScopePager func(resourceGroupName string, scopeName string, options *armmonitor.PrivateLinkScopedResourcesClientListByPrivateLinkScopeOptions) (resp azfake.PagerResponder[armmonitor.PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse]) -} - -// NewPrivateLinkScopedResourcesServerTransport creates a new instance of PrivateLinkScopedResourcesServerTransport with the provided implementation. -// The returned PrivateLinkScopedResourcesServerTransport instance is connected to an instance of armmonitor.PrivateLinkScopedResourcesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewPrivateLinkScopedResourcesServerTransport(srv *PrivateLinkScopedResourcesServer) *PrivateLinkScopedResourcesServerTransport { - return &PrivateLinkScopedResourcesServerTransport{ - srv: srv, - beginCreateOrUpdate: newTracker[azfake.PollerResponder[armmonitor.PrivateLinkScopedResourcesClientCreateOrUpdateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armmonitor.PrivateLinkScopedResourcesClientDeleteResponse]](), - newListByPrivateLinkScopePager: newTracker[azfake.PagerResponder[armmonitor.PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse]](), - } -} - -// PrivateLinkScopedResourcesServerTransport connects instances of armmonitor.PrivateLinkScopedResourcesClient to instances of PrivateLinkScopedResourcesServer. -// Don't use this type directly, use NewPrivateLinkScopedResourcesServerTransport instead. -type PrivateLinkScopedResourcesServerTransport struct { - srv *PrivateLinkScopedResourcesServer - beginCreateOrUpdate *tracker[azfake.PollerResponder[armmonitor.PrivateLinkScopedResourcesClientCreateOrUpdateResponse]] - beginDelete *tracker[azfake.PollerResponder[armmonitor.PrivateLinkScopedResourcesClientDeleteResponse]] - newListByPrivateLinkScopePager *tracker[azfake.PagerResponder[armmonitor.PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse]] -} - -// Do implements the policy.Transporter interface for PrivateLinkScopedResourcesServerTransport. -func (p *PrivateLinkScopedResourcesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "PrivateLinkScopedResourcesClient.BeginCreateOrUpdate": - resp, err = p.dispatchBeginCreateOrUpdate(req) - case "PrivateLinkScopedResourcesClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "PrivateLinkScopedResourcesClient.Get": - resp, err = p.dispatchGet(req) - case "PrivateLinkScopedResourcesClient.NewListByPrivateLinkScopePager": - resp, err = p.dispatchNewListByPrivateLinkScopePager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *PrivateLinkScopedResourcesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { - if p.srv.BeginCreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} - } - beginCreateOrUpdate := p.beginCreateOrUpdate.get(req) - if beginCreateOrUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/privateLinkScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/scopedResources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.ScopedResource](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - scopeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeName")]) - if err != nil { - return nil, err - } - nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, scopeNameParam, nameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreateOrUpdate = &respr - p.beginCreateOrUpdate.add(req, beginCreateOrUpdate) - } - - resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated, http.StatusAccepted}, resp.StatusCode) { - p.beginCreateOrUpdate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginCreateOrUpdate) { - p.beginCreateOrUpdate.remove(req) - } - - return resp, nil -} - -func (p *PrivateLinkScopedResourcesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if p.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - beginDelete := p.beginDelete.get(req) - if beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/privateLinkScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/scopedResources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - scopeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeName")]) - if err != nil { - return nil, err - } - nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, scopeNameParam, nameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginDelete = &respr - p.beginDelete.add(req, beginDelete) - } - - resp, err := server.PollerResponderNext(beginDelete, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - p.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(beginDelete) { - p.beginDelete.remove(req) - } - - return resp, nil -} - -func (p *PrivateLinkScopedResourcesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/privateLinkScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/scopedResources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - scopeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeName")]) - if err != nil { - return nil, err - } - nameParam, err := url.PathUnescape(matches[regex.SubexpIndex("name")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, scopeNameParam, nameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ScopedResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (p *PrivateLinkScopedResourcesServerTransport) dispatchNewListByPrivateLinkScopePager(req *http.Request) (*http.Response, error) { - if p.srv.NewListByPrivateLinkScopePager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByPrivateLinkScopePager not implemented")} - } - newListByPrivateLinkScopePager := p.newListByPrivateLinkScopePager.get(req) - if newListByPrivateLinkScopePager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/privateLinkScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/scopedResources` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - scopeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeName")]) - if err != nil { - return nil, err - } - resp := p.srv.NewListByPrivateLinkScopePager(resourceGroupNameParam, scopeNameParam, nil) - newListByPrivateLinkScopePager = &resp - p.newListByPrivateLinkScopePager.add(req, newListByPrivateLinkScopePager) - server.PagerResponderInjectNextLinks(newListByPrivateLinkScopePager, req, func(page *armmonitor.PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByPrivateLinkScopePager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - p.newListByPrivateLinkScopePager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByPrivateLinkScopePager) { - p.newListByPrivateLinkScopePager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkscopeoperationstatus_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkscopeoperationstatus_server.go deleted file mode 100644 index c446302a7e6d..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkscopeoperationstatus_server.go +++ /dev/null @@ -1,100 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// PrivateLinkScopeOperationStatusServer is a fake server for instances of the armmonitor.PrivateLinkScopeOperationStatusClient type. -type PrivateLinkScopeOperationStatusServer struct { - // Get is the fake for method PrivateLinkScopeOperationStatusClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, asyncOperationID string, resourceGroupName string, options *armmonitor.PrivateLinkScopeOperationStatusClientGetOptions) (resp azfake.Responder[armmonitor.PrivateLinkScopeOperationStatusClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewPrivateLinkScopeOperationStatusServerTransport creates a new instance of PrivateLinkScopeOperationStatusServerTransport with the provided implementation. -// The returned PrivateLinkScopeOperationStatusServerTransport instance is connected to an instance of armmonitor.PrivateLinkScopeOperationStatusClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewPrivateLinkScopeOperationStatusServerTransport(srv *PrivateLinkScopeOperationStatusServer) *PrivateLinkScopeOperationStatusServerTransport { - return &PrivateLinkScopeOperationStatusServerTransport{srv: srv} -} - -// PrivateLinkScopeOperationStatusServerTransport connects instances of armmonitor.PrivateLinkScopeOperationStatusClient to instances of PrivateLinkScopeOperationStatusServer. -// Don't use this type directly, use NewPrivateLinkScopeOperationStatusServerTransport instead. -type PrivateLinkScopeOperationStatusServerTransport struct { - srv *PrivateLinkScopeOperationStatusServer -} - -// Do implements the policy.Transporter interface for PrivateLinkScopeOperationStatusServerTransport. -func (p *PrivateLinkScopeOperationStatusServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "PrivateLinkScopeOperationStatusClient.Get": - resp, err = p.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *PrivateLinkScopeOperationStatusServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/microsoft\.insights/privateLinkScopeOperationStatuses/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - asyncOperationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("asyncOperationId")]) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), asyncOperationIDParam, resourceGroupNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkscopes_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkscopes_server.go deleted file mode 100644 index bfd667894d9d..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/privatelinkscopes_server.go +++ /dev/null @@ -1,327 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// PrivateLinkScopesServer is a fake server for instances of the armmonitor.PrivateLinkScopesClient type. -type PrivateLinkScopesServer struct { - // CreateOrUpdate is the fake for method PrivateLinkScopesClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - CreateOrUpdate func(ctx context.Context, resourceGroupName string, scopeName string, azureMonitorPrivateLinkScopePayload armmonitor.AzureMonitorPrivateLinkScope, options *armmonitor.PrivateLinkScopesClientCreateOrUpdateOptions) (resp azfake.Responder[armmonitor.PrivateLinkScopesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // BeginDelete is the fake for method PrivateLinkScopesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, scopeName string, options *armmonitor.PrivateLinkScopesClientBeginDeleteOptions) (resp azfake.PollerResponder[armmonitor.PrivateLinkScopesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method PrivateLinkScopesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, scopeName string, options *armmonitor.PrivateLinkScopesClientGetOptions) (resp azfake.Responder[armmonitor.PrivateLinkScopesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method PrivateLinkScopesClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armmonitor.PrivateLinkScopesClientListOptions) (resp azfake.PagerResponder[armmonitor.PrivateLinkScopesClientListResponse]) - - // NewListByResourceGroupPager is the fake for method PrivateLinkScopesClient.NewListByResourceGroupPager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, options *armmonitor.PrivateLinkScopesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armmonitor.PrivateLinkScopesClientListByResourceGroupResponse]) - - // UpdateTags is the fake for method PrivateLinkScopesClient.UpdateTags - // HTTP status codes to indicate success: http.StatusOK - UpdateTags func(ctx context.Context, resourceGroupName string, scopeName string, privateLinkScopeTags armmonitor.TagsResource, options *armmonitor.PrivateLinkScopesClientUpdateTagsOptions) (resp azfake.Responder[armmonitor.PrivateLinkScopesClientUpdateTagsResponse], errResp azfake.ErrorResponder) -} - -// NewPrivateLinkScopesServerTransport creates a new instance of PrivateLinkScopesServerTransport with the provided implementation. -// The returned PrivateLinkScopesServerTransport instance is connected to an instance of armmonitor.PrivateLinkScopesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewPrivateLinkScopesServerTransport(srv *PrivateLinkScopesServer) *PrivateLinkScopesServerTransport { - return &PrivateLinkScopesServerTransport{ - srv: srv, - beginDelete: newTracker[azfake.PollerResponder[armmonitor.PrivateLinkScopesClientDeleteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armmonitor.PrivateLinkScopesClientListResponse]](), - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armmonitor.PrivateLinkScopesClientListByResourceGroupResponse]](), - } -} - -// PrivateLinkScopesServerTransport connects instances of armmonitor.PrivateLinkScopesClient to instances of PrivateLinkScopesServer. -// Don't use this type directly, use NewPrivateLinkScopesServerTransport instead. -type PrivateLinkScopesServerTransport struct { - srv *PrivateLinkScopesServer - beginDelete *tracker[azfake.PollerResponder[armmonitor.PrivateLinkScopesClientDeleteResponse]] - newListPager *tracker[azfake.PagerResponder[armmonitor.PrivateLinkScopesClientListResponse]] - newListByResourceGroupPager *tracker[azfake.PagerResponder[armmonitor.PrivateLinkScopesClientListByResourceGroupResponse]] -} - -// Do implements the policy.Transporter interface for PrivateLinkScopesServerTransport. -func (p *PrivateLinkScopesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "PrivateLinkScopesClient.CreateOrUpdate": - resp, err = p.dispatchCreateOrUpdate(req) - case "PrivateLinkScopesClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "PrivateLinkScopesClient.Get": - resp, err = p.dispatchGet(req) - case "PrivateLinkScopesClient.NewListPager": - resp, err = p.dispatchNewListPager(req) - case "PrivateLinkScopesClient.NewListByResourceGroupPager": - resp, err = p.dispatchNewListByResourceGroupPager(req) - case "PrivateLinkScopesClient.UpdateTags": - resp, err = p.dispatchUpdateTags(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *PrivateLinkScopesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if p.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/microsoft\.insights/privateLinkScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.AzureMonitorPrivateLinkScope](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - scopeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, scopeNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AzureMonitorPrivateLinkScope, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (p *PrivateLinkScopesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if p.srv.BeginDelete == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} - } - beginDelete := p.beginDelete.get(req) - if beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/microsoft\.insights/privateLinkScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - scopeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, scopeNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginDelete = &respr - p.beginDelete.add(req, beginDelete) - } - - resp, err := server.PollerResponderNext(beginDelete, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - p.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} - } - if !server.PollerResponderMore(beginDelete) { - p.beginDelete.remove(req) - } - - return resp, nil -} - -func (p *PrivateLinkScopesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/microsoft\.insights/privateLinkScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - scopeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, scopeNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AzureMonitorPrivateLinkScope, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (p *PrivateLinkScopesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if p.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := p.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/microsoft\.insights/privateLinkScopes` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := p.srv.NewListPager(nil) - newListPager = &resp - p.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armmonitor.PrivateLinkScopesClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - p.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - p.newListPager.remove(req) - } - return resp, nil -} - -func (p *PrivateLinkScopesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { - if p.srv.NewListByResourceGroupPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} - } - newListByResourceGroupPager := p.newListByResourceGroupPager.get(req) - if newListByResourceGroupPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/microsoft\.insights/privateLinkScopes` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resp := p.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) - newListByResourceGroupPager = &resp - p.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armmonitor.PrivateLinkScopesClientListByResourceGroupResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - p.newListByResourceGroupPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByResourceGroupPager) { - p.newListByResourceGroupPager.remove(req) - } - return resp, nil -} - -func (p *PrivateLinkScopesServerTransport) dispatchUpdateTags(req *http.Request) (*http.Response, error) { - if p.srv.UpdateTags == nil { - return nil, &nonRetriableError{errors.New("fake for method UpdateTags not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/microsoft\.insights/privateLinkScopes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.TagsResource](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - scopeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.UpdateTags(req.Context(), resourceGroupNameParam, scopeNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AzureMonitorPrivateLinkScope, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/scheduledqueryrules_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/scheduledqueryrules_server.go index e38302e2c008..cf64352d5b2a 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/scheduledqueryrules_server.go +++ b/sdk/resourcemanager/monitor/armmonitor/fake/scheduledqueryrules_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. @@ -76,31 +73,50 @@ func (s *ScheduledQueryRulesServerTransport) Do(req *http.Request) (*http.Respon return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "ScheduledQueryRulesClient.CreateOrUpdate": - resp, err = s.dispatchCreateOrUpdate(req) - case "ScheduledQueryRulesClient.Delete": - resp, err = s.dispatchDelete(req) - case "ScheduledQueryRulesClient.Get": - resp, err = s.dispatchGet(req) - case "ScheduledQueryRulesClient.NewListByResourceGroupPager": - resp, err = s.dispatchNewListByResourceGroupPager(req) - case "ScheduledQueryRulesClient.NewListBySubscriptionPager": - resp, err = s.dispatchNewListBySubscriptionPager(req) - case "ScheduledQueryRulesClient.Update": - resp, err = s.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *ScheduledQueryRulesServerTransport) 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 scheduledQueryRulesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = scheduledQueryRulesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ScheduledQueryRulesClient.CreateOrUpdate": + res.resp, res.err = s.dispatchCreateOrUpdate(req) + case "ScheduledQueryRulesClient.Delete": + res.resp, res.err = s.dispatchDelete(req) + case "ScheduledQueryRulesClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "ScheduledQueryRulesClient.NewListByResourceGroupPager": + res.resp, res.err = s.dispatchNewListByResourceGroupPager(req) + case "ScheduledQueryRulesClient.NewListBySubscriptionPager": + res.resp, res.err = s.dispatchNewListBySubscriptionPager(req) + case "ScheduledQueryRulesClient.Update": + res.resp, res.err = s.dispatchUpdate(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 (s *ScheduledQueryRulesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -312,3 +328,9 @@ func (s *ScheduledQueryRulesServerTransport) dispatchUpdate(req *http.Request) ( } return resp, nil } + +// set this to conditionally intercept incoming requests to ScheduledQueryRulesServerTransport +var scheduledQueryRulesServerTransportInterceptor 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/monitor/armmonitor/fake/server_factory.go b/sdk/resourcemanager/monitor/armmonitor/fake/server_factory.go index 17116edbbb23..7054790c7d97 100644 --- a/sdk/resourcemanager/monitor/armmonitor/fake/server_factory.go +++ b/sdk/resourcemanager/monitor/armmonitor/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,38 +16,11 @@ import ( // ServerFactory is a fake server for instances of the armmonitor.ClientFactory type. type ServerFactory struct { - ActionGroupsServer ActionGroupsServer - ActivityLogAlertsServer ActivityLogAlertsServer - ActivityLogsServer ActivityLogsServer - AlertRuleIncidentsServer AlertRuleIncidentsServer - AlertRulesServer AlertRulesServer - AutoscaleSettingsServer AutoscaleSettingsServer - AzureMonitorWorkspacesServer AzureMonitorWorkspacesServer - BaselinesServer BaselinesServer - DataCollectionEndpointsServer DataCollectionEndpointsServer - DataCollectionRuleAssociationsServer DataCollectionRuleAssociationsServer - DataCollectionRulesServer DataCollectionRulesServer - DiagnosticSettingsCategoryServer DiagnosticSettingsCategoryServer - DiagnosticSettingsServer DiagnosticSettingsServer - EventCategoriesServer EventCategoriesServer - LogProfilesServer LogProfilesServer - MetricAlertsServer MetricAlertsServer - MetricAlertsStatusServer MetricAlertsStatusServer - MetricDefinitionsServer MetricDefinitionsServer - MetricNamespacesServer MetricNamespacesServer - MetricsServer MetricsServer - OperationsServer OperationsServer - OperationsForMonitorServer OperationsForMonitorServer - PredictiveMetricServer PredictiveMetricServer - PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer - PrivateLinkResourcesServer PrivateLinkResourcesServer - PrivateLinkScopeOperationStatusServer PrivateLinkScopeOperationStatusServer - PrivateLinkScopedResourcesServer PrivateLinkScopedResourcesServer - PrivateLinkScopesServer PrivateLinkScopesServer - ScheduledQueryRulesServer ScheduledQueryRulesServer - TenantActionGroupsServer TenantActionGroupsServer - TenantActivityLogsServer TenantActivityLogsServer - VMInsightsServer VMInsightsServer + // ActionGroupsServer contains the fakes for client ActionGroupsClient + ActionGroupsServer ActionGroupsServer + + // ScheduledQueryRulesServer contains the fakes for client ScheduledQueryRulesClient + ScheduledQueryRulesServer ScheduledQueryRulesServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -65,40 +35,10 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { // ServerFactoryTransport connects instances of armmonitor.ClientFactory to instances of ServerFactory. // Don't use this type directly, use NewServerFactoryTransport instead. type ServerFactoryTransport struct { - srv *ServerFactory - trMu sync.Mutex - trActionGroupsServer *ActionGroupsServerTransport - trActivityLogAlertsServer *ActivityLogAlertsServerTransport - trActivityLogsServer *ActivityLogsServerTransport - trAlertRuleIncidentsServer *AlertRuleIncidentsServerTransport - trAlertRulesServer *AlertRulesServerTransport - trAutoscaleSettingsServer *AutoscaleSettingsServerTransport - trAzureMonitorWorkspacesServer *AzureMonitorWorkspacesServerTransport - trBaselinesServer *BaselinesServerTransport - trDataCollectionEndpointsServer *DataCollectionEndpointsServerTransport - trDataCollectionRuleAssociationsServer *DataCollectionRuleAssociationsServerTransport - trDataCollectionRulesServer *DataCollectionRulesServerTransport - trDiagnosticSettingsCategoryServer *DiagnosticSettingsCategoryServerTransport - trDiagnosticSettingsServer *DiagnosticSettingsServerTransport - trEventCategoriesServer *EventCategoriesServerTransport - trLogProfilesServer *LogProfilesServerTransport - trMetricAlertsServer *MetricAlertsServerTransport - trMetricAlertsStatusServer *MetricAlertsStatusServerTransport - trMetricDefinitionsServer *MetricDefinitionsServerTransport - trMetricNamespacesServer *MetricNamespacesServerTransport - trMetricsServer *MetricsServerTransport - trOperationsServer *OperationsServerTransport - trOperationsForMonitorServer *OperationsForMonitorServerTransport - trPredictiveMetricServer *PredictiveMetricServerTransport - trPrivateEndpointConnectionsServer *PrivateEndpointConnectionsServerTransport - trPrivateLinkResourcesServer *PrivateLinkResourcesServerTransport - trPrivateLinkScopeOperationStatusServer *PrivateLinkScopeOperationStatusServerTransport - trPrivateLinkScopedResourcesServer *PrivateLinkScopedResourcesServerTransport - trPrivateLinkScopesServer *PrivateLinkScopesServerTransport - trScheduledQueryRulesServer *ScheduledQueryRulesServerTransport - trTenantActionGroupsServer *TenantActionGroupsServerTransport - trTenantActivityLogsServer *TenantActivityLogsServerTransport - trVMInsightsServer *VMInsightsServerTransport + srv *ServerFactory + trMu sync.Mutex + trActionGroupsServer *ActionGroupsServerTransport + trScheduledQueryRulesServer *ScheduledQueryRulesServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -117,145 +57,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { case "ActionGroupsClient": initServer(s, &s.trActionGroupsServer, func() *ActionGroupsServerTransport { return NewActionGroupsServerTransport(&s.srv.ActionGroupsServer) }) resp, err = s.trActionGroupsServer.Do(req) - case "ActivityLogAlertsClient": - initServer(s, &s.trActivityLogAlertsServer, func() *ActivityLogAlertsServerTransport { - return NewActivityLogAlertsServerTransport(&s.srv.ActivityLogAlertsServer) - }) - resp, err = s.trActivityLogAlertsServer.Do(req) - case "ActivityLogsClient": - initServer(s, &s.trActivityLogsServer, func() *ActivityLogsServerTransport { return NewActivityLogsServerTransport(&s.srv.ActivityLogsServer) }) - resp, err = s.trActivityLogsServer.Do(req) - case "AlertRuleIncidentsClient": - initServer(s, &s.trAlertRuleIncidentsServer, func() *AlertRuleIncidentsServerTransport { - return NewAlertRuleIncidentsServerTransport(&s.srv.AlertRuleIncidentsServer) - }) - resp, err = s.trAlertRuleIncidentsServer.Do(req) - case "AlertRulesClient": - initServer(s, &s.trAlertRulesServer, func() *AlertRulesServerTransport { return NewAlertRulesServerTransport(&s.srv.AlertRulesServer) }) - resp, err = s.trAlertRulesServer.Do(req) - case "AutoscaleSettingsClient": - initServer(s, &s.trAutoscaleSettingsServer, func() *AutoscaleSettingsServerTransport { - return NewAutoscaleSettingsServerTransport(&s.srv.AutoscaleSettingsServer) - }) - resp, err = s.trAutoscaleSettingsServer.Do(req) - case "AzureMonitorWorkspacesClient": - initServer(s, &s.trAzureMonitorWorkspacesServer, func() *AzureMonitorWorkspacesServerTransport { - return NewAzureMonitorWorkspacesServerTransport(&s.srv.AzureMonitorWorkspacesServer) - }) - resp, err = s.trAzureMonitorWorkspacesServer.Do(req) - case "BaselinesClient": - initServer(s, &s.trBaselinesServer, func() *BaselinesServerTransport { return NewBaselinesServerTransport(&s.srv.BaselinesServer) }) - resp, err = s.trBaselinesServer.Do(req) - case "DataCollectionEndpointsClient": - initServer(s, &s.trDataCollectionEndpointsServer, func() *DataCollectionEndpointsServerTransport { - return NewDataCollectionEndpointsServerTransport(&s.srv.DataCollectionEndpointsServer) - }) - resp, err = s.trDataCollectionEndpointsServer.Do(req) - case "DataCollectionRuleAssociationsClient": - initServer(s, &s.trDataCollectionRuleAssociationsServer, func() *DataCollectionRuleAssociationsServerTransport { - return NewDataCollectionRuleAssociationsServerTransport(&s.srv.DataCollectionRuleAssociationsServer) - }) - resp, err = s.trDataCollectionRuleAssociationsServer.Do(req) - case "DataCollectionRulesClient": - initServer(s, &s.trDataCollectionRulesServer, func() *DataCollectionRulesServerTransport { - return NewDataCollectionRulesServerTransport(&s.srv.DataCollectionRulesServer) - }) - resp, err = s.trDataCollectionRulesServer.Do(req) - case "DiagnosticSettingsCategoryClient": - initServer(s, &s.trDiagnosticSettingsCategoryServer, func() *DiagnosticSettingsCategoryServerTransport { - return NewDiagnosticSettingsCategoryServerTransport(&s.srv.DiagnosticSettingsCategoryServer) - }) - resp, err = s.trDiagnosticSettingsCategoryServer.Do(req) - case "DiagnosticSettingsClient": - initServer(s, &s.trDiagnosticSettingsServer, func() *DiagnosticSettingsServerTransport { - return NewDiagnosticSettingsServerTransport(&s.srv.DiagnosticSettingsServer) - }) - resp, err = s.trDiagnosticSettingsServer.Do(req) - case "EventCategoriesClient": - initServer(s, &s.trEventCategoriesServer, func() *EventCategoriesServerTransport { - return NewEventCategoriesServerTransport(&s.srv.EventCategoriesServer) - }) - resp, err = s.trEventCategoriesServer.Do(req) - case "LogProfilesClient": - initServer(s, &s.trLogProfilesServer, func() *LogProfilesServerTransport { return NewLogProfilesServerTransport(&s.srv.LogProfilesServer) }) - resp, err = s.trLogProfilesServer.Do(req) - case "MetricAlertsClient": - initServer(s, &s.trMetricAlertsServer, func() *MetricAlertsServerTransport { return NewMetricAlertsServerTransport(&s.srv.MetricAlertsServer) }) - resp, err = s.trMetricAlertsServer.Do(req) - case "MetricAlertsStatusClient": - initServer(s, &s.trMetricAlertsStatusServer, func() *MetricAlertsStatusServerTransport { - return NewMetricAlertsStatusServerTransport(&s.srv.MetricAlertsStatusServer) - }) - resp, err = s.trMetricAlertsStatusServer.Do(req) - case "MetricDefinitionsClient": - initServer(s, &s.trMetricDefinitionsServer, func() *MetricDefinitionsServerTransport { - return NewMetricDefinitionsServerTransport(&s.srv.MetricDefinitionsServer) - }) - resp, err = s.trMetricDefinitionsServer.Do(req) - case "MetricNamespacesClient": - initServer(s, &s.trMetricNamespacesServer, func() *MetricNamespacesServerTransport { - return NewMetricNamespacesServerTransport(&s.srv.MetricNamespacesServer) - }) - resp, err = s.trMetricNamespacesServer.Do(req) - case "MetricsClient": - initServer(s, &s.trMetricsServer, func() *MetricsServerTransport { return NewMetricsServerTransport(&s.srv.MetricsServer) }) - resp, err = s.trMetricsServer.Do(req) - case "OperationsClient": - initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) - resp, err = s.trOperationsServer.Do(req) - case "OperationsForMonitorClient": - initServer(s, &s.trOperationsForMonitorServer, func() *OperationsForMonitorServerTransport { - return NewOperationsForMonitorServerTransport(&s.srv.OperationsForMonitorServer) - }) - resp, err = s.trOperationsForMonitorServer.Do(req) - case "PredictiveMetricClient": - initServer(s, &s.trPredictiveMetricServer, func() *PredictiveMetricServerTransport { - return NewPredictiveMetricServerTransport(&s.srv.PredictiveMetricServer) - }) - resp, err = s.trPredictiveMetricServer.Do(req) - case "PrivateEndpointConnectionsClient": - initServer(s, &s.trPrivateEndpointConnectionsServer, func() *PrivateEndpointConnectionsServerTransport { - return NewPrivateEndpointConnectionsServerTransport(&s.srv.PrivateEndpointConnectionsServer) - }) - resp, err = s.trPrivateEndpointConnectionsServer.Do(req) - case "PrivateLinkResourcesClient": - initServer(s, &s.trPrivateLinkResourcesServer, func() *PrivateLinkResourcesServerTransport { - return NewPrivateLinkResourcesServerTransport(&s.srv.PrivateLinkResourcesServer) - }) - resp, err = s.trPrivateLinkResourcesServer.Do(req) - case "PrivateLinkScopeOperationStatusClient": - initServer(s, &s.trPrivateLinkScopeOperationStatusServer, func() *PrivateLinkScopeOperationStatusServerTransport { - return NewPrivateLinkScopeOperationStatusServerTransport(&s.srv.PrivateLinkScopeOperationStatusServer) - }) - resp, err = s.trPrivateLinkScopeOperationStatusServer.Do(req) - case "PrivateLinkScopedResourcesClient": - initServer(s, &s.trPrivateLinkScopedResourcesServer, func() *PrivateLinkScopedResourcesServerTransport { - return NewPrivateLinkScopedResourcesServerTransport(&s.srv.PrivateLinkScopedResourcesServer) - }) - resp, err = s.trPrivateLinkScopedResourcesServer.Do(req) - case "PrivateLinkScopesClient": - initServer(s, &s.trPrivateLinkScopesServer, func() *PrivateLinkScopesServerTransport { - return NewPrivateLinkScopesServerTransport(&s.srv.PrivateLinkScopesServer) - }) - resp, err = s.trPrivateLinkScopesServer.Do(req) case "ScheduledQueryRulesClient": initServer(s, &s.trScheduledQueryRulesServer, func() *ScheduledQueryRulesServerTransport { return NewScheduledQueryRulesServerTransport(&s.srv.ScheduledQueryRulesServer) }) resp, err = s.trScheduledQueryRulesServer.Do(req) - case "TenantActionGroupsClient": - initServer(s, &s.trTenantActionGroupsServer, func() *TenantActionGroupsServerTransport { - return NewTenantActionGroupsServerTransport(&s.srv.TenantActionGroupsServer) - }) - resp, err = s.trTenantActionGroupsServer.Do(req) - case "TenantActivityLogsClient": - initServer(s, &s.trTenantActivityLogsServer, func() *TenantActivityLogsServerTransport { - return NewTenantActivityLogsServerTransport(&s.srv.TenantActivityLogsServer) - }) - resp, err = s.trTenantActivityLogsServer.Do(req) - case "VMInsightsClient": - initServer(s, &s.trVMInsightsServer, func() *VMInsightsServerTransport { return NewVMInsightsServerTransport(&s.srv.VMInsightsServer) }) - resp, err = s.trVMInsightsServer.Do(req) default: err = fmt.Errorf("unhandled client %s", client) } diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/tenantactiongroups_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/tenantactiongroups_server.go deleted file mode 100644 index 961b93e78ba9..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/tenantactiongroups_server.go +++ /dev/null @@ -1,269 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// TenantActionGroupsServer is a fake server for instances of the armmonitor.TenantActionGroupsClient type. -type TenantActionGroupsServer struct { - // CreateOrUpdate is the fake for method TenantActionGroupsClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - CreateOrUpdate func(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, actionGroup armmonitor.TenantActionGroupResource, options *armmonitor.TenantActionGroupsClientCreateOrUpdateOptions) (resp azfake.Responder[armmonitor.TenantActionGroupsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method TenantActionGroupsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, options *armmonitor.TenantActionGroupsClientDeleteOptions) (resp azfake.Responder[armmonitor.TenantActionGroupsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method TenantActionGroupsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, options *armmonitor.TenantActionGroupsClientGetOptions) (resp azfake.Responder[armmonitor.TenantActionGroupsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByManagementGroupIDPager is the fake for method TenantActionGroupsClient.NewListByManagementGroupIDPager - // HTTP status codes to indicate success: http.StatusOK - NewListByManagementGroupIDPager func(managementGroupID string, xmsClientTenantID string, options *armmonitor.TenantActionGroupsClientListByManagementGroupIDOptions) (resp azfake.PagerResponder[armmonitor.TenantActionGroupsClientListByManagementGroupIDResponse]) - - // Update is the fake for method TenantActionGroupsClient.Update - // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, tenantActionGroupPatch armmonitor.ActionGroupPatchBodyAutoGenerated, options *armmonitor.TenantActionGroupsClientUpdateOptions) (resp azfake.Responder[armmonitor.TenantActionGroupsClientUpdateResponse], errResp azfake.ErrorResponder) -} - -// NewTenantActionGroupsServerTransport creates a new instance of TenantActionGroupsServerTransport with the provided implementation. -// The returned TenantActionGroupsServerTransport instance is connected to an instance of armmonitor.TenantActionGroupsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewTenantActionGroupsServerTransport(srv *TenantActionGroupsServer) *TenantActionGroupsServerTransport { - return &TenantActionGroupsServerTransport{ - srv: srv, - newListByManagementGroupIDPager: newTracker[azfake.PagerResponder[armmonitor.TenantActionGroupsClientListByManagementGroupIDResponse]](), - } -} - -// TenantActionGroupsServerTransport connects instances of armmonitor.TenantActionGroupsClient to instances of TenantActionGroupsServer. -// Don't use this type directly, use NewTenantActionGroupsServerTransport instead. -type TenantActionGroupsServerTransport struct { - srv *TenantActionGroupsServer - newListByManagementGroupIDPager *tracker[azfake.PagerResponder[armmonitor.TenantActionGroupsClientListByManagementGroupIDResponse]] -} - -// Do implements the policy.Transporter interface for TenantActionGroupsServerTransport. -func (t *TenantActionGroupsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "TenantActionGroupsClient.CreateOrUpdate": - resp, err = t.dispatchCreateOrUpdate(req) - case "TenantActionGroupsClient.Delete": - resp, err = t.dispatchDelete(req) - case "TenantActionGroupsClient.Get": - resp, err = t.dispatchGet(req) - case "TenantActionGroupsClient.NewListByManagementGroupIDPager": - resp, err = t.dispatchNewListByManagementGroupIDPager(req) - case "TenantActionGroupsClient.Update": - resp, err = t.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (t *TenantActionGroupsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if t.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/tenantActionGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.TenantActionGroupResource](req) - if err != nil { - return nil, err - } - managementGroupIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("managementGroupId")]) - if err != nil { - return nil, err - } - tenantActionGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("tenantActionGroupName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.CreateOrUpdate(req.Context(), managementGroupIDParam, tenantActionGroupNameParam, getHeaderValue(req.Header, "x-ms-client-tenant-id"), body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).TenantActionGroupResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (t *TenantActionGroupsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if t.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/tenantActionGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - managementGroupIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("managementGroupId")]) - if err != nil { - return nil, err - } - tenantActionGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("tenantActionGroupName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.Delete(req.Context(), managementGroupIDParam, tenantActionGroupNameParam, getHeaderValue(req.Header, "x-ms-client-tenant-id"), nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (t *TenantActionGroupsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if t.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/tenantActionGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - managementGroupIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("managementGroupId")]) - if err != nil { - return nil, err - } - tenantActionGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("tenantActionGroupName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.Get(req.Context(), managementGroupIDParam, tenantActionGroupNameParam, getHeaderValue(req.Header, "x-ms-client-tenant-id"), nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).TenantActionGroupResource, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (t *TenantActionGroupsServerTransport) dispatchNewListByManagementGroupIDPager(req *http.Request) (*http.Response, error) { - if t.srv.NewListByManagementGroupIDPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByManagementGroupIDPager not implemented")} - } - newListByManagementGroupIDPager := t.newListByManagementGroupIDPager.get(req) - if newListByManagementGroupIDPager == nil { - const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/tenantActionGroups` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - managementGroupIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("managementGroupId")]) - if err != nil { - return nil, err - } - resp := t.srv.NewListByManagementGroupIDPager(managementGroupIDParam, getHeaderValue(req.Header, "x-ms-client-tenant-id"), nil) - newListByManagementGroupIDPager = &resp - t.newListByManagementGroupIDPager.add(req, newListByManagementGroupIDPager) - } - resp, err := server.PagerResponderNext(newListByManagementGroupIDPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - t.newListByManagementGroupIDPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByManagementGroupIDPager) { - t.newListByManagementGroupIDPager.remove(req) - } - return resp, nil -} - -func (t *TenantActionGroupsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { - if t.srv.Update == nil { - return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} - } - const regexStr = `/providers/Microsoft\.Management/managementGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/tenantActionGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armmonitor.ActionGroupPatchBodyAutoGenerated](req) - if err != nil { - return nil, err - } - managementGroupIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("managementGroupId")]) - if err != nil { - return nil, err - } - tenantActionGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("tenantActionGroupName")]) - if err != nil { - return nil, err - } - respr, errRespr := t.srv.Update(req.Context(), managementGroupIDParam, tenantActionGroupNameParam, getHeaderValue(req.Header, "x-ms-client-tenant-id"), body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).TenantActionGroupResource, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/tenantactivitylogs_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/tenantactivitylogs_server.go deleted file mode 100644 index f8ea81901bf1..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/tenantactivitylogs_server.go +++ /dev/null @@ -1,115 +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 ( - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" -) - -// TenantActivityLogsServer is a fake server for instances of the armmonitor.TenantActivityLogsClient type. -type TenantActivityLogsServer struct { - // NewListPager is the fake for method TenantActivityLogsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armmonitor.TenantActivityLogsClientListOptions) (resp azfake.PagerResponder[armmonitor.TenantActivityLogsClientListResponse]) -} - -// NewTenantActivityLogsServerTransport creates a new instance of TenantActivityLogsServerTransport with the provided implementation. -// The returned TenantActivityLogsServerTransport instance is connected to an instance of armmonitor.TenantActivityLogsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewTenantActivityLogsServerTransport(srv *TenantActivityLogsServer) *TenantActivityLogsServerTransport { - return &TenantActivityLogsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armmonitor.TenantActivityLogsClientListResponse]](), - } -} - -// TenantActivityLogsServerTransport connects instances of armmonitor.TenantActivityLogsClient to instances of TenantActivityLogsServer. -// Don't use this type directly, use NewTenantActivityLogsServerTransport instead. -type TenantActivityLogsServerTransport struct { - srv *TenantActivityLogsServer - newListPager *tracker[azfake.PagerResponder[armmonitor.TenantActivityLogsClientListResponse]] -} - -// Do implements the policy.Transporter interface for TenantActivityLogsServerTransport. -func (t *TenantActivityLogsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "TenantActivityLogsClient.NewListPager": - resp, err = t.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (t *TenantActivityLogsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if t.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := t.newListPager.get(req) - if newListPager == nil { - qp := req.URL.Query() - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) - selectUnescaped, err := url.QueryUnescape(qp.Get("$select")) - if err != nil { - return nil, err - } - selectParam := getOptional(selectUnescaped) - var options *armmonitor.TenantActivityLogsClientListOptions - if filterParam != nil || selectParam != nil { - options = &armmonitor.TenantActivityLogsClientListOptions{ - Filter: filterParam, - Select: selectParam, - } - } - resp := t.srv.NewListPager(options) - newListPager = &resp - t.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armmonitor.TenantActivityLogsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - t.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - t.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/fake/time_rfc3339.go b/sdk/resourcemanager/monitor/armmonitor/fake/time_rfc3339.go deleted file mode 100644 index 3080daf9560a..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/time_rfc3339.go +++ /dev/null @@ -1,155 +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 -} - -const ( - utcTimeJSON = `"15:04:05.999999999"` - utcTime = "15:04:05.999999999" - timeFormat = "15:04:05.999999999Z07:00" -) - -type timeRFC3339 time.Time - -func (t timeRFC3339) MarshalJSON() ([]byte, error) { - s, _ := t.MarshalText() - return []byte(fmt.Sprintf("\"%s\"", s)), nil -} - -func (t timeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return []byte(tt.Format(timeFormat)), nil -} - -func (t *timeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcTimeJSON - if tzOffsetRegex.Match(data) { - layout = timeFormat - } - return t.Parse(layout, string(data)) -} - -func (t *timeRFC3339) UnmarshalText(data []byte) error { - layout := utcTime - if tzOffsetRegex.Match(data) { - layout = timeFormat - } - return t.Parse(layout, string(data)) -} - -func (t *timeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = timeRFC3339(p) - return err -} - -func (t timeRFC3339) String() string { - tt := time.Time(t) - return tt.Format(timeFormat) -} - -func populateTimeRFC3339(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] = (*timeRFC3339)(t) -} - -func unpopulateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { - return nil - } - var aux timeRFC3339 - 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/monitor/armmonitor/fake/vminsights_server.go b/sdk/resourcemanager/monitor/armmonitor/fake/vminsights_server.go deleted file mode 100644 index 58c4f55c2452..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/fake/vminsights_server.go +++ /dev/null @@ -1,96 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" - "net/http" - "net/url" - "regexp" -) - -// VMInsightsServer is a fake server for instances of the armmonitor.VMInsightsClient type. -type VMInsightsServer struct { - // GetOnboardingStatus is the fake for method VMInsightsClient.GetOnboardingStatus - // HTTP status codes to indicate success: http.StatusOK - GetOnboardingStatus func(ctx context.Context, resourceURI string, options *armmonitor.VMInsightsClientGetOnboardingStatusOptions) (resp azfake.Responder[armmonitor.VMInsightsClientGetOnboardingStatusResponse], errResp azfake.ErrorResponder) -} - -// NewVMInsightsServerTransport creates a new instance of VMInsightsServerTransport with the provided implementation. -// The returned VMInsightsServerTransport instance is connected to an instance of armmonitor.VMInsightsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewVMInsightsServerTransport(srv *VMInsightsServer) *VMInsightsServerTransport { - return &VMInsightsServerTransport{srv: srv} -} - -// VMInsightsServerTransport connects instances of armmonitor.VMInsightsClient to instances of VMInsightsServer. -// Don't use this type directly, use NewVMInsightsServerTransport instead. -type VMInsightsServerTransport struct { - srv *VMInsightsServer -} - -// Do implements the policy.Transporter interface for VMInsightsServerTransport. -func (v *VMInsightsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "VMInsightsClient.GetOnboardingStatus": - resp, err = v.dispatchGetOnboardingStatus(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (v *VMInsightsServerTransport) dispatchGetOnboardingStatus(req *http.Request) (*http.Response, error) { - if v.srv.GetOnboardingStatus == nil { - return nil, &nonRetriableError{errors.New("fake for method GetOnboardingStatus not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Insights/vmInsightsOnboardingStatuses/default` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) - if err != nil { - return nil, err - } - respr, errRespr := v.srv.GetOnboardingStatus(req.Context(), resourceURIParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).VMInsightsOnboardingStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/go.mod b/sdk/resourcemanager/monitor/armmonitor/go.mod index da2cf1e7b01a..10f6e87f783a 100644 --- a/sdk/resourcemanager/monitor/armmonitor/go.mod +++ b/sdk/resourcemanager/monitor/armmonitor/go.mod @@ -4,7 +4,6 @@ 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/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 @@ -12,6 +11,7 @@ require ( ) require ( + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/golang-jwt/jwt/v5 v5.2.2 // indirect diff --git a/sdk/resourcemanager/monitor/armmonitor/interfaces.go b/sdk/resourcemanager/monitor/armmonitor/interfaces.go deleted file mode 100644 index df55091d31a6..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/interfaces.go +++ /dev/null @@ -1,55 +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 armmonitor - -// MetricAlertCriteriaClassification provides polymorphic access to related types. -// Call the interface's GetMetricAlertCriteria() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *MetricAlertCriteria, *MetricAlertMultipleResourceMultipleMetricCriteria, *MetricAlertSingleResourceMultipleMetricCriteria, -// - *WebtestLocationAvailabilityCriteria -type MetricAlertCriteriaClassification interface { - // GetMetricAlertCriteria returns the MetricAlertCriteria content of the underlying type. - GetMetricAlertCriteria() *MetricAlertCriteria -} - -// MultiMetricCriteriaClassification provides polymorphic access to related types. -// Call the interface's GetMultiMetricCriteria() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *DynamicMetricCriteria, *MetricCriteria, *MultiMetricCriteria -type MultiMetricCriteriaClassification interface { - // GetMultiMetricCriteria returns the MultiMetricCriteria content of the underlying type. - GetMultiMetricCriteria() *MultiMetricCriteria -} - -// RuleActionClassification provides polymorphic access to related types. -// Call the interface's GetRuleAction() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *RuleAction, *RuleEmailAction, *RuleWebhookAction -type RuleActionClassification interface { - // GetRuleAction returns the RuleAction content of the underlying type. - GetRuleAction() *RuleAction -} - -// RuleConditionClassification provides polymorphic access to related types. -// Call the interface's GetRuleCondition() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *LocationThresholdRuleCondition, *ManagementEventRuleCondition, *RuleCondition, *ThresholdRuleCondition -type RuleConditionClassification interface { - // GetRuleCondition returns the RuleCondition content of the underlying type. - GetRuleCondition() *RuleCondition -} - -// RuleDataSourceClassification provides polymorphic access to related types. -// Call the interface's GetRuleDataSource() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *RuleDataSource, *RuleManagementEventDataSource, *RuleMetricDataSource -type RuleDataSourceClassification interface { - // GetRuleDataSource returns the RuleDataSource content of the underlying type. - GetRuleDataSource() *RuleDataSource -} diff --git a/sdk/resourcemanager/monitor/armmonitor/logprofiles_client.go b/sdk/resourcemanager/monitor/armmonitor/logprofiles_client.go deleted file mode 100644 index f8042d17921a..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/logprofiles_client.go +++ /dev/null @@ -1,333 +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 armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// LogProfilesClient contains the methods for the LogProfiles group. -// Don't use this type directly, use NewLogProfilesClient() instead. -type LogProfilesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewLogProfilesClient creates a new instance of LogProfilesClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewLogProfilesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LogProfilesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &LogProfilesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Create or update a log profile in Azure Monitoring REST API. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2016-03-01 -// - logProfileName - The name of the log profile. -// - parameters - Parameters supplied to the operation. -// - options - LogProfilesClientCreateOrUpdateOptions contains the optional parameters for the LogProfilesClient.CreateOrUpdate -// method. -func (client *LogProfilesClient) CreateOrUpdate(ctx context.Context, logProfileName string, parameters LogProfileResource, options *LogProfilesClientCreateOrUpdateOptions) (LogProfilesClientCreateOrUpdateResponse, error) { - var err error - const operationName = "LogProfilesClient.CreateOrUpdate" - 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, logProfileName, parameters, options) - if err != nil { - return LogProfilesClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return LogProfilesClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return LogProfilesClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *LogProfilesClient) createOrUpdateCreateRequest(ctx context.Context, logProfileName string, parameters LogProfileResource, options *LogProfilesClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}" - if logProfileName == "" { - return nil, errors.New("parameter logProfileName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{logProfileName}", url.PathEscape(logProfileName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2016-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *LogProfilesClient) createOrUpdateHandleResponse(resp *http.Response) (LogProfilesClientCreateOrUpdateResponse, error) { - result := LogProfilesClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.LogProfileResource); err != nil { - return LogProfilesClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Deletes the log profile. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2016-03-01 -// - logProfileName - The name of the log profile. -// - options - LogProfilesClientDeleteOptions contains the optional parameters for the LogProfilesClient.Delete method. -func (client *LogProfilesClient) Delete(ctx context.Context, logProfileName string, options *LogProfilesClientDeleteOptions) (LogProfilesClientDeleteResponse, error) { - var err error - const operationName = "LogProfilesClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, logProfileName, options) - if err != nil { - return LogProfilesClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return LogProfilesClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return LogProfilesClientDeleteResponse{}, err - } - return LogProfilesClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *LogProfilesClient) deleteCreateRequest(ctx context.Context, logProfileName string, options *LogProfilesClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}" - if logProfileName == "" { - return nil, errors.New("parameter logProfileName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{logProfileName}", url.PathEscape(logProfileName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2016-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - return req, nil -} - -// Get - Gets the log profile. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2016-03-01 -// - logProfileName - The name of the log profile. -// - options - LogProfilesClientGetOptions contains the optional parameters for the LogProfilesClient.Get method. -func (client *LogProfilesClient) Get(ctx context.Context, logProfileName string, options *LogProfilesClientGetOptions) (LogProfilesClientGetResponse, error) { - var err error - const operationName = "LogProfilesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, logProfileName, options) - if err != nil { - return LogProfilesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return LogProfilesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return LogProfilesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *LogProfilesClient) getCreateRequest(ctx context.Context, logProfileName string, options *LogProfilesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}" - if logProfileName == "" { - return nil, errors.New("parameter logProfileName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{logProfileName}", url.PathEscape(logProfileName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2016-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *LogProfilesClient) getHandleResponse(resp *http.Response) (LogProfilesClientGetResponse, error) { - result := LogProfilesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.LogProfileResource); err != nil { - return LogProfilesClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - List the log profiles. -// -// Generated from API version 2016-03-01 -// - options - LogProfilesClientListOptions contains the optional parameters for the LogProfilesClient.NewListPager method. -func (client *LogProfilesClient) NewListPager(options *LogProfilesClientListOptions) *runtime.Pager[LogProfilesClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[LogProfilesClientListResponse]{ - More: func(page LogProfilesClientListResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *LogProfilesClientListResponse) (LogProfilesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "LogProfilesClient.NewListPager") - req, err := client.listCreateRequest(ctx, options) - if err != nil { - return LogProfilesClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return LogProfilesClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return LogProfilesClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *LogProfilesClient) listCreateRequest(ctx context.Context, options *LogProfilesClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2016-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *LogProfilesClient) listHandleResponse(resp *http.Response) (LogProfilesClientListResponse, error) { - result := LogProfilesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.LogProfileCollection); err != nil { - return LogProfilesClientListResponse{}, err - } - return result, nil -} - -// Update - Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2016-03-01 -// - logProfileName - The name of the log profile. -// - logProfilesResource - Parameters supplied to the operation. -// - options - LogProfilesClientUpdateOptions contains the optional parameters for the LogProfilesClient.Update method. -func (client *LogProfilesClient) Update(ctx context.Context, logProfileName string, logProfilesResource LogProfileResourcePatch, options *LogProfilesClientUpdateOptions) (LogProfilesClientUpdateResponse, error) { - var err error - const operationName = "LogProfilesClient.Update" - 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, logProfileName, logProfilesResource, options) - if err != nil { - return LogProfilesClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return LogProfilesClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return LogProfilesClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *LogProfilesClient) updateCreateRequest(ctx context.Context, logProfileName string, logProfilesResource LogProfileResourcePatch, options *LogProfilesClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if logProfileName == "" { - return nil, errors.New("parameter logProfileName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{logProfileName}", url.PathEscape(logProfileName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2016-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, logProfilesResource); err != nil { - return nil, err - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *LogProfilesClient) updateHandleResponse(resp *http.Response) (LogProfilesClientUpdateResponse, error) { - result := LogProfilesClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.LogProfileResource); err != nil { - return LogProfilesClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/logprofiles_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/logprofiles_client_example_test.go deleted file mode 100644 index 66b0efcdbaae..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/logprofiles_client_example_test.go +++ /dev/null @@ -1,262 +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 armmonitor_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/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/deleteLogProfile.json -func ExampleLogProfilesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewLogProfilesClient().Delete(ctx, "Rac46PostSwapRG", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/getLogProfile.json -func ExampleLogProfilesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLogProfilesClient().Get(ctx, "default", 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.LogProfileResource = armmonitor.LogProfileResource{ - // Name: to.Ptr("default"), - // Type: to.Ptr(""), - // ID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/providers/microsoft.insights/logprofiles/default"), - // Location: to.Ptr(""), - // Properties: &armmonitor.LogProfileProperties{ - // Categories: []*string{ - // to.Ptr("Delete"), - // to.Ptr("Write"), - // to.Ptr("Action")}, - // Locations: []*string{ - // to.Ptr("global")}, - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](3), - // Enabled: to.Ptr(true), - // }, - // ServiceBusRuleID: to.Ptr(""), - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/createOrUpdateLogProfile.json -func ExampleLogProfilesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLogProfilesClient().CreateOrUpdate(ctx, "Rac46PostSwapRG", armmonitor.LogProfileResource{ - Location: to.Ptr(""), - Tags: map[string]*string{}, - Properties: &armmonitor.LogProfileProperties{ - Categories: []*string{ - to.Ptr("Write"), - to.Ptr("Delete"), - to.Ptr("Action")}, - Locations: []*string{ - to.Ptr("global")}, - RetentionPolicy: &armmonitor.RetentionPolicy{ - Days: to.Ptr[int32](3), - Enabled: to.Ptr(true), - }, - ServiceBusRuleID: to.Ptr(""), - StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162"), - }, - }, 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.LogProfileResource = armmonitor.LogProfileResource{ - // Name: to.Ptr("default"), - // Type: to.Ptr(""), - // ID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/providers/microsoft.insights/logprofiles/default"), - // Location: to.Ptr(""), - // Properties: &armmonitor.LogProfileProperties{ - // Categories: []*string{ - // to.Ptr("Delete"), - // to.Ptr("Write"), - // to.Ptr("Action")}, - // Locations: []*string{ - // to.Ptr("global")}, - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](3), - // Enabled: to.Ptr(true), - // }, - // ServiceBusRuleID: to.Ptr(""), - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/patchLogProfile.json -func ExampleLogProfilesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewLogProfilesClient().Update(ctx, "Rac46PostSwapRG", armmonitor.LogProfileResourcePatch{ - Properties: &armmonitor.LogProfileProperties{ - Categories: []*string{ - to.Ptr("Write"), - to.Ptr("Delete"), - to.Ptr("Action")}, - Locations: []*string{ - to.Ptr("global")}, - RetentionPolicy: &armmonitor.RetentionPolicy{ - Days: to.Ptr[int32](3), - Enabled: to.Ptr(true), - }, - ServiceBusRuleID: to.Ptr(""), - StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162"), - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - }, - }, 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.LogProfileResource = armmonitor.LogProfileResource{ - // Name: to.Ptr("default"), - // Type: to.Ptr(""), - // ID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/providers/microsoft.insights/logprofiles/default"), - // Location: to.Ptr(""), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // }, - // Properties: &armmonitor.LogProfileProperties{ - // Categories: []*string{ - // to.Ptr("Delete"), - // to.Ptr("Write"), - // to.Ptr("Action")}, - // Locations: []*string{ - // to.Ptr("global")}, - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](3), - // Enabled: to.Ptr(true), - // }, - // ServiceBusRuleID: to.Ptr(""), - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/listLogProfile.json -func ExampleLogProfilesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewLogProfilesClient().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.LogProfileCollection = armmonitor.LogProfileCollection{ - // Value: []*armmonitor.LogProfileResource{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr(""), - // ID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/providers/microsoft.insights/logprofiles/default"), - // Location: to.Ptr(""), - // Properties: &armmonitor.LogProfileProperties{ - // Categories: []*string{ - // to.Ptr("Delete"), - // to.Ptr("Write"), - // to.Ptr("Action")}, - // Locations: []*string{ - // to.Ptr("global")}, - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](3), - // Enabled: to.Ptr(true), - // }, - // ServiceBusRuleID: to.Ptr(""), - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162"), - // }, - // }, - // { - // Name: to.Ptr("default2"), - // Type: to.Ptr(""), - // ID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/providers/microsoft.insights/logprofiles/default2"), - // Location: to.Ptr(""), - // Properties: &armmonitor.LogProfileProperties{ - // Categories: []*string{ - // to.Ptr("Delete"), - // to.Ptr("Write"), - // to.Ptr("Action")}, - // Locations: []*string{ - // to.Ptr("global")}, - // RetentionPolicy: &armmonitor.RetentionPolicy{ - // Days: to.Ptr[int32](15), - // Enabled: to.Ptr(true), - // }, - // ServiceBusRuleID: to.Ptr(""), - // StorageAccountID: to.Ptr("/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8165"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metricalerts_client.go b/sdk/resourcemanager/monitor/armmonitor/metricalerts_client.go deleted file mode 100644 index fbc981a3dcf3..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metricalerts_client.go +++ /dev/null @@ -1,416 +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 armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// MetricAlertsClient contains the methods for the MetricAlerts group. -// Don't use this type directly, use NewMetricAlertsClient() instead. -type MetricAlertsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewMetricAlertsClient creates a new instance of MetricAlertsClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewMetricAlertsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MetricAlertsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &MetricAlertsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Create or update an metric alert definition. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2018-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - ruleName - The name of the rule. -// - parameters - The parameters of the rule to create or update. -// - options - MetricAlertsClientCreateOrUpdateOptions contains the optional parameters for the MetricAlertsClient.CreateOrUpdate -// method. -func (client *MetricAlertsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResource, options *MetricAlertsClientCreateOrUpdateOptions) (MetricAlertsClientCreateOrUpdateResponse, error) { - var err error - const operationName = "MetricAlertsClient.CreateOrUpdate" - 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, ruleName, parameters, options) - if err != nil { - return MetricAlertsClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MetricAlertsClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return MetricAlertsClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *MetricAlertsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResource, options *MetricAlertsClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ruleName == "" { - return nil, errors.New("parameter ruleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *MetricAlertsClient) createOrUpdateHandleResponse(resp *http.Response) (MetricAlertsClientCreateOrUpdateResponse, error) { - result := MetricAlertsClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MetricAlertResource); err != nil { - return MetricAlertsClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Delete an alert rule definition. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2018-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - ruleName - The name of the rule. -// - options - MetricAlertsClientDeleteOptions contains the optional parameters for the MetricAlertsClient.Delete method. -func (client *MetricAlertsClient) Delete(ctx context.Context, resourceGroupName string, ruleName string, options *MetricAlertsClientDeleteOptions) (MetricAlertsClientDeleteResponse, error) { - var err error - const operationName = "MetricAlertsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, ruleName, options) - if err != nil { - return MetricAlertsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MetricAlertsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return MetricAlertsClientDeleteResponse{}, err - } - return MetricAlertsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *MetricAlertsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, options *MetricAlertsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ruleName == "" { - return nil, errors.New("parameter ruleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Retrieve an alert rule definition. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2018-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - ruleName - The name of the rule. -// - options - MetricAlertsClientGetOptions contains the optional parameters for the MetricAlertsClient.Get method. -func (client *MetricAlertsClient) Get(ctx context.Context, resourceGroupName string, ruleName string, options *MetricAlertsClientGetOptions) (MetricAlertsClientGetResponse, error) { - var err error - const operationName = "MetricAlertsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, ruleName, options) - if err != nil { - return MetricAlertsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MetricAlertsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return MetricAlertsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *MetricAlertsClient) getCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, options *MetricAlertsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ruleName == "" { - return nil, errors.New("parameter ruleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *MetricAlertsClient) getHandleResponse(resp *http.Response) (MetricAlertsClientGetResponse, error) { - result := MetricAlertsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MetricAlertResource); err != nil { - return MetricAlertsClientGetResponse{}, err - } - return result, nil -} - -// NewListByResourceGroupPager - Retrieve alert rule definitions in a resource group. -// -// Generated from API version 2018-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - options - MetricAlertsClientListByResourceGroupOptions contains the optional parameters for the MetricAlertsClient.NewListByResourceGroupPager -// method. -func (client *MetricAlertsClient) NewListByResourceGroupPager(resourceGroupName string, options *MetricAlertsClientListByResourceGroupOptions) *runtime.Pager[MetricAlertsClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[MetricAlertsClientListByResourceGroupResponse]{ - More: func(page MetricAlertsClientListByResourceGroupResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *MetricAlertsClientListByResourceGroupResponse) (MetricAlertsClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MetricAlertsClient.NewListByResourceGroupPager") - req, err := client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - if err != nil { - return MetricAlertsClientListByResourceGroupResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MetricAlertsClientListByResourceGroupResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MetricAlertsClientListByResourceGroupResponse{}, runtime.NewResponseError(resp) - } - return client.listByResourceGroupHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *MetricAlertsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *MetricAlertsClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *MetricAlertsClient) listByResourceGroupHandleResponse(resp *http.Response) (MetricAlertsClientListByResourceGroupResponse, error) { - result := MetricAlertsClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MetricAlertResourceCollection); err != nil { - return MetricAlertsClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionPager - Retrieve alert rule definitions in a subscription. -// -// Generated from API version 2018-03-01 -// - options - MetricAlertsClientListBySubscriptionOptions contains the optional parameters for the MetricAlertsClient.NewListBySubscriptionPager -// method. -func (client *MetricAlertsClient) NewListBySubscriptionPager(options *MetricAlertsClientListBySubscriptionOptions) *runtime.Pager[MetricAlertsClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[MetricAlertsClientListBySubscriptionResponse]{ - More: func(page MetricAlertsClientListBySubscriptionResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *MetricAlertsClientListBySubscriptionResponse) (MetricAlertsClientListBySubscriptionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MetricAlertsClient.NewListBySubscriptionPager") - req, err := client.listBySubscriptionCreateRequest(ctx, options) - if err != nil { - return MetricAlertsClientListBySubscriptionResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MetricAlertsClientListBySubscriptionResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MetricAlertsClientListBySubscriptionResponse{}, runtime.NewResponseError(resp) - } - return client.listBySubscriptionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *MetricAlertsClient) listBySubscriptionCreateRequest(ctx context.Context, options *MetricAlertsClientListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *MetricAlertsClient) listBySubscriptionHandleResponse(resp *http.Response) (MetricAlertsClientListBySubscriptionResponse, error) { - result := MetricAlertsClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MetricAlertResourceCollection); err != nil { - return MetricAlertsClientListBySubscriptionResponse{}, err - } - return result, nil -} - -// Update - Update an metric alert definition. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2018-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - ruleName - The name of the rule. -// - parameters - The parameters of the rule to update. -// - options - MetricAlertsClientUpdateOptions contains the optional parameters for the MetricAlertsClient.Update method. -func (client *MetricAlertsClient) Update(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch, options *MetricAlertsClientUpdateOptions) (MetricAlertsClientUpdateResponse, error) { - var err error - const operationName = "MetricAlertsClient.Update" - 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, ruleName, parameters, options) - if err != nil { - return MetricAlertsClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MetricAlertsClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return MetricAlertsClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *MetricAlertsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, parameters MetricAlertResourcePatch, options *MetricAlertsClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ruleName == "" { - return nil, errors.New("parameter ruleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *MetricAlertsClient) updateHandleResponse(resp *http.Response) (MetricAlertsClientUpdateResponse, error) { - result := MetricAlertsClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MetricAlertResource); err != nil { - return MetricAlertsClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metricalerts_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/metricalerts_client_example_test.go deleted file mode 100644 index 6d1dd5eb5028..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metricalerts_client_example_test.go +++ /dev/null @@ -1,1477 +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 armmonitor_test - -import ( - "context" - "log" - - "time" - - "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/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/listMetricAlert.json -func ExampleMetricAlertsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMetricAlertsClient().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.MetricAlertResourceCollection = armmonitor.MetricAlertResourceCollection{ - // Value: []*armmonitor.MetricAlertResource{ - // { - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/highcpu"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // Criteria: &armmonitor.MetricAlertSingleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), - // AllOf: []*armmonitor.MetricCriteria{ - // { - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("CustomMetric_\\Processor(_Total)\\% Processor Time"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("Pt1m"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - // Severity: to.Ptr[int32](3), - // WindowSize: to.Ptr("Pt15m"), - // }, - // }, - // { - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/mediumcpu"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("Med cpu alert"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // Criteria: &armmonitor.MetricAlertSingleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), - // AllOf: []*armmonitor.MetricCriteria{ - // { - // Name: to.Ptr("Medium_CPU_50"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("CustomMetric_\\Processor(_Total)\\% Processor Time"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](50.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("Pt1m"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - // Severity: to.Ptr[int32](4), - // WindowSize: to.Ptr("Pt15m"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getDynamicMetricAlertMultipleResource.json -func ExampleMetricAlertsClient_Get_getADynamicAlertRuleForMultipleResources() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "gigtest", "MetricAlertOnMultipleResources", 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.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertOnMultipleResources"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(false), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.DynamicMetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), - // FailingPeriods: &armmonitor.DynamicThresholdFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[float32](4), - // NumberOfEvaluationPeriods: to.Ptr[float32](4), - // }, - // Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getDynamicMetricAlertSingleResource.json -func ExampleMetricAlertsClient_Get_getADynamicAlertRuleForSingleResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "gigtest", "chiricutin", 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.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(false), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.DynamicMetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), - // FailingPeriods: &armmonitor.DynamicThresholdFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[float32](4), - // NumberOfEvaluationPeriods: to.Ptr[float32](4), - // }, - // Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("Pt1m"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - // Severity: to.Ptr[int32](3), - // WindowSize: to.Ptr("Pt15m"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getWebTestMetricAlert.json -func ExampleMetricAlertsClient_Get_getAWebTestAlertRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "rg-example", "webtest-name-example", 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.MetricAlertResource = armmonitor.MetricAlertResource{ - // Name: to.Ptr("webtest-name-example"), - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/metricalerts/webtest-name-example"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example": to.Ptr("Resource"), - // "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("Automatically created alert rule for availability test \"webtest-name-example\""), - // Actions: []*armmonitor.MetricAlertAction{ - // }, - // Criteria: &armmonitor.WebtestLocationAvailabilityCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria), - // ComponentID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example"), - // FailedLocationCount: to.Ptr[float32](2), - // WebTestID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example"), - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example"), - // to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example")}, - // Severity: to.Ptr[int32](4), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertMultipleResource.json -func ExampleMetricAlertsClient_Get_getAnAlertRuleForMultipleResources() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "gigtest", "MetricAlertOnMultipleResources", 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.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertOnMultipleResources"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(false), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.MetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1"), - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertSingleResource.json -func ExampleMetricAlertsClient_Get_getAnAlertRuleForSingleResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "gigtest", "chiricutin", 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.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(false), - // Criteria: &armmonitor.MetricAlertSingleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), - // AllOf: []*armmonitor.MetricCriteria{ - // { - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("\\Processor(_Total)\\% Processor Time"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("Pt1m"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - // Severity: to.Ptr[int32](3), - // WindowSize: to.Ptr("Pt15m"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertResourceGroup.json -func ExampleMetricAlertsClient_Get_getAnAlertRuleOnResourceGroupS() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "gigtest1", "MetricAlertAtResourceGroupLevel", 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.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1/providers/providers/microsoft.insights/metricalerts/MetricAlertAtResourceGroupLevel"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(false), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.MetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1"), - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest2")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertSubscription.json -func ExampleMetricAlertsClient_Get_getAnAlertRuleOnSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Get(ctx, "gigtest", "MetricAlertAtSubscriptionLevel", 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.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertAtSubscriptionLevel"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(false), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.MetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateDynamicMetricAlertMultipleResource.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateADynamicAlertRuleForMultipleResources() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "MetricAlertOnMultipleResources", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{}, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - AllOf: []armmonitor.MultiMetricCriteriaClassification{ - &armmonitor.DynamicMetricCriteria{ - Name: to.Ptr("High_CPU_80"), - CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{}, - MetricName: to.Ptr("Percentage CPU"), - MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), - FailingPeriods: &armmonitor.DynamicThresholdFailingPeriods{ - MinFailingPeriodsToAlert: to.Ptr[float32](4), - NumberOfEvaluationPeriods: to.Ptr[float32](4), - }, - Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT1M"), - Scopes: []*string{ - to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1"), - to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2")}, - Severity: to.Ptr[int32](3), - TargetResourceRegion: to.Ptr("southcentralus"), - TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - WindowSize: to.Ptr("PT15M"), - }, - }, 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.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertOnMultipleResources"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.DynamicMetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), - // FailingPeriods: &armmonitor.DynamicThresholdFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[float32](4), - // NumberOfEvaluationPeriods: to.Ptr[float32](4), - // }, - // Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1"), - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateDynamicMetricAlertSingleResource.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateADynamicAlertRuleForSingleResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "chiricutin", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{}, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - AllOf: []armmonitor.MultiMetricCriteriaClassification{ - &armmonitor.DynamicMetricCriteria{ - Name: to.Ptr("High_CPU_80"), - CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{}, - MetricName: to.Ptr("Percentage CPU"), - MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), - FailingPeriods: &armmonitor.DynamicThresholdFailingPeriods{ - MinFailingPeriodsToAlert: to.Ptr[float32](4), - NumberOfEvaluationPeriods: to.Ptr[float32](4), - }, - IgnoreDataBefore: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-04T21:00:00.000Z"); return t }()), - Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT1M"), - Scopes: []*string{ - to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - Severity: to.Ptr[int32](3), - WindowSize: to.Ptr("PT15M"), - }, - }, 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.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.DynamicMetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeDynamicThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // AlertSensitivity: to.Ptr(armmonitor.DynamicThresholdSensitivityMedium), - // FailingPeriods: &armmonitor.DynamicThresholdFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[float32](4), - // NumberOfEvaluationPeriods: to.Ptr[float32](4), - // }, - // IgnoreDataBefore: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-04-04T21:00:00.000Z"); return t}()), - // Operator: to.Ptr(armmonitor.DynamicThresholdOperatorGreaterOrLessThan), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateWebTestMetricAlert.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAWebTestAlertRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "rg-example", "webtest-name-example", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{ - "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example": to.Ptr("Resource"), - "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example": to.Ptr("Resource"), - }, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("Automatically created alert rule for availability test \"component-example\" a"), - Actions: []*armmonitor.MetricAlertAction{}, - Criteria: &armmonitor.WebtestLocationAvailabilityCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria), - ComponentID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example"), - FailedLocationCount: to.Ptr[float32](2), - WebTestID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example"), - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT1M"), - Scopes: []*string{ - to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example"), - to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example")}, - Severity: to.Ptr[int32](4), - WindowSize: to.Ptr("PT15M"), - }, - }, 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.MetricAlertResource = armmonitor.MetricAlertResource{ - // Name: to.Ptr("webtest-name-example"), - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/metricalerts/webtest-name-example"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example": to.Ptr("Resource"), - // "hidden-link:/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("Automatically created alert rule for availability test \"webtest-name-example\" a"), - // Actions: []*armmonitor.MetricAlertAction{ - // }, - // Criteria: &armmonitor.WebtestLocationAvailabilityCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria), - // ComponentID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example"), - // FailedLocationCount: to.Ptr[float32](2), - // WebTestID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example"), - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/webtest-name-example"), - // to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/component-example")}, - // Severity: to.Ptr[int32](4), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertMultipleResource.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRuleForMultipleResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "MetricAlertOnMultipleResources", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{}, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - AllOf: []armmonitor.MultiMetricCriteriaClassification{ - &armmonitor.MetricCriteria{ - Name: to.Ptr("High_CPU_80"), - CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{}, - MetricName: to.Ptr("Percentage CPU"), - MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - Operator: to.Ptr(armmonitor.OperatorGreaterThan), - Threshold: to.Ptr[float64](80.5), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT1M"), - Scopes: []*string{ - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1"), - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2")}, - Severity: to.Ptr[int32](3), - TargetResourceRegion: to.Ptr("southcentralus"), - TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - WindowSize: to.Ptr("PT15M"), - }, - }, 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.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertOnMultipleResources"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.MetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme1"), - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme2")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertSingleResource.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRuleForSingleResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "chiricutin", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{}, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertSingleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), - AllOf: []*armmonitor.MetricCriteria{ - { - Name: to.Ptr("High_CPU_80"), - CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{}, - MetricName: to.Ptr("\\Processor(_Total)\\% Processor Time"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - Operator: to.Ptr(armmonitor.OperatorGreaterThan), - Threshold: to.Ptr[float64](80.5), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("Pt1m"), - Scopes: []*string{ - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - Severity: to.Ptr[int32](3), - WindowSize: to.Ptr("Pt15m"), - }, - }, 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.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertSingleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), - // AllOf: []*armmonitor.MetricCriteria{ - // { - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("\\Processor(_Total)\\% Processor Time"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("Pt1m"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - // Severity: to.Ptr[int32](3), - // WindowSize: to.Ptr("Pt15m"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertResourceGroup.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRuleOnResourceGroupS() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest1", "MetricAlertAtResourceGroupLevel", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{}, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - AllOf: []armmonitor.MultiMetricCriteriaClassification{ - &armmonitor.MetricCriteria{ - Name: to.Ptr("High_CPU_80"), - CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{}, - MetricName: to.Ptr("Percentage CPU"), - MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - Operator: to.Ptr(armmonitor.OperatorGreaterThan), - Threshold: to.Ptr[float64](80.5), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT1M"), - Scopes: []*string{ - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1"), - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest2")}, - Severity: to.Ptr[int32](3), - TargetResourceRegion: to.Ptr("southcentralus"), - TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - WindowSize: to.Ptr("PT15M"), - }, - }, 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.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1/providers/providers/microsoft.insights/metricalerts/MetricAlertAtResourceGroupLevel"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.MetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1"), - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest2")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertSubscription.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRuleOnSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "MetricAlertAtSubscriptionLevel", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{}, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - AllOf: []armmonitor.MultiMetricCriteriaClassification{ - &armmonitor.MetricCriteria{ - Name: to.Ptr("High_CPU_80"), - CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{}, - MetricName: to.Ptr("Percentage CPU"), - MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - Operator: to.Ptr(armmonitor.OperatorGreaterThan), - Threshold: to.Ptr[float64](80.5), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT1M"), - Scopes: []*string{ - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7")}, - Severity: to.Ptr[int32](3), - TargetResourceRegion: to.Ptr("southcentralus"), - TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - WindowSize: to.Ptr("PT15M"), - }, - }, 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.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertAtSubscriptionLevel"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.MetricCriteria{ - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("Percentage CPU"), - // MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1M"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.Compute/virtualMachines"), - // WindowSize: to.Ptr("PT15M"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertWithDimensions.json -func ExampleMetricAlertsClient_CreateOrUpdate_createOrUpdateAnAlertRulesWithDimensions() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().CreateOrUpdate(ctx, "gigtest", "MetricAlertOnMultipleDimensions", armmonitor.MetricAlertResource{ - Location: to.Ptr("global"), - Tags: map[string]*string{}, - Properties: &armmonitor.MetricAlertProperties{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - AllOf: []armmonitor.MultiMetricCriteriaClassification{ - &armmonitor.MetricCriteria{ - Name: to.Ptr("Metric1"), - CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{ - { - Name: to.Ptr("ActivityName"), - Operator: to.Ptr("Include"), - Values: []*string{ - to.Ptr("*")}, - }, - { - Name: to.Ptr("StatusCode"), - Operator: to.Ptr("Include"), - Values: []*string{ - to.Ptr("200")}, - }}, - MetricName: to.Ptr("Availability"), - MetricNamespace: to.Ptr("Microsoft.KeyVault/vaults"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - Operator: to.Ptr(armmonitor.OperatorGreaterThan), - Threshold: to.Ptr[float64](55), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT1H"), - Scopes: []*string{ - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.KeyVault/vaults/keyVaultResource")}, - Severity: to.Ptr[int32](3), - WindowSize: to.Ptr("P1D"), - }, - }, 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.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/MetricAlertWithDimensions"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertMultipleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria), - // AllOf: []armmonitor.MultiMetricCriteriaClassification{ - // &armmonitor.MetricCriteria{ - // Name: to.Ptr("Metric1"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // { - // Name: to.Ptr("ActivityName"), - // Operator: to.Ptr("Include"), - // Values: []*string{ - // to.Ptr("*")}, - // }, - // { - // Name: to.Ptr("StatusCode"), - // Operator: to.Ptr("Include"), - // Values: []*string{ - // to.Ptr("200")}, - // }}, - // MetricName: to.Ptr("Availability"), - // MetricNamespace: to.Ptr("Microsoft.KeyVault/vaults"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](55), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT1H"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.KeyVault/vaults/keyVaultResource")}, - // Severity: to.Ptr[int32](3), - // TargetResourceRegion: to.Ptr("southcentralus"), - // TargetResourceType: to.Ptr("Microsoft.KeyVault/vaults"), - // WindowSize: to.Ptr("P1D"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/UpdateMetricAlert.json -func ExampleMetricAlertsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsClient().Update(ctx, "gigtest", "chiricutin", armmonitor.MetricAlertResourcePatch{ - Properties: &armmonitor.MetricAlertPropertiesPatch{ - Description: to.Ptr("This is the description of the rule1"), - Actions: []*armmonitor.MetricAlertAction{ - { - ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - WebHookProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }}, - AutoMitigate: to.Ptr(true), - Criteria: &armmonitor.MetricAlertSingleResourceMultipleMetricCriteria{ - ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), - AllOf: []*armmonitor.MetricCriteria{ - { - Name: to.Ptr("High_CPU_80"), - CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - Dimensions: []*armmonitor.MetricDimension{}, - MetricName: to.Ptr("\\Processor(_Total)\\% Processor Time"), - TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - Operator: to.Ptr(armmonitor.OperatorGreaterThan), - Threshold: to.Ptr[float64](80.5), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("Pt1m"), - Scopes: []*string{ - to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - Severity: to.Ptr[int32](3), - WindowSize: to.Ptr("Pt15m"), - }, - Tags: map[string]*string{}, - }, 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.MetricAlertResource = armmonitor.MetricAlertResource{ - // Type: to.Ptr("Microsoft.Insights/metricAlerts"), - // ID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/providers/microsoft.insights/metricalerts/chiricutin"), - // Location: to.Ptr("global"), - // Tags: map[string]*string{ - // "hidden-link:/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest": to.Ptr("Resource"), - // }, - // Properties: &armmonitor.MetricAlertProperties{ - // Description: to.Ptr("This is the description of the rule1"), - // Actions: []*armmonitor.MetricAlertAction{ - // { - // ActionGroupID: to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2"), - // WebHookProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }}, - // AutoMitigate: to.Ptr(true), - // Criteria: &armmonitor.MetricAlertSingleResourceMultipleMetricCriteria{ - // ODataType: to.Ptr(armmonitor.OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria), - // AllOf: []*armmonitor.MetricCriteria{ - // { - // Name: to.Ptr("High_CPU_80"), - // CriterionType: to.Ptr(armmonitor.CriterionTypeStaticThresholdCriterion), - // Dimensions: []*armmonitor.MetricDimension{ - // }, - // MetricName: to.Ptr("\\Processor(_Total)\\% Processor Time"), - // TimeAggregation: to.Ptr(armmonitor.AggregationTypeEnumAverage), - // Operator: to.Ptr(armmonitor.OperatorGreaterThan), - // Threshold: to.Ptr[float64](80.5), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("Pt1m"), - // Scopes: []*string{ - // to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")}, - // Severity: to.Ptr[int32](3), - // WindowSize: to.Ptr("Pt15m"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/deleteMetricAlert.json -func ExampleMetricAlertsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewMetricAlertsClient().Delete(ctx, "gigtest", "chiricutin", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client.go b/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client.go deleted file mode 100644 index 08919a9901e7..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client.go +++ /dev/null @@ -1,178 +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 armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// MetricAlertsStatusClient contains the methods for the MetricAlertsStatus group. -// Don't use this type directly, use NewMetricAlertsStatusClient() instead. -type MetricAlertsStatusClient struct { - internal *arm.Client - subscriptionID string -} - -// NewMetricAlertsStatusClient creates a new instance of MetricAlertsStatusClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewMetricAlertsStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MetricAlertsStatusClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &MetricAlertsStatusClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// List - Retrieve an alert rule status. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2018-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - ruleName - The name of the rule. -// - options - MetricAlertsStatusClientListOptions contains the optional parameters for the MetricAlertsStatusClient.List method. -func (client *MetricAlertsStatusClient) List(ctx context.Context, resourceGroupName string, ruleName string, options *MetricAlertsStatusClientListOptions) (MetricAlertsStatusClientListResponse, error) { - var err error - const operationName = "MetricAlertsStatusClient.List" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listCreateRequest(ctx, resourceGroupName, ruleName, options) - if err != nil { - return MetricAlertsStatusClientListResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MetricAlertsStatusClientListResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return MetricAlertsStatusClientListResponse{}, err - } - resp, err := client.listHandleResponse(httpResp) - return resp, err -} - -// listCreateRequest creates the List request. -func (client *MetricAlertsStatusClient) listCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, options *MetricAlertsStatusClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ruleName == "" { - return nil, errors.New("parameter ruleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *MetricAlertsStatusClient) listHandleResponse(resp *http.Response) (MetricAlertsStatusClientListResponse, error) { - result := MetricAlertsStatusClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MetricAlertStatusCollection); err != nil { - return MetricAlertsStatusClientListResponse{}, err - } - return result, nil -} - -// ListByName - Retrieve an alert rule status. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2018-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - ruleName - The name of the rule. -// - statusName - The name of the status. -// - options - MetricAlertsStatusClientListByNameOptions contains the optional parameters for the MetricAlertsStatusClient.ListByName -// method. -func (client *MetricAlertsStatusClient) ListByName(ctx context.Context, resourceGroupName string, ruleName string, statusName string, options *MetricAlertsStatusClientListByNameOptions) (MetricAlertsStatusClientListByNameResponse, error) { - var err error - const operationName = "MetricAlertsStatusClient.ListByName" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listByNameCreateRequest(ctx, resourceGroupName, ruleName, statusName, options) - if err != nil { - return MetricAlertsStatusClientListByNameResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MetricAlertsStatusClientListByNameResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return MetricAlertsStatusClientListByNameResponse{}, err - } - resp, err := client.listByNameHandleResponse(httpResp) - return resp, err -} - -// listByNameCreateRequest creates the ListByName request. -func (client *MetricAlertsStatusClient) listByNameCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, statusName string, options *MetricAlertsStatusClientListByNameOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/metricAlerts/{ruleName}/status/{statusName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if ruleName == "" { - return nil, errors.New("parameter ruleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{ruleName}", url.PathEscape(ruleName)) - if statusName == "" { - return nil, errors.New("parameter statusName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{statusName}", url.PathEscape(statusName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByNameHandleResponse handles the ListByName response. -func (client *MetricAlertsStatusClient) listByNameHandleResponse(resp *http.Response) (MetricAlertsStatusClientListByNameResponse, error) { - result := MetricAlertsStatusClientListByNameResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MetricAlertStatusCollection); err != nil { - return MetricAlertsStatusClientListByNameResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client_example_test.go deleted file mode 100644 index 1e773c902b9a..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metricalertsstatus_client_example_test.go +++ /dev/null @@ -1,88 +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 armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertStatus.json -func ExampleMetricAlertsStatusClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsStatusClient().List(ctx, "gigtest", "chiricutin", 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.MetricAlertStatusCollection = armmonitor.MetricAlertStatusCollection{ - // Value: []*armmonitor.MetricAlertStatus{ - // { - // Name: to.Ptr("cmVzb3VyY2VJZD0vc3Vic2NyaXB0aW9ucy8xNGRkZjBjNS03N2M1LTRiNTMtODRmNi1lMWZhNDNhZDY4ZjcvcmVzb3VyY2VHcm91cHMvZ2lndGVzdC9wcm92aWRlcnMvTWljcm9zb2Z0LkNvbXB1dGUvdmlydHVhbE1hY2hpbmVzL2dpZ3dhZG1l"), - // Type: to.Ptr("Microsoft.Insights/metricAlerts/status"), - // ID: to.Ptr("/subscriptions/009f6022-67ec-423e-9aa7-691182870588/resourceGroups/EastUs/providers/microsoft.insights/metricAlerts/LeoAlert_custom1"), - // Properties: &armmonitor.MetricAlertStatusProperties{ - // Dimensions: map[string]*string{ - // "resourceId": to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme"), - // }, - // Status: to.Ptr("Healthy"), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-17T20:17:25.629Z"); return t}()), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertStatusByName.json -func ExampleMetricAlertsStatusClient_ListByName() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricAlertsStatusClient().ListByName(ctx, "EastUs", "custom1", "cmVzb3VyY2VJZD0vc3Vic2NyaXB0aW9ucy8xNGRkZjBjNS03N2M1LTRiNTMtODRmNi1lMWZhNDNhZDY4ZjcvcmVzb3VyY2VHcm91cHMvZ2lndGVzdC9wcm92aWRlcnMvTWljcm9zb2Z0LkNvbXB1dGUvdmlydHVhbE1hY2hpbmVzL2dpZ3dhZG1l", 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.MetricAlertStatusCollection = armmonitor.MetricAlertStatusCollection{ - // Value: []*armmonitor.MetricAlertStatus{ - // { - // Name: to.Ptr("cmVzb3VyY2VJZD0vc3Vic2NyaXB0aW9ucy8xNGRkZjBjNS03N2M1LTRiNTMtODRmNi1lMWZhNDNhZDY4ZjcvcmVzb3VyY2VHcm91cHMvZ2lndGVzdC9wcm92aWRlcnMvTWljcm9zb2Z0LkNvbXB1dGUvdmlydHVhbE1hY2hpbmVzL2dpZ3dhZG1l"), - // Type: to.Ptr("Microsoft.Insights/metricAlerts/status"), - // ID: to.Ptr("/subscriptions/009f6022-67ec-423e-9aa7-691182870588/resourceGroups/EastUs/providers/microsoft.insights/metricAlerts/custom1"), - // Properties: &armmonitor.MetricAlertStatusProperties{ - // Dimensions: map[string]*string{ - // "resourceId": to.Ptr("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme"), - // }, - // Status: to.Ptr("Healthy"), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-01-17T20:17:25.629Z"); return t}()), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client.go b/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client.go deleted file mode 100644 index 0f7f6dc1ab0c..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client.go +++ /dev/null @@ -1,162 +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 armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// MetricDefinitionsClient contains the methods for the MetricDefinitions group. -// Don't use this type directly, use NewMetricDefinitionsClient() instead. -type MetricDefinitionsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewMetricDefinitionsClient creates a new instance of MetricDefinitionsClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewMetricDefinitionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MetricDefinitionsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &MetricDefinitionsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// NewListPager - Lists the metric definitions for the resource. -// -// Generated from API version 2021-05-01 -// - resourceURI - The identifier of the resource. -// - options - MetricDefinitionsClientListOptions contains the optional parameters for the MetricDefinitionsClient.NewListPager -// method. -func (client *MetricDefinitionsClient) NewListPager(resourceURI string, options *MetricDefinitionsClientListOptions) *runtime.Pager[MetricDefinitionsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[MetricDefinitionsClientListResponse]{ - More: func(page MetricDefinitionsClientListResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *MetricDefinitionsClientListResponse) (MetricDefinitionsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MetricDefinitionsClient.NewListPager") - req, err := client.listCreateRequest(ctx, resourceURI, options) - if err != nil { - return MetricDefinitionsClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MetricDefinitionsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MetricDefinitionsClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *MetricDefinitionsClient) listCreateRequest(ctx context.Context, resourceURI string, options *MetricDefinitionsClientListOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.Insights/metricDefinitions" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") - if options != nil && options.Metricnamespace != nil { - reqQP.Set("metricnamespace", *options.Metricnamespace) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *MetricDefinitionsClient) listHandleResponse(resp *http.Response) (MetricDefinitionsClientListResponse, error) { - result := MetricDefinitionsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MetricDefinitionCollection); err != nil { - return MetricDefinitionsClientListResponse{}, err - } - return result, nil -} - -// NewListAtSubscriptionScopePager - Lists the metric definitions for the subscription. -// -// Generated from API version 2021-05-01 -// - region - The region where the metrics you want reside. -// - options - MetricDefinitionsClientListAtSubscriptionScopeOptions contains the optional parameters for the MetricDefinitionsClient.NewListAtSubscriptionScopePager -// method. -func (client *MetricDefinitionsClient) NewListAtSubscriptionScopePager(region string, options *MetricDefinitionsClientListAtSubscriptionScopeOptions) *runtime.Pager[MetricDefinitionsClientListAtSubscriptionScopeResponse] { - return runtime.NewPager(runtime.PagingHandler[MetricDefinitionsClientListAtSubscriptionScopeResponse]{ - More: func(page MetricDefinitionsClientListAtSubscriptionScopeResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *MetricDefinitionsClientListAtSubscriptionScopeResponse) (MetricDefinitionsClientListAtSubscriptionScopeResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MetricDefinitionsClient.NewListAtSubscriptionScopePager") - req, err := client.listAtSubscriptionScopeCreateRequest(ctx, region, options) - if err != nil { - return MetricDefinitionsClientListAtSubscriptionScopeResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MetricDefinitionsClientListAtSubscriptionScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MetricDefinitionsClientListAtSubscriptionScopeResponse{}, runtime.NewResponseError(resp) - } - return client.listAtSubscriptionScopeHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listAtSubscriptionScopeCreateRequest creates the ListAtSubscriptionScope request. -func (client *MetricDefinitionsClient) listAtSubscriptionScopeCreateRequest(ctx context.Context, region string, options *MetricDefinitionsClientListAtSubscriptionScopeOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricDefinitions" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") - reqQP.Set("region", region) - if options != nil && options.Metricnamespace != nil { - reqQP.Set("metricnamespace", *options.Metricnamespace) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listAtSubscriptionScopeHandleResponse handles the ListAtSubscriptionScope response. -func (client *MetricDefinitionsClient) listAtSubscriptionScopeHandleResponse(resp *http.Response) (MetricDefinitionsClientListAtSubscriptionScopeResponse, error) { - result := MetricDefinitionsClientListAtSubscriptionScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionScopeMetricDefinitionCollection); err != nil { - return MetricDefinitionsClientListAtSubscriptionScopeResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client_example_test.go deleted file mode 100644 index 94630917f42d..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metricdefinitions_client_example_test.go +++ /dev/null @@ -1,7245 +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 armmonitor_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/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMultiResourceMetricDefinitions.json -func ExampleMetricDefinitionsClient_NewListAtSubscriptionScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMetricDefinitionsClient().NewListAtSubscriptionScopePager("westus2", &armmonitor.MetricDefinitionsClientListAtSubscriptionScopeOptions{Metricnamespace: to.Ptr("microsoft.compute/virtualmachines")}) - 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.SubscriptionScopeMetricDefinitionCollection = armmonitor.SubscriptionScopeMetricDefinitionCollection{ - // Value: []*armmonitor.SubscriptionScopeMetricDefinition{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Percentage CPU"), - // Value: to.Ptr("Percentage CPU"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("The percentage of allocated compute units that are currently in use by the Virtual Machine(s)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Percentage CPU"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Network In Billable (Deprecated)"), - // Value: to.Ptr("Network In"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("The number of billable bytes received on all network interfaces by the Virtual Machine(s) (Incoming Traffic) (Deprecated)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Network In"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeTotal), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Network Out Billable (Deprecated)"), - // Value: to.Ptr("Network Out"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("The number of billable bytes out on all network interfaces by the Virtual Machine(s) (Outgoing Traffic) (Deprecated)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Network Out"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeTotal), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Disk Read Bytes"), - // Value: to.Ptr("Disk Read Bytes"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Bytes read from disk during monitoring period"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Disk Read Bytes"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeTotal), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Disk Write Bytes"), - // Value: to.Ptr("Disk Write Bytes"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Bytes written to disk during monitoring period"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Disk Write Bytes"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeTotal), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Disk Read Operations/Sec"), - // Value: to.Ptr("Disk Read Operations/Sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Disk Read IOPS"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Disk Read Operations/Sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Disk Write Operations/Sec"), - // Value: to.Ptr("Disk Write Operations/Sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Disk Write IOPS"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Disk Write Operations/Sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("CPU Credits Remaining"), - // Value: to.Ptr("CPU Credits Remaining"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Total number of credits available to burst. Only available on B-series burstable VMs"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/CPU Credits Remaining"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("CPU Credits Consumed"), - // Value: to.Ptr("CPU Credits Consumed"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Total number of credits consumed by the Virtual Machine. Only available on B-series burstable VMs"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/CPU Credits Consumed"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Read Bytes/Sec"), - // Value: to.Ptr("Data Disk Read Bytes/sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Bytes/Sec read from a single disk during monitoring period"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Read Bytes/sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Write Bytes/Sec"), - // Value: to.Ptr("Data Disk Write Bytes/sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Bytes/Sec written to a single disk during monitoring period"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Write Bytes/sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Read Operations/Sec"), - // Value: to.Ptr("Data Disk Read Operations/Sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Read IOPS from a single disk during monitoring period"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Read Operations/Sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Write Operations/Sec"), - // Value: to.Ptr("Data Disk Write Operations/Sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Write IOPS from a single disk during monitoring period"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Write Operations/Sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Queue Depth"), - // Value: to.Ptr("Data Disk Queue Depth"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Data Disk Queue Depth(or Queue Length)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Queue Depth"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Bandwidth Consumed Percentage"), - // Value: to.Ptr("Data Disk Bandwidth Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of data disk bandwidth consumed per minute"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Bandwidth Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk IOPS Consumed Percentage"), - // Value: to.Ptr("Data Disk IOPS Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of data disk I/Os consumed per minute"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk IOPS Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Target Bandwidth"), - // Value: to.Ptr("Data Disk Target Bandwidth"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Baseline bytes per second throughput Data Disk can achieve without bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Target Bandwidth"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Target IOPS"), - // Value: to.Ptr("Data Disk Target IOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Baseline IOPS Data Disk can achieve without bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Target IOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Max Burst Bandwidth"), - // Value: to.Ptr("Data Disk Max Burst Bandwidth"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Maximum bytes per second throughput Data Disk can achieve with bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Max Burst Bandwidth"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Max Burst IOPS"), - // Value: to.Ptr("Data Disk Max Burst IOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Maximum IOPS Data Disk can achieve with bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Max Burst IOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Used Burst BPS Credits Percentage"), - // Value: to.Ptr("Data Disk Used Burst BPS Credits Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of Data Disk burst bandwidth credits used so far"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Used Burst BPS Credits Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Used Burst IO Credits Percentage"), - // Value: to.Ptr("Data Disk Used Burst IO Credits Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of Data Disk burst I/O credits used so far"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Data Disk Used Burst IO Credits Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Read Bytes/Sec"), - // Value: to.Ptr("OS Disk Read Bytes/sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Bytes/Sec read from a single disk during monitoring period for OS disk"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Read Bytes/sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Write Bytes/Sec"), - // Value: to.Ptr("OS Disk Write Bytes/sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Bytes/Sec written to a single disk during monitoring period for OS disk"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Write Bytes/sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Read Operations/Sec"), - // Value: to.Ptr("OS Disk Read Operations/Sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Read IOPS from a single disk during monitoring period for OS disk"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Read Operations/Sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Write Operations/Sec"), - // Value: to.Ptr("OS Disk Write Operations/Sec"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Write IOPS from a single disk during monitoring period for OS disk"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Write Operations/Sec"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Queue Depth"), - // Value: to.Ptr("OS Disk Queue Depth"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("OS Disk Queue Depth(or Queue Length)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Queue Depth"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Bandwidth Consumed Percentage"), - // Value: to.Ptr("OS Disk Bandwidth Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of operating system disk bandwidth consumed per minute"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Bandwidth Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk IOPS Consumed Percentage"), - // Value: to.Ptr("OS Disk IOPS Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of operating system disk I/Os consumed per minute"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk IOPS Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Target Bandwidth"), - // Value: to.Ptr("OS Disk Target Bandwidth"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Baseline bytes per second throughput OS Disk can achieve without bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Target Bandwidth"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Target IOPS"), - // Value: to.Ptr("OS Disk Target IOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Baseline IOPS OS Disk can achieve without bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Target IOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Max Burst Bandwidth"), - // Value: to.Ptr("OS Disk Max Burst Bandwidth"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Maximum bytes per second throughput OS Disk can achieve with bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Max Burst Bandwidth"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Max Burst IOPS"), - // Value: to.Ptr("OS Disk Max Burst IOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Maximum IOPS OS Disk can achieve with bursting"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Max Burst IOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Used Burst BPS Credits Percentage"), - // Value: to.Ptr("OS Disk Used Burst BPS Credits Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of OS Disk burst bandwidth credits used so far"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Used Burst BPS Credits Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("OS Disk Used Burst IO Credits Percentage"), - // Value: to.Ptr("OS Disk Used Burst IO Credits Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of OS Disk burst I/O credits used so far"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/OS Disk Used Burst IO Credits Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Inbound Flows"), - // Value: to.Ptr("Inbound Flows"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Inbound Flows are number of current flows in the inbound direction (traffic going into the VM)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Inbound Flows"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Outbound Flows"), - // Value: to.Ptr("Outbound Flows"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Outbound Flows are number of current flows in the outbound direction (traffic going out of the VM)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Outbound Flows"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Inbound Flows Maximum Creation Rate"), - // Value: to.Ptr("Inbound Flows Maximum Creation Rate"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("The maximum creation rate of inbound flows (traffic going into the VM)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Inbound Flows Maximum Creation Rate"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Outbound Flows Maximum Creation Rate"), - // Value: to.Ptr("Outbound Flows Maximum Creation Rate"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("The maximum creation rate of outbound flows (traffic going out of the VM)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Outbound Flows Maximum Creation Rate"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Premium Data Disk Cache Read Hit"), - // Value: to.Ptr("Premium Data Disk Cache Read Hit"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Premium Data Disk Cache Read Hit"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Premium Data Disk Cache Read Hit"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Premium Data Disk Cache Read Miss"), - // Value: to.Ptr("Premium Data Disk Cache Read Miss"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("LUN"), - // Value: to.Ptr("LUN"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Premium Data Disk Cache Read Miss"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Premium Data Disk Cache Read Miss"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Premium OS Disk Cache Read Hit"), - // Value: to.Ptr("Premium OS Disk Cache Read Hit"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Premium OS Disk Cache Read Hit"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Premium OS Disk Cache Read Hit"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Premium OS Disk Cache Read Miss"), - // Value: to.Ptr("Premium OS Disk Cache Read Miss"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Premium OS Disk Cache Read Miss"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Premium OS Disk Cache Read Miss"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("VM Cached Bandwidth Consumed Percentage"), - // Value: to.Ptr("VM Cached Bandwidth Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of cached disk bandwidth consumed by the VM"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/VM Cached Bandwidth Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("VM Cached IOPS Consumed Percentage"), - // Value: to.Ptr("VM Cached IOPS Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of cached disk IOPS consumed by the VM"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/VM Cached IOPS Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("VM Uncached Bandwidth Consumed Percentage"), - // Value: to.Ptr("VM Uncached Bandwidth Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of uncached disk bandwidth consumed by the VM"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/VM Uncached Bandwidth Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("VM Uncached IOPS Consumed Percentage"), - // Value: to.Ptr("VM Uncached IOPS Consumed Percentage"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("Percentage of uncached disk IOPS consumed by the VM"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/VM Uncached IOPS Consumed Percentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeAverage), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Network In Total"), - // Value: to.Ptr("Network In Total"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("The number of bytes received on all network interfaces by the Virtual Machine(s) (Incoming Traffic)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Network In Total"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeTotal), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Network Out Total"), - // Value: to.Ptr("Network Out Total"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceId"), - // Value: to.Ptr("Microsoft.ResourceId"), - // }, - // { - // LocalizedValue: to.Ptr("Microsoft.ResourceGroupName"), - // Value: to.Ptr("Microsoft.ResourceGroupName"), - // }}, - // DisplayDescription: to.Ptr("The number of bytes out on all network interfaces by the Virtual Machine(s) (Outgoing Traffic)"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/microsoft.insights/metricdefinitions/Network Out Total"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // PrimaryAggregationType: to.Ptr(armmonitor.MetricAggregationTypeTotal), - // ResourceID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5"), - // SupportedAggregationTypes: []*armmonitor.MetricAggregationType{ - // to.Ptr(armmonitor.MetricAggregationTypeNone), - // to.Ptr(armmonitor.MetricAggregationTypeAverage), - // to.Ptr(armmonitor.MetricAggregationTypeMinimum), - // to.Ptr(armmonitor.MetricAggregationTypeMaximum), - // to.Ptr(armmonitor.MetricAggregationTypeTotal), - // to.Ptr(armmonitor.MetricAggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMetricDefinitionsApplicationInsights.json -func ExampleMetricDefinitionsClient_NewListPager_getApplicationInsightsMetricDefinitionsWithoutFilter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMetricDefinitionsClient().NewListPager("subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions", &armmonitor.MetricDefinitionsClientListOptions{Metricnamespace: to.Ptr("microsoft.insights/components")}) - 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.MetricDefinitionCollection = armmonitor.MetricDefinitionCollection{ - // Value: []*armmonitor.MetricDefinition{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Availability"), - // Value: to.Ptr("availabilityResults/availabilityPercentage"), - // }, - // Category: to.Ptr("Availability"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Test name"), - // Value: to.Ptr("availabilityResult/name"), - // }, - // { - // LocalizedValue: to.Ptr("Run location"), - // Value: to.Ptr("availabilityResult/location"), - // }}, - // DisplayDescription: to.Ptr("Percentage of successfully completed availability tests"), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/availabilityResults/availabilityPercentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Availability tests"), - // Value: to.Ptr("availabilityResults/count"), - // }, - // Category: to.Ptr("Availability"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Test name"), - // Value: to.Ptr("availabilityResult/name"), - // }, - // { - // LocalizedValue: to.Ptr("Run location"), - // Value: to.Ptr("availabilityResult/location"), - // }, - // { - // LocalizedValue: to.Ptr("Test result"), - // Value: to.Ptr("availabilityResult/success"), - // }}, - // DisplayDescription: to.Ptr("Count of availability tests"), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/availabilityResults/count"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Availability test duration"), - // Value: to.Ptr("availabilityResults/duration"), - // }, - // Category: to.Ptr("Availability"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Test name"), - // Value: to.Ptr("availabilityResult/name"), - // }, - // { - // LocalizedValue: to.Ptr("Run location"), - // Value: to.Ptr("availabilityResult/location"), - // }, - // { - // LocalizedValue: to.Ptr("Test result"), - // Value: to.Ptr("availabilityResult/success"), - // }}, - // DisplayDescription: to.Ptr("Availability test duration"), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/availabilityResults/duration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Page load network connect time"), - // Value: to.Ptr("browserTimings/networkDuration"), - // }, - // Category: to.Ptr("Browser"), - // DisplayDescription: to.Ptr("Time between user request and network connection. Includes DNS lookup and transport connection."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/browserTimings/networkDuration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Client processing time"), - // Value: to.Ptr("browserTimings/processingDuration"), - // }, - // Category: to.Ptr("Browser"), - // DisplayDescription: to.Ptr("Time between receiving the last byte of a document until the DOM is loaded. Async requests may still be processing."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/browserTimings/processingDuration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Receiving response time"), - // Value: to.Ptr("browserTimings/receiveDuration"), - // }, - // Category: to.Ptr("Browser"), - // DisplayDescription: to.Ptr("Time between the first and last bytes, or until disconnection."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/browserTimings/receiveDuration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Send request time"), - // Value: to.Ptr("browserTimings/sendDuration"), - // }, - // Category: to.Ptr("Browser"), - // DisplayDescription: to.Ptr("Time between network connection and receiving the first byte."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/browserTimings/sendDuration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Browser page load time"), - // Value: to.Ptr("browserTimings/totalDuration"), - // }, - // Category: to.Ptr("Browser"), - // DisplayDescription: to.Ptr("Time from user request until DOM, stylesheets, scripts and images are loaded."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/browserTimings/totalDuration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Dependency calls"), - // Value: to.Ptr("dependencies/count"), - // }, - // Category: to.Ptr("Server"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Dependency type"), - // Value: to.Ptr("dependency/type"), - // }, - // { - // LocalizedValue: to.Ptr("Dependency performance"), - // Value: to.Ptr("dependency/performanceBucket"), - // }, - // { - // LocalizedValue: to.Ptr("Successful call"), - // Value: to.Ptr("dependency/success"), - // }, - // { - // LocalizedValue: to.Ptr("Target of a dependency call"), - // Value: to.Ptr("dependency/target"), - // }, - // { - // LocalizedValue: to.Ptr("Result code"), - // Value: to.Ptr("dependency/resultCode"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Count of calls made by the application to external resources."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/dependencies/count"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Dependency duration"), - // Value: to.Ptr("dependencies/duration"), - // }, - // Category: to.Ptr("Server"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Dependency type"), - // Value: to.Ptr("dependency/type"), - // }, - // { - // LocalizedValue: to.Ptr("Dependency performance"), - // Value: to.Ptr("dependency/performanceBucket"), - // }, - // { - // LocalizedValue: to.Ptr("Successful call"), - // Value: to.Ptr("dependency/success"), - // }, - // { - // LocalizedValue: to.Ptr("Target of a dependency call"), - // Value: to.Ptr("dependency/target"), - // }, - // { - // LocalizedValue: to.Ptr("Result code"), - // Value: to.Ptr("dependency/resultCode"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Duration of calls made by the application to external resources."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/dependencies/duration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Dependency call failures"), - // Value: to.Ptr("dependencies/failed"), - // }, - // Category: to.Ptr("Failures"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Dependency type"), - // Value: to.Ptr("dependency/type"), - // }, - // { - // LocalizedValue: to.Ptr("Dependency performance"), - // Value: to.Ptr("dependency/performanceBucket"), - // }, - // { - // LocalizedValue: to.Ptr("Target of a dependency call"), - // Value: to.Ptr("dependency/target"), - // }, - // { - // LocalizedValue: to.Ptr("Result code"), - // Value: to.Ptr("dependency/resultCode"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Count of failed dependency calls made by the application to external resources."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/dependencies/failed"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Page views"), - // Value: to.Ptr("pageViews/count"), - // }, - // Category: to.Ptr("Usage"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Count of page views."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/pageViews/count"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Page view load time"), - // Value: to.Ptr("pageViews/duration"), - // }, - // Category: to.Ptr("Usage"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Page view load time"), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/pageViews/duration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("HTTP request execution time"), - // Value: to.Ptr("performanceCounters/requestExecutionTime"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Execution time of the most recent request."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/requestExecutionTime"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("HTTP requests in application queue"), - // Value: to.Ptr("performanceCounters/requestsInQueue"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Length of the application request queue."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/requestsInQueue"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("HTTP request rate"), - // Value: to.Ptr("performanceCounters/requestsPerSecond"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Rate of all requests to the application per second from ASP.NET."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/requestsPerSecond"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Exception rate"), - // Value: to.Ptr("performanceCounters/exceptionsPerSecond"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Count of handled and unhandled exceptions reported to windows, including .NET exceptions and unmanaged exceptions that are converted into .NET exceptions."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/exceptionsPerSecond"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Process IO rate"), - // Value: to.Ptr("performanceCounters/processIOBytesPerSecond"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Total bytes per second read and written to files, network and devices."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/processIOBytesPerSecond"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Process CPU"), - // Value: to.Ptr("performanceCounters/processCpuPercentage"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("The percentage of elapsed time that all process threads used the processor to execute instructions. This can vary between 0 to 100. This metric indicates the performance of w3wp process alone."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/processCpuPercentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Processor time"), - // Value: to.Ptr("performanceCounters/processorCpuPercentage"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("The percentage of time that the processor spends in non-idle threads."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/processorCpuPercentage"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitPercent), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Available memory"), - // Value: to.Ptr("performanceCounters/memoryAvailableBytes"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Physical memory immediately available for allocation to a process or for system use."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/memoryAvailableBytes"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Process private bytes"), - // Value: to.Ptr("performanceCounters/processPrivateBytes"), - // }, - // Category: to.Ptr("Performance counters"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Memory exclusively assigned to the monitored application's processes."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/performanceCounters/processPrivateBytes"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Server response time"), - // Value: to.Ptr("requests/duration"), - // }, - // Category: to.Ptr("Server"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Request performance"), - // Value: to.Ptr("request/performanceBucket"), - // }, - // { - // LocalizedValue: to.Ptr("Result code"), - // Value: to.Ptr("request/resultCode"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Successful request"), - // Value: to.Ptr("request/success"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Time between receiving an HTTP request and finishing sending the response."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/requests/duration"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeMinimum)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Server requests"), - // Value: to.Ptr("requests/count"), - // }, - // Category: to.Ptr("Server"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Request performance"), - // Value: to.Ptr("request/performanceBucket"), - // }, - // { - // LocalizedValue: to.Ptr("Result code"), - // Value: to.Ptr("request/resultCode"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Successful request"), - // Value: to.Ptr("request/success"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Count of HTTP requests completed."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/requests/count"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Failed requests"), - // Value: to.Ptr("requests/failed"), - // }, - // Category: to.Ptr("Failures"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Request performance"), - // Value: to.Ptr("request/performanceBucket"), - // }, - // { - // LocalizedValue: to.Ptr("Result code"), - // Value: to.Ptr("request/resultCode"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Count of HTTP requests marked as failed. In most cases these are requests with a response code >= 400 and not equal to 401."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/requests/failed"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Server request rate"), - // Value: to.Ptr("requests/rate"), - // }, - // Category: to.Ptr("Server"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Request performance"), - // Value: to.Ptr("request/performanceBucket"), - // }, - // { - // LocalizedValue: to.Ptr("Result code"), - // Value: to.Ptr("request/resultCode"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Successful request"), - // Value: to.Ptr("request/success"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Rate of server requests per second"), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/requests/rate"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Exceptions"), - // Value: to.Ptr("exceptions/count"), - // }, - // Category: to.Ptr("Failures"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }, - // { - // LocalizedValue: to.Ptr("Device type"), - // Value: to.Ptr("client/type"), - // }}, - // DisplayDescription: to.Ptr("Combined count of all uncaught exceptions."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/exceptions/count"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Browser exceptions"), - // Value: to.Ptr("exceptions/browser"), - // }, - // Category: to.Ptr("Failures"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }}, - // DisplayDescription: to.Ptr("Count of uncaught exceptions thrown in the browser."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/exceptions/browser"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Server exceptions"), - // Value: to.Ptr("exceptions/server"), - // }, - // Category: to.Ptr("Failures"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Count of uncaught exceptions thrown in the server application."), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/exceptions/server"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Traces"), - // Value: to.Ptr("traces/count"), - // }, - // Category: to.Ptr("Usage"), - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Severity level"), - // Value: to.Ptr("trace/severityLevel"), - // }, - // { - // LocalizedValue: to.Ptr("Is traffic synthetic"), - // Value: to.Ptr("operation/synthetic"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role name"), - // Value: to.Ptr("cloud/roleName"), - // }, - // { - // LocalizedValue: to.Ptr("Cloud role instance"), - // Value: to.Ptr("cloud/roleInstance"), - // }}, - // DisplayDescription: to.Ptr("Trace document count"), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions/traces/count"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("microsoft.insights/components"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeCount), - // ResourceID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMetricDefinitions.json -func ExampleMetricDefinitionsClient_NewListPager_getMetricDefinitionsWithoutFilter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMetricDefinitionsClient().NewListPager("subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricDefinitions", &armmonitor.MetricDefinitionsClientListOptions{Metricnamespace: to.Ptr("Microsoft.Web/sites")}) - 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.MetricDefinitionCollection = armmonitor.MetricDefinitionCollection{ - // Value: []*armmonitor.MetricDefinition{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("CPU Time"), - // Value: to.Ptr("CpuTime"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/CpuTime"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Requests"), - // Value: to.Ptr("Requests"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Requests"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data In"), - // Value: to.Ptr("BytesReceived"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/BytesReceived"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Out"), - // Value: to.Ptr("BytesSent"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/BytesSent"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 101"), - // Value: to.Ptr("Http101"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http101"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 2xx"), - // Value: to.Ptr("Http2xx"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http2xx"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 3xx"), - // Value: to.Ptr("Http3xx"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http3xx"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 401"), - // Value: to.Ptr("Http401"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http401"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 403"), - // Value: to.Ptr("Http403"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http403"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 404"), - // Value: to.Ptr("Http404"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http404"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 406"), - // Value: to.Ptr("Http406"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http406"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http 4xx"), - // Value: to.Ptr("Http4xx"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http4xx"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Http Server Errors"), - // Value: to.Ptr("Http5xx"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/Http5xx"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeTotal), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Memory working set"), - // Value: to.Ptr("MemoryWorkingSet"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/MemoryWorkingSet"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Average memory working set"), - // Value: to.Ptr("AverageMemoryWorkingSet"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/AverageMemoryWorkingSet"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytes), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Average Response Time"), - // Value: to.Ptr("AverageResponseTime"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("Instance"), - // Value: to.Ptr("Instance"), - // }}, - // ID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricdefinitions/AverageResponseTime"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // Namespace: to.Ptr("Microsoft.Web/sites"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeNone), - // to.Ptr(armmonitor.AggregationTypeAverage), - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeTotal), - // to.Ptr(armmonitor.AggregationTypeCount)}, - // Unit: to.Ptr(armmonitor.MetricUnitSeconds), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMetricDefinitionsMetricClass.json -func ExampleMetricDefinitionsClient_NewListPager_getStorageCacheMetricDefinitionsWithMetricClass() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMetricDefinitionsClient().NewListPager("subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache", &armmonitor.MetricDefinitionsClientListOptions{Metricnamespace: to.Ptr("microsoft.storagecache/caches")}) - 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.MetricDefinitionCollection = armmonitor.MetricDefinitionCollection{ - // Value: []*armmonitor.MetricDefinition{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Total Client IOPS"), - // Value: to.Ptr("ClientIOPS"), - // }, - // DisplayDescription: to.Ptr("The rate of client file operations processed by the Cache."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Average Client Latency"), - // Value: to.Ptr("ClientLatency"), - // }, - // DisplayDescription: to.Ptr("Average latency of client file operations to the Cache."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientLatency"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassLatency), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Client Read IOPS"), - // Value: to.Ptr("ClientReadIOPS"), - // }, - // DisplayDescription: to.Ptr("Client read operations per second."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientReadIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Average Cache Read Throughput"), - // Value: to.Ptr("ClientReadThroughput"), - // }, - // DisplayDescription: to.Ptr("Client read data transfer rate."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientReadThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Client Write IOPS"), - // Value: to.Ptr("ClientWriteIOPS"), - // }, - // DisplayDescription: to.Ptr("Client write operations per second."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientWriteIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Average Cache Write Throughput"), - // Value: to.Ptr("ClientWriteThroughput"), - // }, - // DisplayDescription: to.Ptr("Client write data transfer rate."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientWriteThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Client Metadata Read IOPS"), - // Value: to.Ptr("ClientMetadataReadIOPS"), - // }, - // DisplayDescription: to.Ptr("The rate of client file operations sent to the Cache, excluding data reads, that do not modify persistent state."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientMetadataReadIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Client Metadata Write IOPS"), - // Value: to.Ptr("ClientMetadataWriteIOPS"), - // }, - // DisplayDescription: to.Ptr("The rate of client file operations sent to the Cache, excluding data writes, that modify persistent state."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientMetadataWriteIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Client Lock IOPS"), - // Value: to.Ptr("ClientLockIOPS"), - // }, - // DisplayDescription: to.Ptr("Client file locking operations per second."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/ClientLockIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Storage Target Health"), - // Value: to.Ptr("StorageTargetHealth"), - // }, - // DisplayDescription: to.Ptr("Boolean results of connectivity test between the Cache and Storage Targets."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetHealth"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassErrors), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Uptime"), - // Value: to.Ptr("Uptime"), - // }, - // DisplayDescription: to.Ptr("Boolean results of connectivity test between the Cache and monitoring system."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/Uptime"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassAvailability), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Total StorageTarget IOPS"), - // Value: to.Ptr("StorageTargetIOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate of all file operations the Cache sends to a particular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Write IOPS"), - // Value: to.Ptr("StorageTargetWriteIOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate of the file write operations the Cache sends to a particular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetWriteIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Asynchronous Write Throughput"), - // Value: to.Ptr("StorageTargetAsyncWriteThroughput"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate the Cache asynchronously writes data to a particular StorageTarget. These are opportunistic writes that do not cause clients to block."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetAsyncWriteThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Synchronous Write Throughput"), - // Value: to.Ptr("StorageTargetSyncWriteThroughput"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate the Cache synchronously writes data to a particular StorageTarget. These are writes that do cause clients to block."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetSyncWriteThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Total Write Throughput"), - // Value: to.Ptr("StorageTargetTotalWriteThroughput"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The total rate that the Cache writes data to a particular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetTotalWriteThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Latency"), - // Value: to.Ptr("StorageTargetLatency"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The average round trip latency of all the file operations the Cache sends to a partricular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetLatency"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitMilliSeconds), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Metadata Read IOPS"), - // Value: to.Ptr("StorageTargetMetadataReadIOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate of file operations that do not modify persistent state, and excluding the read operation, that the Cache sends to a particular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetMetadataReadIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Metadata Write IOPS"), - // Value: to.Ptr("StorageTargetMetadataWriteIOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate of file operations that do modify persistent state and excluding the write operation, that the Cache sends to a particular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetMetadataWriteIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Read IOPS"), - // Value: to.Ptr("StorageTargetReadIOPS"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate of file read operations the Cache sends to a particular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetReadIOPS"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Read Ahead Throughput"), - // Value: to.Ptr("StorageTargetReadAheadThroughput"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate the Cache opportunisticly reads data from the StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetReadAheadThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Fill Throughput"), - // Value: to.Ptr("StorageTargetFillThroughput"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The rate the Cache reads data from the StorageTarget to handle a cache miss."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetFillThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("StorageTarget Total Read Throughput"), - // Value: to.Ptr("StorageTargetTotalReadThroughput"), - // }, - // Dimensions: []*armmonitor.LocalizableString{ - // { - // LocalizedValue: to.Ptr("StorageTarget"), - // Value: to.Ptr("StorageTarget"), - // }}, - // DisplayDescription: to.Ptr("The total rate that the Cache reads data from a particular StorageTarget."), - // ID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache/providers/microsoft.insights/metricdefinitions/StorageTargetTotalReadThroughput"), - // IsDimensionRequired: to.Ptr(false), - // MetricAvailabilities: []*armmonitor.MetricAvailability{ - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT5M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT15M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT30M"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT1H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT6H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("PT12H"), - // }, - // { - // Retention: to.Ptr("P93D"), - // TimeGrain: to.Ptr("P1D"), - // }}, - // MetricClass: to.Ptr(armmonitor.MetricClassTransactions), - // Namespace: to.Ptr("microsoft.storagecache/caches"), - // PrimaryAggregationType: to.Ptr(armmonitor.AggregationTypeAverage), - // ResourceID: to.Ptr("/subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache"), - // SupportedAggregationTypes: []*armmonitor.AggregationType{ - // to.Ptr(armmonitor.AggregationTypeMinimum), - // to.Ptr(armmonitor.AggregationTypeMaximum), - // to.Ptr(armmonitor.AggregationTypeAverage)}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client.go b/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client.go deleted file mode 100644 index 2912562457a6..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client.go +++ /dev/null @@ -1,96 +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 armmonitor - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "strings" -) - -// MetricNamespacesClient contains the methods for the MetricNamespaces group. -// Don't use this type directly, use NewMetricNamespacesClient() instead. -type MetricNamespacesClient struct { - internal *arm.Client -} - -// NewMetricNamespacesClient creates a new instance of MetricNamespacesClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewMetricNamespacesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*MetricNamespacesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &MetricNamespacesClient{ - internal: cl, - } - return client, nil -} - -// NewListPager - Lists the metric namespaces for the resource. -// -// Generated from API version 2017-12-01-preview -// - resourceURI - The identifier of the resource. -// - options - MetricNamespacesClientListOptions contains the optional parameters for the MetricNamespacesClient.NewListPager -// method. -func (client *MetricNamespacesClient) NewListPager(resourceURI string, options *MetricNamespacesClientListOptions) *runtime.Pager[MetricNamespacesClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[MetricNamespacesClientListResponse]{ - More: func(page MetricNamespacesClientListResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *MetricNamespacesClientListResponse) (MetricNamespacesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MetricNamespacesClient.NewListPager") - req, err := client.listCreateRequest(ctx, resourceURI, options) - if err != nil { - return MetricNamespacesClientListResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MetricNamespacesClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MetricNamespacesClientListResponse{}, runtime.NewResponseError(resp) - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *MetricNamespacesClient) listCreateRequest(ctx context.Context, resourceURI string, options *MetricNamespacesClientListOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/microsoft.insights/metricNamespaces" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2017-12-01-preview") - if options != nil && options.StartTime != nil { - reqQP.Set("startTime", *options.StartTime) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *MetricNamespacesClient) listHandleResponse(resp *http.Response) (MetricNamespacesClientListResponse, error) { - result := MetricNamespacesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.MetricNamespaceCollection); err != nil { - return MetricNamespacesClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client_example_test.go deleted file mode 100644 index 0ef141700996..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metricnamespaces_client_example_test.go +++ /dev/null @@ -1,65 +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 armmonitor_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/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2017-12-01-preview/examples/GetMetricNamespaces.json -func ExampleMetricNamespacesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewMetricNamespacesClient().NewListPager("subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill", &armmonitor.MetricNamespacesClientListOptions{StartTime: to.Ptr("2020-08-31T15:53:00Z")}) - 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.MetricNamespaceCollection = armmonitor.MetricNamespaceCollection{ - // Value: []*armmonitor.MetricNamespace{ - // { - // Name: to.Ptr("Azure.ApplicationInsights"), - // Type: to.Ptr("Microsoft.Insights/metricNamespaces"), - // Classification: to.Ptr(armmonitor.NamespaceClassificationCustom), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricNamespaces/Azure.ApplicationInsights"), - // Properties: &armmonitor.MetricNamespaceName{ - // MetricNamespaceName: to.Ptr("Azure.ApplicationInsights"), - // }, - // }, - // { - // Name: to.Ptr("microsoft.insights-components"), - // Type: to.Ptr("Microsoft.Insights/metricNamespaces"), - // Classification: to.Ptr(armmonitor.NamespaceClassificationPlatform), - // ID: to.Ptr("/subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricNamespaces/microsoft.insights-components"), - // Properties: &armmonitor.MetricNamespaceName{ - // MetricNamespaceName: to.Ptr("microsoft.insights/components"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metrics_client.go b/sdk/resourcemanager/monitor/armmonitor/metrics_client.go deleted file mode 100644 index 97219fc6364d..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metrics_client.go +++ /dev/null @@ -1,317 +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 armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strconv" - "strings" -) - -// MetricsClient contains the methods for the Metrics group. -// Don't use this type directly, use NewMetricsClient() instead. -type MetricsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewMetricsClient creates a new instance of MetricsClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewMetricsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MetricsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &MetricsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// List - Lists the metric values for a resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-05-01 -// - resourceURI - The identifier of the resource. -// - options - MetricsClientListOptions contains the optional parameters for the MetricsClient.List method. -func (client *MetricsClient) List(ctx context.Context, resourceURI string, options *MetricsClientListOptions) (MetricsClientListResponse, error) { - var err error - const operationName = "MetricsClient.List" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listCreateRequest(ctx, resourceURI, options) - if err != nil { - return MetricsClientListResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MetricsClientListResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return MetricsClientListResponse{}, err - } - resp, err := client.listHandleResponse(httpResp) - return resp, err -} - -// listCreateRequest creates the List request. -func (client *MetricsClient) listCreateRequest(ctx context.Context, resourceURI string, options *MetricsClientListOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.Insights/metrics" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - if options != nil && options.Timespan != nil { - reqQP.Set("timespan", *options.Timespan) - } - if options != nil && options.Interval != nil { - reqQP.Set("interval", *options.Interval) - } - if options != nil && options.Metricnames != nil { - reqQP.Set("metricnames", *options.Metricnames) - } - if options != nil && options.Aggregation != nil { - reqQP.Set("aggregation", *options.Aggregation) - } - if options != nil && options.Top != nil { - reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) - } - if options != nil && options.Orderby != nil { - reqQP.Set("orderby", *options.Orderby) - } - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.ResultType != nil { - reqQP.Set("resultType", string(*options.ResultType)) - } - reqQP.Set("api-version", "2021-05-01") - if options != nil && options.Metricnamespace != nil { - reqQP.Set("metricnamespace", *options.Metricnamespace) - } - if options != nil && options.AutoAdjustTimegrain != nil { - reqQP.Set("AutoAdjustTimegrain", strconv.FormatBool(*options.AutoAdjustTimegrain)) - } - if options != nil && options.ValidateDimensions != nil { - reqQP.Set("ValidateDimensions", strconv.FormatBool(*options.ValidateDimensions)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *MetricsClient) listHandleResponse(resp *http.Response) (MetricsClientListResponse, error) { - result := MetricsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Response); err != nil { - return MetricsClientListResponse{}, err - } - return result, nil -} - -// ListAtSubscriptionScope - Lists the metric data for a subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-05-01 -// - region - The region where the metrics you want reside. -// - options - MetricsClientListAtSubscriptionScopeOptions contains the optional parameters for the MetricsClient.ListAtSubscriptionScope -// method. -func (client *MetricsClient) ListAtSubscriptionScope(ctx context.Context, region string, options *MetricsClientListAtSubscriptionScopeOptions) (MetricsClientListAtSubscriptionScopeResponse, error) { - var err error - const operationName = "MetricsClient.ListAtSubscriptionScope" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listAtSubscriptionScopeCreateRequest(ctx, region, options) - if err != nil { - return MetricsClientListAtSubscriptionScopeResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MetricsClientListAtSubscriptionScopeResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return MetricsClientListAtSubscriptionScopeResponse{}, err - } - resp, err := client.listAtSubscriptionScopeHandleResponse(httpResp) - return resp, err -} - -// listAtSubscriptionScopeCreateRequest creates the ListAtSubscriptionScope request. -func (client *MetricsClient) listAtSubscriptionScopeCreateRequest(ctx context.Context, region string, options *MetricsClientListAtSubscriptionScopeOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metrics" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") - reqQP.Set("region", region) - if options != nil && options.Timespan != nil { - reqQP.Set("timespan", *options.Timespan) - } - if options != nil && options.Interval != nil { - reqQP.Set("interval", *options.Interval) - } - if options != nil && options.Metricnames != nil { - reqQP.Set("metricnames", *options.Metricnames) - } - if options != nil && options.Aggregation != nil { - reqQP.Set("aggregation", *options.Aggregation) - } - if options != nil && options.Top != nil { - reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) - } - if options != nil && options.Orderby != nil { - reqQP.Set("orderby", *options.Orderby) - } - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.ResultType != nil { - reqQP.Set("resultType", string(*options.ResultType)) - } - if options != nil && options.Metricnamespace != nil { - reqQP.Set("metricnamespace", *options.Metricnamespace) - } - if options != nil && options.AutoAdjustTimegrain != nil { - reqQP.Set("AutoAdjustTimegrain", strconv.FormatBool(*options.AutoAdjustTimegrain)) - } - if options != nil && options.ValidateDimensions != nil { - reqQP.Set("ValidateDimensions", strconv.FormatBool(*options.ValidateDimensions)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listAtSubscriptionScopeHandleResponse handles the ListAtSubscriptionScope response. -func (client *MetricsClient) listAtSubscriptionScopeHandleResponse(resp *http.Response) (MetricsClientListAtSubscriptionScopeResponse, error) { - result := MetricsClientListAtSubscriptionScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionScopeMetricResponse); err != nil { - return MetricsClientListAtSubscriptionScopeResponse{}, err - } - return result, nil -} - -// ListAtSubscriptionScopePost - Lists the metric data for a subscription. Parameters can be specified on either query params -// or the body. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-05-01 -// - region - The region where the metrics you want reside. -// - options - MetricsClientListAtSubscriptionScopePostOptions contains the optional parameters for the MetricsClient.ListAtSubscriptionScopePost -// method. -func (client *MetricsClient) ListAtSubscriptionScopePost(ctx context.Context, region string, options *MetricsClientListAtSubscriptionScopePostOptions) (MetricsClientListAtSubscriptionScopePostResponse, error) { - var err error - const operationName = "MetricsClient.ListAtSubscriptionScopePost" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listAtSubscriptionScopePostCreateRequest(ctx, region, options) - if err != nil { - return MetricsClientListAtSubscriptionScopePostResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return MetricsClientListAtSubscriptionScopePostResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return MetricsClientListAtSubscriptionScopePostResponse{}, err - } - resp, err := client.listAtSubscriptionScopePostHandleResponse(httpResp) - return resp, err -} - -// listAtSubscriptionScopePostCreateRequest creates the ListAtSubscriptionScopePost request. -func (client *MetricsClient) listAtSubscriptionScopePostCreateRequest(ctx context.Context, region string, options *MetricsClientListAtSubscriptionScopePostOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metrics" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01") - reqQP.Set("region", region) - if options != nil && options.Timespan != nil { - reqQP.Set("timespan", *options.Timespan) - } - if options != nil && options.Interval != nil { - reqQP.Set("interval", *options.Interval) - } - if options != nil && options.Metricnames != nil { - reqQP.Set("metricnames", *options.Metricnames) - } - if options != nil && options.Aggregation != nil { - reqQP.Set("aggregation", *options.Aggregation) - } - if options != nil && options.Top != nil { - reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) - } - if options != nil && options.Orderby != nil { - reqQP.Set("orderby", *options.Orderby) - } - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.ResultType != nil { - reqQP.Set("resultType", string(*options.ResultType)) - } - if options != nil && options.Metricnamespace != nil { - reqQP.Set("metricnamespace", *options.Metricnamespace) - } - if options != nil && options.AutoAdjustTimegrain != nil { - reqQP.Set("AutoAdjustTimegrain", strconv.FormatBool(*options.AutoAdjustTimegrain)) - } - if options != nil && options.ValidateDimensions != nil { - reqQP.Set("ValidateDimensions", strconv.FormatBool(*options.ValidateDimensions)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Body != nil { - if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// listAtSubscriptionScopePostHandleResponse handles the ListAtSubscriptionScopePost response. -func (client *MetricsClient) listAtSubscriptionScopePostHandleResponse(resp *http.Response) (MetricsClientListAtSubscriptionScopePostResponse, error) { - result := MetricsClientListAtSubscriptionScopePostResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionScopeMetricResponse); err != nil { - return MetricsClientListAtSubscriptionScopePostResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/metrics_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/metrics_client_example_test.go deleted file mode 100644 index fc968d5cc26c..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/metrics_client_example_test.go +++ /dev/null @@ -1,1480 +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 armmonitor_test - -import ( - "context" - "log" - - "time" - - "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/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMultiResourceMetric.json -func ExampleMetricsClient_ListAtSubscriptionScope_getSubscriptionLevelMetricData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricsClient().ListAtSubscriptionScope(ctx, "westus2", &armmonitor.MetricsClientListAtSubscriptionScopeOptions{Timespan: to.Ptr("2021-06-08T19:00:00Z/2021-06-12T01:00:00Z"), - Interval: to.Ptr("PT6H"), - Metricnames: to.Ptr("Data Disk Max Burst IOPS"), - Aggregation: to.Ptr("count"), - Top: to.Ptr[int32](10), - Orderby: to.Ptr("count desc"), - Filter: to.Ptr("LUN eq '0' and Microsoft.ResourceId eq '*'"), - ResultType: nil, - Metricnamespace: to.Ptr("microsoft.compute/virtualmachines"), - AutoAdjustTimegrain: to.Ptr(true), - ValidateDimensions: to.Ptr(false), - }) - 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.SubscriptionScopeMetricResponse = armmonitor.SubscriptionScopeMetricResponse{ - // Cost: to.Ptr[int32](4679), - // Interval: to.Ptr("PT6H"), - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // Resourceregion: to.Ptr("westus2"), - // Timespan: to.Ptr("2021-06-08T19:00:00Z/2021-06-12T01:00:00Z"), - // Value: []*armmonitor.SubscriptionScopeMetric{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Max Burst IOPS"), - // Value: to.Ptr("Data Disk Max Burst IOPS"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // DisplayDescription: to.Ptr("Maximum IOPS Data Disk can achieve with bursting"), - // ErrorCode: to.Ptr("Success"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/Microsoft.Insights/metrics/Data Disk Max Burst IOPS"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](413), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.resourceid"), - // Value: to.Ptr("microsoft.resourceid"), - // }, - // Value: to.Ptr("/subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/resourceGroups/sas1/providers/Microsoft.Compute/virtualMachines/sas1-dev"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](133), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.resourceid"), - // Value: to.Ptr("microsoft.resourceid"), - // }, - // Value: to.Ptr("/subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/resourceGroups/sas2/providers/Microsoft.Compute/virtualMachines/sas2-vm"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](78), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.resourceid"), - // Value: to.Ptr("microsoft.resourceid"), - // }, - // Value: to.Ptr("/subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/resourceGroups/sas3/providers/Microsoft.Compute/virtualMachines/sas3-vm"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.resourceid"), - // Value: to.Ptr("microsoft.resourceid"), - // }, - // Value: to.Ptr("/subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/resourceGroups/sas4/providers/Microsoft.Compute/virtualMachines/sas4-vm"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.resourceid"), - // Value: to.Ptr("microsoft.resourceid"), - // }, - // Value: to.Ptr("/subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/resourceGroups/sas5/providers/Microsoft.Compute/virtualMachines/sas5-vm-asc"), - // }}, - // }}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMultiResourceMetricMetadata.json -func ExampleMetricsClient_ListAtSubscriptionScope_getSubscriptionLevelMetricMetadata() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricsClient().ListAtSubscriptionScope(ctx, "westus2", &armmonitor.MetricsClientListAtSubscriptionScopeOptions{Timespan: to.Ptr("2021-06-10T02:23:16.129Z/2021-06-12T02:23:16.129Z"), - Interval: nil, - Metricnames: to.Ptr("Data Disk Max Burst IOPS"), - Aggregation: nil, - Top: nil, - Orderby: nil, - Filter: to.Ptr("LUN eq '0'"), - ResultType: nil, - Metricnamespace: to.Ptr("microsoft.compute/virtualmachines"), - AutoAdjustTimegrain: nil, - ValidateDimensions: 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.SubscriptionScopeMetricResponse = armmonitor.SubscriptionScopeMetricResponse{ - // Interval: to.Ptr("PT1M"), - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // Resourceregion: to.Ptr("westus2"), - // Timespan: to.Ptr("2021-06-10T02:23:16Z/2021-06-12T02:23:16Z"), - // Value: []*armmonitor.SubscriptionScopeMetric{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Read Bytes/Sec"), - // Value: to.Ptr("Data Disk Read Bytes/sec"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // DisplayDescription: to.Ptr("Bytes/Sec read from a single disk during monitoring period"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/Microsoft.Insights/metrics/Data Disk Read Bytes/sec"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // { - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("lun"), - // Value: to.Ptr("lun"), - // }, - // Value: to.Ptr("0"), - // }}, - // }, - // { - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("lun"), - // Value: to.Ptr("lun"), - // }, - // Value: to.Ptr("1"), - // }}, - // }}, - // Unit: to.Ptr(armmonitor.MetricUnitBytesPerSecond), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/PostMultiResourceMetricBody.json -func ExampleMetricsClient_ListAtSubscriptionScopePost_postRequestForSubscriptionLevelMetricDataUsingBodyParams() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricsClient().ListAtSubscriptionScopePost(ctx, "westus2", &armmonitor.MetricsClientListAtSubscriptionScopePostOptions{Timespan: nil, - Interval: nil, - Metricnames: nil, - Aggregation: nil, - Top: nil, - Orderby: nil, - Filter: nil, - ResultType: nil, - Metricnamespace: nil, - AutoAdjustTimegrain: nil, - ValidateDimensions: nil, - Body: &armmonitor.SubscriptionScopeMetricsRequestBodyParameters{ - Aggregation: to.Ptr("count"), - AutoAdjustTimegrain: to.Ptr(true), - Filter: to.Ptr("LUN eq '0' and Microsoft.ResourceId eq '*'"), - Interval: to.Ptr("PT6H"), - MetricNames: to.Ptr("Data Disk Max Burst IOPS"), - MetricNamespace: to.Ptr("microsoft.compute/virtualmachines"), - OrderBy: to.Ptr("count desc"), - RollUpBy: to.Ptr("LUN"), - Timespan: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "NaN-NaN-NaNTNaN:NaN:NaN.NaNZ"); return t }()), - Top: to.Ptr[int32](10), - ValidateDimensions: to.Ptr(false), - }, - }) - 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.SubscriptionScopeMetricResponse = armmonitor.SubscriptionScopeMetricResponse{ - // Cost: to.Ptr[int32](4679), - // Interval: to.Ptr("PT6H"), - // Namespace: to.Ptr("microsoft.compute/virtualmachines"), - // Resourceregion: to.Ptr("westus2"), - // Timespan: to.Ptr("2021-06-08T19:00:00Z/2021-06-12T01:00:00Z"), - // Value: []*armmonitor.SubscriptionScopeMetric{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Data Disk Max Burst IOPS"), - // Value: to.Ptr("Data Disk Max Burst IOPS"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // DisplayDescription: to.Ptr("Maximum IOPS Data Disk can achieve with bursting"), - // ErrorCode: to.Ptr("Success"), - // ID: to.Ptr("subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/providers/Microsoft.Insights/metrics/Data Disk Max Burst IOPS"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](413), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.resourceid"), - // Value: to.Ptr("microsoft.resourceid"), - // }, - // Value: to.Ptr("/subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/resourceGroups/sas1/providers/Microsoft.Compute/virtualMachines/sas1-dev"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](133), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.resourceid"), - // Value: to.Ptr("microsoft.resourceid"), - // }, - // Value: to.Ptr("/subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/resourceGroups/sas2/providers/Microsoft.Compute/virtualMachines/sas2-vm"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](78), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.resourceid"), - // Value: to.Ptr("microsoft.resourceid"), - // }, - // Value: to.Ptr("/subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/resourceGroups/sas3/providers/Microsoft.Compute/virtualMachines/sas3-vm"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.resourceid"), - // Value: to.Ptr("microsoft.resourceid"), - // }, - // Value: to.Ptr("/subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/resourceGroups/sas4/providers/Microsoft.Compute/virtualMachines/sas4-vm"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-08T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-09T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-10T19:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T01:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T07:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T13:00:00.000Z"); return t}()), - // }, - // { - // Count: to.Ptr[float64](72), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-11T19:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.resourceid"), - // Value: to.Ptr("microsoft.resourceid"), - // }, - // Value: to.Ptr("/subscriptions/92d2a2d8-b514-432d-8cc9-a5f9272630d5/resourceGroups/sas5/providers/Microsoft.Compute/virtualMachines/sas5-vm-asc"), - // }}, - // }}, - // Unit: to.Ptr(armmonitor.MetricUnitCount), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMetric.json -func ExampleMetricsClient_List_getMetricForData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricsClient().List(ctx, "subscriptions/1f3fa6d2-851c-4a91-9087-1a050f3a9c38/resourceGroups/todking/providers/Microsoft.Storage/storageAccounts/tkfileserv/blobServices/default", &armmonitor.MetricsClientListOptions{Timespan: to.Ptr("2021-04-20T09:00:00.000Z/2021-04-20T14:00:00.000Z"), - Interval: to.Ptr("PT6H"), - Metricnames: to.Ptr("BlobCount,BlobCapacity"), - Aggregation: to.Ptr("average,minimum,maximum"), - Top: to.Ptr[int32](5), - Orderby: to.Ptr("average asc"), - Filter: to.Ptr("Tier eq '*'"), - ResultType: nil, - Metricnamespace: to.Ptr("Microsoft.Storage/storageAccounts/blobServices"), - AutoAdjustTimegrain: to.Ptr(true), - ValidateDimensions: to.Ptr(false), - }) - 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.Response = armmonitor.Response{ - // Cost: to.Ptr[int32](598), - // Interval: to.Ptr("PT1H"), - // Namespace: to.Ptr("microsoft.storage/storageaccounts/blobservices"), - // Resourceregion: to.Ptr("westus2"), - // Timespan: to.Ptr("2021-04-20T09:00:00Z/2021-04-20T14:00:00Z"), - // Value: []*armmonitor.Metric{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Blob Count"), - // Value: to.Ptr("BlobCount"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // DisplayDescription: to.Ptr("The number of blob objects stored in the storage account."), - // ErrorCode: to.Ptr("Success"), - // ID: to.Ptr("/subscriptions/1f3fa6d2-851c-4a91-9087-1a050f3a9c38/resourceGroups/todking/providers/Microsoft.Storage/storageAccounts/tkfileserv/blobServices/default/providers/Microsoft.Insights/metrics/BlobCount"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](7), - // Maximum: to.Ptr[float64](7), - // Minimum: to.Ptr[float64](7), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](7), - // Maximum: to.Ptr[float64](7), - // Minimum: to.Ptr[float64](7), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T10:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](7), - // Maximum: to.Ptr[float64](7), - // Minimum: to.Ptr[float64](7), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T11:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](7), - // Maximum: to.Ptr[float64](7), - // Minimum: to.Ptr[float64](7), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T12:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](7), - // Maximum: to.Ptr[float64](7), - // Minimum: to.Ptr[float64](7), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T13:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Hot"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](2), - // Maximum: to.Ptr[float64](2), - // Minimum: to.Ptr[float64](2), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](2), - // Maximum: to.Ptr[float64](2), - // Minimum: to.Ptr[float64](2), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T10:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](2), - // Maximum: to.Ptr[float64](2), - // Minimum: to.Ptr[float64](2), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T11:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](2), - // Maximum: to.Ptr[float64](2), - // Minimum: to.Ptr[float64](2), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T12:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](2), - // Maximum: to.Ptr[float64](2), - // Minimum: to.Ptr[float64](2), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T13:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Standard"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T10:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T11:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T12:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T13:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Cool"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T10:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T11:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T12:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T13:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Archive"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T10:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T11:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T12:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T13:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Untiered"), - // }}, - // }}, - // Unit: to.Ptr(armmonitor.UnitCount), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Blob Capacity"), - // Value: to.Ptr("BlobCapacity"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // DisplayDescription: to.Ptr("The amount of storage used by the storage account’s Blob service in bytes."), - // ErrorCode: to.Ptr("Success"), - // ID: to.Ptr("/subscriptions/1f3fa6d2-851c-4a91-9087-1a050f3a9c38/resourceGroups/todking/providers/Microsoft.Storage/storageAccounts/tkfileserv/blobServices/default/providers/Microsoft.Insights/metrics/BlobCapacity"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](621492), - // Maximum: to.Ptr[float64](621492), - // Minimum: to.Ptr[float64](621492), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](621492), - // Maximum: to.Ptr[float64](621492), - // Minimum: to.Ptr[float64](621492), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T10:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](621492), - // Maximum: to.Ptr[float64](621492), - // Minimum: to.Ptr[float64](621492), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T11:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](621492), - // Maximum: to.Ptr[float64](621492), - // Minimum: to.Ptr[float64](621492), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T12:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](621492), - // Maximum: to.Ptr[float64](621492), - // Minimum: to.Ptr[float64](621492), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T13:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Standard"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](4733), - // Maximum: to.Ptr[float64](4733), - // Minimum: to.Ptr[float64](4733), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](4733), - // Maximum: to.Ptr[float64](4733), - // Minimum: to.Ptr[float64](4733), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T10:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](4733), - // Maximum: to.Ptr[float64](4733), - // Minimum: to.Ptr[float64](4733), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T11:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](4733), - // Maximum: to.Ptr[float64](4733), - // Minimum: to.Ptr[float64](4733), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T12:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](4733), - // Maximum: to.Ptr[float64](4733), - // Minimum: to.Ptr[float64](4733), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T13:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Hot"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T10:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T11:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T12:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T13:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Archive"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T10:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T11:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T12:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T13:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Untiered"), - // }}, - // }, - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T09:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T10:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T11:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T12:00:00.000Z"); return t}()), - // }, - // { - // Average: to.Ptr[float64](0), - // Maximum: to.Ptr[float64](0), - // Minimum: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-20T13:00:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Cool"), - // }}, - // }}, - // Unit: to.Ptr(armmonitor.UnitBytes), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMetricMetadata.json -func ExampleMetricsClient_List_getMetricForMetadata() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricsClient().List(ctx, "subscriptions/1f3fa6d2-851c-4a91-9087-1a050f3a9c38/resourceGroups/todking/providers/Microsoft.Storage/storageAccounts/tkfileserv/blobServices/default", &armmonitor.MetricsClientListOptions{Timespan: to.Ptr("2017-04-14T02:20:00Z/2017-04-14T04:20:00Z"), - Interval: nil, - Metricnames: nil, - Aggregation: nil, - Top: nil, - Orderby: nil, - Filter: to.Ptr("Tier eq '*'"), - ResultType: nil, - Metricnamespace: to.Ptr("Microsoft.Storage/storageAccounts/blobServices"), - AutoAdjustTimegrain: nil, - ValidateDimensions: 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.Response = armmonitor.Response{ - // Interval: to.Ptr("PT1H"), - // Namespace: to.Ptr("microsoft.storage/storageaccounts/blobservices"), - // Resourceregion: to.Ptr("westus2"), - // Timespan: to.Ptr("2021-04-15T02:18:00Z/2021-04-22T02:18:00Z"), - // Value: []*armmonitor.Metric{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Blob Count"), - // Value: to.Ptr("BlobCount"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // DisplayDescription: to.Ptr("The number of blob objects stored in the storage account."), - // ID: to.Ptr("/subscriptions/1f3fa6d2-851c-4a91-9087-1a050f3a9c38/resourceGroups/todking/providers/Microsoft.Storage/storageAccounts/tkfileserv/blobServices/default/providers/Microsoft.Insights/metrics/BlobCount"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // { - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Cool"), - // }}, - // }, - // { - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Archive"), - // }}, - // }, - // { - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Standard"), - // }}, - // }, - // { - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Untiered"), - // }}, - // }, - // { - // Metadatavalues: []*armmonitor.MetadataValue{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("tier"), - // Value: to.Ptr("tier"), - // }, - // Value: to.Ptr("Hot"), - // }}, - // }}, - // Unit: to.Ptr(armmonitor.UnitCount), - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/examples/GetMetricError.json -func ExampleMetricsClient_List_getMetricWithError() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewMetricsClient().List(ctx, "subscriptions/ac41e21f-afd6-4a79-8070-f01eba278f97/resourceGroups/todking/providers/Microsoft.DocumentDb/databaseAccounts/tk-cosmos-mongo", &armmonitor.MetricsClientListOptions{Timespan: to.Ptr("2021-06-07T21:51:00Z/2021-06-08T01:51:00Z"), - Interval: to.Ptr("FULL"), - Metricnames: to.Ptr("MongoRequestsCount,MongoRequests"), - Aggregation: to.Ptr("average"), - Top: nil, - Orderby: nil, - Filter: nil, - ResultType: nil, - Metricnamespace: to.Ptr("microsoft.documentdb/databaseaccounts"), - AutoAdjustTimegrain: to.Ptr(true), - ValidateDimensions: to.Ptr(false), - }) - 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.Response = armmonitor.Response{ - // Cost: to.Ptr[int32](239), - // Interval: to.Ptr("PT4H"), - // Namespace: to.Ptr("microsoft.documentdb/databaseaccounts"), - // Resourceregion: to.Ptr("westus2"), - // Timespan: to.Ptr("2021-06-07T21:51:00Z/2021-06-08T01:51:00Z"), - // Value: []*armmonitor.Metric{ - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("(deprecated) Mongo Request Rate"), - // Value: to.Ptr("MongoRequestsCount"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // ErrorCode: to.Ptr("InvalidSamplingType"), - // ErrorMessage: to.Ptr("Sampling type is not found. Metric:CosmosDBCustomer,AzureMonitor,MongoRequests, SamplingType:NullableAverage."), - // ID: to.Ptr("/subscriptions/ac41e21f-afd6-4a79-8070-f01eba278f97/resourceGroups/todking/providers/Microsoft.DocumentDb/databaseAccounts/tk-cosmos-mongo/providers/Microsoft.Insights/metrics/MongoRequestsCount"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // }, - // Unit: to.Ptr(armmonitor.UnitCountPerSecond), - // }, - // { - // Name: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Mongo Requests"), - // Value: to.Ptr("MongoRequests"), - // }, - // Type: to.Ptr("Microsoft.Insights/metrics"), - // DisplayDescription: to.Ptr("Number of Mongo Requests Made"), - // ErrorCode: to.Ptr("Success"), - // ID: to.Ptr("/subscriptions/ac41e21f-afd6-4a79-8070-f01eba278f97/resourceGroups/todking/providers/Microsoft.DocumentDb/databaseAccounts/tk-cosmos-mongo/providers/Microsoft.Insights/metrics/MongoRequests"), - // Timeseries: []*armmonitor.TimeSeriesElement{ - // { - // Data: []*armmonitor.MetricValue{ - // { - // Average: to.Ptr[float64](0), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-07T21:51:00.000Z"); return t}()), - // }}, - // Metadatavalues: []*armmonitor.MetadataValue{ - // }, - // }}, - // Unit: to.Ptr(armmonitor.UnitCount), - // }}, - // } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/models.go b/sdk/resourcemanager/monitor/armmonitor/models.go index 5857358098d6..eca8948595fe 100644 --- a/sdk/resourcemanager/monitor/armmonitor/models.go +++ b/sdk/resourcemanager/monitor/armmonitor/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. @@ -10,37 +7,6 @@ package armmonitor import "time" -// AccessModeSettings - Properties that define the scope private link mode settings. -type AccessModeSettings struct { - // REQUIRED; Specifies the default access mode of ingestion through associated private endpoints in scope. If not specified - // default value is 'Open'. You can override this default setting for a specific private - // endpoint connection by adding an exclusion in the 'exclusions' array. - IngestionAccessMode *AccessMode - - // REQUIRED; Specifies the default access mode of queries through associated private endpoints in scope. If not specified - // default value is 'Open'. You can override this default setting for a specific private - // endpoint connection by adding an exclusion in the 'exclusions' array. - QueryAccessMode *AccessMode - - // List of exclusions that override the default access mode settings for specific private endpoint connections. - Exclusions []*AccessModeSettingsExclusion -} - -// AccessModeSettingsExclusion - Properties that define the scope private link mode settings exclusion item. This setting -// applies to a specific private endpoint connection and overrides the default settings for that private endpoint -// connection. -type AccessModeSettingsExclusion struct { - // Specifies the access mode of ingestion through the specified private endpoint connection in the exclusion. - IngestionAccessMode *AccessMode - - // The private endpoint connection name associated to the private endpoint on which we want to apply the specific access mode - // settings. - PrivateEndpointConnectionName *string - - // Specifies the access mode of queries through the specified private endpoint connection in the exclusion. - QueryAccessMode *AccessMode -} - // ActionDetail - The action detail type ActionDetail struct { // The detail of the friendly error message @@ -90,6 +56,9 @@ type ActionGroup struct { // The list of event hub receivers that are part of this action group. EventHubReceivers []*EventHubReceiver + // The list of incident receivers that are part of this action group. + IncidentReceivers []*IncidentReceiver + // The list of ITSM receivers that are part of this action group. ItsmReceivers []*ItsmReceiver @@ -106,15 +75,6 @@ type ActionGroup struct { WebhookReceivers []*WebhookReceiver } -// ActionGroupAutoGenerated - A pointer to an Azure Action Group. -type ActionGroupAutoGenerated struct { - // REQUIRED; The resource ID of the Action Group. This cannot be null or empty. - ActionGroupID *string - - // the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. - WebhookProperties map[string]*string -} - // ActionGroupList - A list of action groups. type ActionGroupList struct { // Provides the link to retrieve the next set of elements. @@ -130,26 +90,13 @@ type ActionGroupPatch struct { Enabled *bool } -// ActionGroupPatchAutoGenerated - A tenant action group for patch operations. -type ActionGroupPatchAutoGenerated struct { - // Indicates whether this tenant action group is enabled. If a tenant action group is not enabled, then none of its actions - // will be activated. - Enabled *bool -} - // ActionGroupPatchBody - An action group object for the body of patch operations. type ActionGroupPatchBody struct { - // The action group settings for an update operation. - Properties *ActionGroupPatch - - // Resource tags - Tags map[string]*string -} + // Managed service identity (system assigned and/or user assigned identities) + Identity *ManagedServiceIdentity -// ActionGroupPatchBodyAutoGenerated - A tenant action group object for the body of patch operations. -type ActionGroupPatchBodyAutoGenerated struct { // The action group settings for an update operation. - Properties *ActionGroupPatchAutoGenerated + Properties *ActionGroupPatch // Resource tags Tags map[string]*string @@ -160,6 +107,9 @@ type ActionGroupResource struct { // REQUIRED; Resource location Location *string + // Managed service identity (system assigned and/or user assigned identities) + Identity *ManagedServiceIdentity + // The action groups properties of the resource. Properties *ActionGroup @@ -176,198 +126,18 @@ type ActionGroupResource struct { Type *string } -// ActionList - A list of Activity Log Alert rule actions. -type ActionList struct { - // The list of the Action Groups. - ActionGroups []*ActionGroupAutoGenerated -} - // Actions to invoke when the alert fires. type Actions struct { // Action Group resource Ids to invoke when the alert fires. ActionGroups []*string + // The properties of an action properties. + ActionProperties map[string]*string + // The properties of an alert payload. CustomProperties map[string]*string } -// ActivityLogAlertResource - An Activity Log Alert rule resource. -type ActivityLogAlertResource struct { - // The location of the resource. Since Azure Activity Log Alerts is a global service, the location of the rules should always - // be 'global'. - Location *string - - // The Activity Log Alert rule properties of the resource. - Properties *AlertRuleProperties - - // The tags of the resource. - Tags map[string]*string - - // READ-ONLY; The resource Id. - ID *string - - // READ-ONLY; The name of the resource. - Name *string - - // READ-ONLY; The type of the resource. - Type *string -} - -// AlertRule - An alert rule. -type AlertRule struct { - // REQUIRED; the condition that results in the alert rule being activated. - Condition RuleConditionClassification - - // REQUIRED; the flag that indicates whether the alert rule is enabled. - IsEnabled *bool - - // REQUIRED; the name of the alert rule. - Name *string - - // action that is performed when the alert rule becomes active, and when an alert condition is resolved. - Action RuleActionClassification - - // the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions []RuleActionClassification - - // the description of the alert rule that will be included in the alert email. - Description *string - - // the provisioning state. - ProvisioningState *string - - // READ-ONLY; Last time the rule was updated in ISO8601 format. - LastUpdatedTime *time.Time -} - -// AlertRuleAllOfCondition - An Activity Log Alert rule condition that is met when all its member conditions are met. -type AlertRuleAllOfCondition struct { - // REQUIRED; The list of Activity Log Alert rule conditions. - AllOf []*AlertRuleAnyOfOrLeafCondition -} - -// AlertRuleAnyOfOrLeafCondition - An Activity Log Alert rule condition that is met when all its member conditions are met. -// Each condition can be of one of the following types:Important: Each type has its unique subset of properties. -// Properties from different types CANNOT exist in one condition. -// * Leaf Condition - must contain 'field' and either 'equals' or 'containsAny'.Please note, 'anyOf' should not be set in -// a Leaf Condition. -// * AnyOf Condition - must contain only 'anyOf' (which is an array of Leaf Conditions).Please note, 'field', 'equals' and -// 'containsAny' should not be set in an AnyOf Condition. -type AlertRuleAnyOfOrLeafCondition struct { - // An Activity Log Alert rule condition that is met when at least one of its member leaf conditions are met. - AnyOf []*AlertRuleLeafCondition - - // The value of the event's field will be compared to the values in this array (case-insensitive) to determine if the condition - // is met. - ContainsAny []*string - - // The value of the event's field will be compared to this value (case-insensitive) to determine if the condition is met. - Equals *string - - // The name of the Activity Log event's field that this condition will examine. The possible values for this field are (case-insensitive): - // 'resourceId', 'category', 'caller', 'level', 'operationName', - // 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties'. - Field *string -} - -// AlertRuleLeafCondition - An Activity Log Alert rule condition that is met by comparing the field and value of an Activity -// Log event. This condition must contain 'field' and either 'equals' or 'containsAny'. -type AlertRuleLeafCondition struct { - // The value of the event's field will be compared to the values in this array (case-insensitive) to determine if the condition - // is met. - ContainsAny []*string - - // The value of the event's field will be compared to this value (case-insensitive) to determine if the condition is met. - Equals *string - - // The name of the Activity Log event's field that this condition will examine. The possible values for this field are (case-insensitive): - // 'resourceId', 'category', 'caller', 'level', 'operationName', - // 'resourceGroup', 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties'. - Field *string -} - -// AlertRuleList - A list of Activity Log Alert rules. -type AlertRuleList struct { - // Provides the link to retrieve the next set of elements. - NextLink *string - - // The list of Activity Log Alert rules. - Value []*ActivityLogAlertResource -} - -// AlertRulePatchObject - An Activity Log Alert rule object for the body of patch operations. -type AlertRulePatchObject struct { - // The activity log alert settings for an update operation. - Properties *AlertRulePatchProperties - - // The resource tags - Tags map[string]*string -} - -// AlertRulePatchProperties - An Activity Log Alert rule properties for patch operations. -type AlertRulePatchProperties struct { - // Indicates whether this Activity Log Alert rule is enabled. If an Activity Log Alert rule is not enabled, then none of its - // actions will be activated. - Enabled *bool -} - -// AlertRuleProperties - An Azure Activity Log Alert rule. -type AlertRuleProperties struct { - // REQUIRED; The actions that will activate when the condition is met. - Actions *ActionList - - // REQUIRED; The condition that will cause this alert to activate. - Condition *AlertRuleAllOfCondition - - // REQUIRED; A list of resource IDs that will be used as prefixes. The alert will only apply to Activity Log events with resource - // IDs that fall under one of these prefixes. This list must include at least one - // item. - Scopes []*string - - // A description of this Activity Log Alert rule. - Description *string - - // Indicates whether this Activity Log Alert rule is enabled. If an Activity Log Alert rule is not enabled, then none of its - // actions will be activated. - Enabled *bool -} - -// AlertRuleResource - The alert rule resource. -type AlertRuleResource struct { - // REQUIRED; Resource location - Location *string - - // REQUIRED; The alert rule properties of the resource. - Properties *AlertRule - - // Resource tags - Tags map[string]*string - - // READ-ONLY; Azure resource Id - ID *string - - // READ-ONLY; Azure resource name - Name *string - - // READ-ONLY; Azure resource type - Type *string -} - -// AlertRuleResourceCollection - Represents a collection of alert rule resources. -type AlertRuleResourceCollection struct { - // the values for the alert rule resources. - Value []*AlertRuleResource -} - -// AlertRuleResourcePatch - The alert rule object for patch operations. -type AlertRuleResourcePatch struct { - // The properties of an alert rule. - Properties *AlertRule - - // Resource tags - Tags map[string]*string -} - // ArmRoleReceiver - An arm role receiver. type ArmRoleReceiver struct { // REQUIRED; The name of the arm role receiver. Names must be unique across all receivers within an action group. @@ -394,6 +164,9 @@ type AutomationRunbookReceiver struct { // REQUIRED; The resource id for webhook linked to this runbook. WebhookResourceID *string + // The principal id of the managed identity. The value can be "None", "SystemAssigned" + ManagedIdentity *string + // Indicates name of the webhook. Name *string @@ -404,131 +177,6 @@ type AutomationRunbookReceiver struct { UseCommonAlertSchema *bool } -// AutoscaleErrorResponse - Describes the format of Error response. -type AutoscaleErrorResponse struct { - // The error object. - Error *AutoscaleErrorResponseError - - // READ-ONLY; The system metadata related to the response. - SystemData *SystemData -} - -// AutoscaleErrorResponseError - The error object. -type AutoscaleErrorResponseError struct { - // One of a server-defined set of error codes. - Code *string - - // A human-readable representation of the error's details. - Details *string - - // A human-readable representation of the error. - Message *string - - // The target of the particular error. - Target *string -} - -// AutoscaleNotification - Autoscale notification. -type AutoscaleNotification struct { - // CONSTANT; the operation associated with the notification and its value must be "scale" - // Field has constant value "Scale", any specified value is ignored. - Operation *string - - // the email notification. - Email *EmailNotification - - // the collection of webhook notifications. - Webhooks []*WebhookNotification -} - -// AutoscaleProfile - Autoscale profile. -type AutoscaleProfile struct { - // REQUIRED; the number of instances that can be used during this profile. - Capacity *ScaleCapacity - - // REQUIRED; the name of the profile. - Name *string - - // REQUIRED; the collection of rules that provide the triggers and parameters for the scaling action. A maximum of 10 rules - // can be specified. - Rules []*ScaleRule - - // the specific date-time for the profile. This element is not used if the Recurrence element is used. - FixedDate *TimeWindow - - // the repeating times at which this profile begins. This element is not used if the FixedDate element is used. - Recurrence *Recurrence -} - -// AutoscaleSetting - A setting that contains all of the configuration for the automatic scaling of a resource. -type AutoscaleSetting struct { - // REQUIRED; the collection of automatic scaling profiles that specify different scaling parameters for different time periods. - // A maximum of 20 profiles can be specified. - Profiles []*AutoscaleProfile - - // the enabled flag. Specifies whether automatic scaling is enabled for the resource. The default value is 'false'. - Enabled *bool - - // the name of the autoscale setting. - Name *string - - // the collection of notifications. - Notifications []*AutoscaleNotification - - // the predictive autoscale policy mode. - PredictiveAutoscalePolicy *PredictiveAutoscalePolicy - - // the location of the resource that the autoscale setting should be added to. - TargetResourceLocation *string - - // the resource identifier of the resource that the autoscale setting should be added to. - TargetResourceURI *string -} - -// AutoscaleSettingResource - The autoscale setting resource. -type AutoscaleSettingResource struct { - // REQUIRED; Resource location - Location *string - - // REQUIRED; The autoscale setting of the resource. - Properties *AutoscaleSetting - - // Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this - // resource (across resource groups). A maximum of 15 tags can be provided for a - // resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. - Tags map[string]*string - - // READ-ONLY; Azure resource Id - ID *string - - // READ-ONLY; Azure resource name - Name *string - - // READ-ONLY; The system metadata related to the response. - SystemData *SystemData - - // READ-ONLY; Azure resource type - Type *string -} - -// AutoscaleSettingResourceCollection - Represents a collection of autoscale setting resources. -type AutoscaleSettingResourceCollection struct { - // REQUIRED; the values for the autoscale setting resources. - Value []*AutoscaleSettingResource - - // URL to get the next set of results. - NextLink *string -} - -// AutoscaleSettingResourcePatch - The autoscale setting object for patch operations. -type AutoscaleSettingResourcePatch struct { - // The autoscale setting properties of the update operation. - Properties *AutoscaleSetting - - // Resource tags - Tags map[string]*string -} - // AzureAppPushReceiver - The Azure mobile App push notification receiver. type AzureAppPushReceiver struct { // REQUIRED; The email address registered for the Azure mobile app. @@ -538,16 +186,6 @@ type AzureAppPushReceiver struct { Name *string } -// AzureAppPushReceiverAutoGenerated - The Azure mobile App push notification receiver. -type AzureAppPushReceiverAutoGenerated struct { - // REQUIRED; The email address registered for the Azure mobile app. - EmailAddress *string - - // REQUIRED; The name of the Azure mobile app push receiver. Names must be unique across all receivers within a tenant action - // group. - Name *string -} - // AzureFunctionReceiver - An azure function receiver. type AzureFunctionReceiver struct { // REQUIRED; The azure resource id of the function app. @@ -562,380 +200,285 @@ type AzureFunctionReceiver struct { // REQUIRED; The name of the azure function receiver. Names must be unique across all receivers within an action group. Name *string + // The principal id of the managed identity. The value can be "None", "SystemAssigned" + ManagedIdentity *string + // Indicates whether to use common alert schema. UseCommonAlertSchema *bool } -// AzureMonitorMetricsDestination - Azure Monitor Metrics destination. -type AzureMonitorMetricsDestination struct { - // A friendly name for the destination. This name should be unique across all destinations (regardless of type) within the - // data collection rule. - Name *string -} - -// AzureMonitorPrivateLinkScope - An Azure Monitor PrivateLinkScope definition. -type AzureMonitorPrivateLinkScope struct { - // REQUIRED; The geo-location where the resource lives +// AzureResource - An azure resource object +type AzureResource struct { + // REQUIRED; Resource location Location *string - // REQUIRED; Properties that define a Azure Monitor PrivateLinkScope resource. - Properties *AzureMonitorPrivateLinkScopeProperties + // Managed service identity (system assigned and/or user assigned identities) + Identity *ManagedServiceIdentity - // Resource tags. + // 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; Azure resource Id ID *string - // READ-ONLY; The name of the resource + // READ-ONLY; Azure resource name Name *string - // READ-ONLY; System data - SystemData *SystemData - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + // READ-ONLY; Azure resource type Type *string } -// AzureMonitorPrivateLinkScopeListResult - Describes the list of Azure Monitor PrivateLinkScope resources. -type AzureMonitorPrivateLinkScopeListResult struct { - // REQUIRED; List of Azure Monitor PrivateLinkScope definitions. - Value []*AzureMonitorPrivateLinkScope +// Condition - A condition of the scheduled query rule. +type Condition struct { + // The extent of deviation required to trigger an alert. Allowed values are 'Low', 'Medium' and 'High'. This will affect how + // tight the threshold is to the metric series pattern. Relevant only for dynamic + // threshold rules of the kind LogAlert. + AlertSensitivity *string - // The URI to get the next set of Azure Monitor PrivateLinkScope definitions if too many PrivateLinkScopes where returned - // in the result set. - NextLink *string -} + // Specifies the type of threshold criteria + CriterionType *CriterionType -// AzureMonitorPrivateLinkScopeProperties - Properties that define a Azure Monitor PrivateLinkScope resource. -type AzureMonitorPrivateLinkScopeProperties struct { - // REQUIRED; Access mode settings - AccessModeSettings *AccessModeSettings + // List of Dimensions conditions + Dimensions []*Dimension - // READ-ONLY; List of private endpoint connections. - PrivateEndpointConnections []*PrivateEndpointConnection + // The minimum number of violations required within the selected lookback time window required to raise an alert. Relevant + // only for rules of the kind LogAlert. + FailingPeriods *ConditionFailingPeriods - // READ-ONLY; Current state of this PrivateLinkScope: whether or not is has been provisioned within the resource group it - // is defined. Users cannot change this value but are able to read from it. Values will include - // Provisioning ,Succeeded, Canceled and Failed. - ProvisioningState *string -} + // Use this option to set the date from which to start learning the metric historical data and calculate the dynamic thresholds + // (in ISO8601 format). Relevant only for dynamic threshold rules of the kind + // LogAlert. + IgnoreDataBefore *time.Time -// AzureMonitorWorkspace - Properties of an Azure Monitor workspace -type AzureMonitorWorkspace struct { - // READ-ONLY; The immutable ID of the Azure Monitor workspace. This property is read-only. - AccountID *string + // The column containing the metric measure number. Relevant only for rules of the kind LogAlert. + MetricMeasureColumn *string - // READ-ONLY; The Data Collection Rule and Endpoint used for ingestion by default. - DefaultIngestionSettings *AzureMonitorWorkspaceDefaultIngestionSettings + // The name of the metric to be sent. Relevant and required only for rules of the kind LogToMetric. + MetricName *string - // READ-ONLY; Information about metrics for the Azure Monitor workspace - Metrics *AzureMonitorWorkspaceMetrics + // The minimum results count that should be found for triggering an alert. Relevant only for rules of the kind SimpleLogAlert. + MinRecurrenceCount *int64 - // READ-ONLY; The provisioning state of the Azure Monitor workspace. Set to Succeeded if everything is healthy. - ProvisioningState *ProvisioningState -} + // The criteria operator. Relevant and required only for rules of the kind LogAlert. + Operator *ConditionOperator -// AzureMonitorWorkspaceDefaultIngestionSettings - The Data Collection Rule and Endpoint used for ingestion by default. -type AzureMonitorWorkspaceDefaultIngestionSettings struct { - // READ-ONLY; The Azure resource Id of the default data collection endpoint for this workspace. - DataCollectionEndpointResourceID *string + // Log query alert + Query *string - // READ-ONLY; The Azure resource Id of the default data collection rule for this workspace. - DataCollectionRuleResourceID *string -} + // The column containing the resource id. The content of the column must be a uri formatted as resource id. Relevant only + // for rules of the kind LogAlert. + ResourceIDColumn *string -// AzureMonitorWorkspaceMetrics - Information about metrics for the Azure Monitor workspace -type AzureMonitorWorkspaceMetrics struct { - // READ-ONLY; An internal identifier for the metrics container. Only to be used by the system - InternalID *string + // the criteria threshold value that activates the alert. Relevant and required only for static threshold rules of the kind + // LogAlert. + Threshold *float64 - // READ-ONLY; The Prometheus query endpoint for the workspace - PrometheusQueryEndpoint *string + // Aggregation type. Relevant and required only for rules of the kind LogAlert. + TimeAggregation *TimeAggregation } -// AzureMonitorWorkspaceResource - An Azure Monitor Workspace definition -type AzureMonitorWorkspaceResource struct { - // REQUIRED; The geo-location where the resource lives - Location *string - - // Resource properties - Properties *AzureMonitorWorkspaceResourceProperties +// ConditionFailingPeriods - The minimum number of violations required within the selected lookback time window required to +// raise an alert. Relevant only for rules of the kind LogAlert. +type ConditionFailingPeriods struct { + // The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. Default value is + // 1 + MinFailingPeriodsToAlert *int64 - // Resource tags. - Tags map[string]*string + // The number of aggregated lookback points. The lookback time window is calculated based on the aggregation granularity (windowSize) + // and the selected number of aggregated points. Default value is 1 + NumberOfEvaluationPeriods *int64 +} - // READ-ONLY; Resource entity tag (ETag) - Etag *string +// Context - The context info +type Context struct { + // The context id type + ContextType *string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string + // The source of the notification request + NotificationSource *string +} - // READ-ONLY; The name of the resource +// Dimension splitting and filtering definition +type Dimension struct { + // REQUIRED; Name of the dimension Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData + // REQUIRED; Operator for dimension values + Operator *DimensionOperator - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string + // REQUIRED; List of dimension values + Values []*string } -// AzureMonitorWorkspaceResourceForUpdate - Definition of ARM tracked top level resource properties for update operation -type AzureMonitorWorkspaceResourceForUpdate struct { - // Resource tags - Tags map[string]*string -} - -// AzureMonitorWorkspaceResourceListResult - A pageable list of resources -type AzureMonitorWorkspaceResourceListResult struct { - // REQUIRED; A list of resources - Value []*AzureMonitorWorkspaceResource - - // The URL to use for getting the next set of results - NextLink *string -} - -// AzureMonitorWorkspaceResourceProperties - Resource properties -type AzureMonitorWorkspaceResourceProperties struct { - // READ-ONLY; The immutable ID of the Azure Monitor workspace. This property is read-only. - AccountID *string +// EmailReceiver - An email receiver. +type EmailReceiver struct { + // REQUIRED; The email address of this receiver. + EmailAddress *string - // READ-ONLY; The Data Collection Rule and Endpoint used for ingestion by default. - DefaultIngestionSettings *AzureMonitorWorkspaceDefaultIngestionSettings + // REQUIRED; The name of the email receiver. Names must be unique across all receivers within an action group. + Name *string - // READ-ONLY; Information about metrics for the Azure Monitor workspace - Metrics *AzureMonitorWorkspaceMetrics + // Indicates whether to use common alert schema. + UseCommonAlertSchema *bool - // READ-ONLY; The provisioning state of the Azure Monitor workspace. Set to Succeeded if everything is healthy. - ProvisioningState *ProvisioningState + // READ-ONLY; The receiver status of the e-mail. + Status *ReceiverStatus } -// AzureResource - An azure resource object -type AzureResource struct { - // REQUIRED; Resource location - Location *string - - // Resource tags - Tags map[string]*string - - // READ-ONLY; Azure resource Id - ID *string - - // READ-ONLY; Azure resource name - Name *string - - // READ-ONLY; Azure resource type - Type *string +// EnableRequest - Describes a receiver that should be resubscribed. +type EnableRequest struct { + // REQUIRED; The name of the receiver to resubscribe. + ReceiverName *string } -// AzureResourceAutoGenerated - An Azure resource object. -type AzureResourceAutoGenerated struct { - // The location of the resource. Since Azure Activity Log Alerts is a global service, the location of the rules should always - // be 'global'. - Location *string - - // The tags of the resource. - Tags map[string]*string - - // READ-ONLY; The resource Id. - ID *string - - // READ-ONLY; The name of the resource. - Name *string +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info any - // READ-ONLY; The type of the resource. + // READ-ONLY; The additional info type. Type *string } -// BaselineMetadata - Represents a baseline metadata value. -type BaselineMetadata struct { - // REQUIRED; Name of the baseline metadata. - Name *string - - // REQUIRED; Value of the baseline metadata. - Value *string -} - -// ColumnDefinition - Definition of custom data column. -type ColumnDefinition struct { - // The name of the column. - Name *string - - // The type of the column data. - Type *KnownColumnDefinitionType +// ErrorContract - Common error response for all Azure Resource Manager APIs to return error details for failed operations. +// (This also follows the OData error response format.) +type ErrorContract struct { + // The error object. + Error *ErrorResponseAutoGenerated } -// Condition - A condition of the scheduled query rule. -type Condition struct { - // List of Dimensions conditions - Dimensions []*Dimension - - // The minimum number of violations required within the selected lookback time window required to raise an alert. Relevant - // only for rules of the kind LogAlert. - FailingPeriods *ConditionFailingPeriods - - // The column containing the metric measure number. Relevant only for rules of the kind LogAlert. - MetricMeasureColumn *string - - // The name of the metric to be sent. Relevant and required only for rules of the kind LogToMetric. - MetricName *string - - // The criteria operator. Relevant and required only for rules of the kind LogAlert. - Operator *ConditionOperator - - // Log query alert - Query *string - - // The column containing the resource id. The content of the column must be a uri formatted as resource id. Relevant only - // for rules of the kind LogAlert. - ResourceIDColumn *string - - // the criteria threshold value that activates the alert. Relevant and required only for rules of the kind LogAlert. - Threshold *float64 +// ErrorResponse - Describes the format of Error response. +type ErrorResponse struct { + // Error code + Code *string - // Aggregation type. Relevant and required only for rules of the kind LogAlert. - TimeAggregation *TimeAggregation + // Error message indicating why the operation failed. + Message *string } -// ConditionFailingPeriods - The minimum number of violations required within the selected lookback time window required to -// raise an alert. Relevant only for rules of the kind LogAlert. -type ConditionFailingPeriods struct { - // The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. Default value is - // 1 - MinFailingPeriodsToAlert *int64 +// ErrorResponseAutoGenerated - Common error response for all Azure Resource Manager APIs to return error details for failed +// operations. (This also follows the OData error response format.) +type ErrorResponseAutoGenerated struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo - // The number of aggregated lookback points. The lookback time window is calculated based on the aggregation granularity (windowSize) - // and the selected number of aggregated points. Default value is 1 - NumberOfEvaluationPeriods *int64 -} + // READ-ONLY; The error code. + Code *string -// ConfigurationAccessEndpointSpec - Definition of the endpoint used for accessing configuration. -type ConfigurationAccessEndpointSpec struct { - // READ-ONLY; The endpoint. This property is READ-ONLY. - Endpoint *string -} + // READ-ONLY; The error details. + Details []*ErrorResponseAutoGenerated -// Context - The context info -type Context struct { - // The context id type - ContextType *string + // READ-ONLY; The error message. + Message *string - // The source of the notification request - NotificationSource *string + // READ-ONLY; The error target. + Target *string } -// DataCollectionEndpoint - Definition of data collection endpoint. -type DataCollectionEndpoint struct { - // The endpoint used by clients to access their configuration. - ConfigurationAccess *DataCollectionEndpointConfigurationAccess +// EventHubReceiver - An Event hub receiver. +type EventHubReceiver struct { + // REQUIRED; The name of the specific Event Hub queue + EventHubName *string - // Description of the data collection endpoint. - Description *string + // REQUIRED; The Event Hub namespace + EventHubNameSpace *string - // The immutable ID of this data collection endpoint resource. This property is READ-ONLY. - ImmutableID *string + // REQUIRED; The name of the Event hub receiver. Names must be unique across all receivers within an action group. + Name *string - // The endpoint used by clients to ingest logs. - LogsIngestion *DataCollectionEndpointLogsIngestion + // REQUIRED; The Id for the subscription containing this event hub + SubscriptionID *string - // The endpoint used by clients to ingest metrics. - MetricsIngestion *DataCollectionEndpointMetricsIngestion + // The principal id of the managed identity. The value can be "None", "SystemAssigned" + ManagedIdentity *string - // Network access control rules for the endpoints. - NetworkACLs *DataCollectionEndpointNetworkACLs + // The tenant Id for the subscription containing this event hub + TenantID *string - // READ-ONLY; Failover configuration on this endpoint. This property is READ-ONLY. - FailoverConfiguration *DataCollectionEndpointFailoverConfiguration + // Indicates whether to use common alert schema. + UseCommonAlertSchema *bool +} - // READ-ONLY; Metadata for the resource. This property is READ-ONLY. - Metadata *DataCollectionEndpointMetadata +// Identity for the resource. +type Identity struct { + // REQUIRED; Type of managed service identity. + Type *IdentityType - // READ-ONLY; List of Azure Monitor Private Link Scope Resources to which this data collection endpoint resource is associated. - // This property is READ-ONLY. - PrivateLinkScopedResources []*PrivateLinkScopedResource + // The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource + // ids in the form: + // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + UserAssignedIdentities map[string]*UserIdentityProperties - // READ-ONLY; The resource provisioning state. This property is READ-ONLY. - ProvisioningState *KnownDataCollectionEndpointProvisioningState -} + // READ-ONLY; The principal ID of resource identity. + PrincipalID *string -// DataCollectionEndpointConfigurationAccess - The endpoint used by clients to access their configuration. -type DataCollectionEndpointConfigurationAccess struct { - // READ-ONLY; The endpoint. This property is READ-ONLY. - Endpoint *string + // READ-ONLY; The tenant ID of resource. + TenantID *string } -// DataCollectionEndpointFailoverConfiguration - Failover configuration on this endpoint. This property is READ-ONLY. -type DataCollectionEndpointFailoverConfiguration struct { - // Active location where data flow will occur. - ActiveLocation *string +// IncidentReceiver - An Incident receiver. +type IncidentReceiver struct { + // REQUIRED; The incident service connection + Connection *IncidentServiceConnection - // Locations that are configured for failover. - Locations []*LocationSpec -} - -// DataCollectionEndpointLogsIngestion - The endpoint used by clients to ingest logs. -type DataCollectionEndpointLogsIngestion struct { - // READ-ONLY; The endpoint. This property is READ-ONLY. - Endpoint *string -} + // REQUIRED; The incident management service type + IncidentManagementService *IncidentManagementService -// DataCollectionEndpointMetadata - Metadata for the resource. This property is READ-ONLY. -type DataCollectionEndpointMetadata struct { - // READ-ONLY; Azure offering managing this resource on-behalf-of customer. - ProvisionedBy *string + // REQUIRED; Field mappings for the incident service + Mappings map[string]*string - // READ-ONLY; Resource Id of azure offering managing this resource on-behalf-of customer. - ProvisionedByResourceID *string + // REQUIRED; The name of the Incident receiver. Names must be unique across all receivers within an action group. + Name *string } -// DataCollectionEndpointMetricsIngestion - The endpoint used by clients to ingest metrics. -type DataCollectionEndpointMetricsIngestion struct { - // READ-ONLY; The endpoint. This property is READ-ONLY. - Endpoint *string -} +// IncidentServiceConnection - The connection info for Incident Receiver. +type IncidentServiceConnection struct { + // REQUIRED; GUID value representing the connection ID for the incident management service. + ID *string -// DataCollectionEndpointNetworkACLs - Network access control rules for the endpoints. -type DataCollectionEndpointNetworkACLs struct { - // The configuration to set whether network access from public internet to the endpoints are allowed. - PublicNetworkAccess *KnownPublicNetworkAccessOptions + // REQUIRED; The name of the connection. + Name *string } -// DataCollectionEndpointResource - Definition of ARM tracked top level resource. -type DataCollectionEndpointResource struct { - // REQUIRED; The geo-location where the resource lives. - Location *string - - // Managed service identity of the resource. - Identity *DataCollectionEndpointResourceIdentity +// ItsmReceiver - An Itsm receiver. +type ItsmReceiver struct { + // REQUIRED; Unique identification of ITSM connection among multiple defined in above workspace. + ConnectionID *string - // The kind of the resource. - Kind *KnownDataCollectionEndpointResourceKind + // REQUIRED; The name of the Itsm receiver. Names must be unique across all receivers within an action group. + Name *string - // Resource properties. - Properties *DataCollectionEndpointResourceProperties + // REQUIRED; Region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' + Region *string - // Resource tags. - Tags map[string]*string + // REQUIRED; JSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob + // as well. + TicketConfiguration *string - // READ-ONLY; Resource entity tag (ETag). - Etag *string + // REQUIRED; OMS LA instance identifier. + WorkspaceID *string +} - // READ-ONLY; Fully qualified ID of the resource. - ID *string +// LogicAppReceiver - A logic app receiver. +type LogicAppReceiver struct { + // REQUIRED; The callback url where http request sent to. + CallbackURL *string - // READ-ONLY; The name of the resource. + // REQUIRED; The name of the logic app receiver. Names must be unique across all receivers within an action group. Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *DataCollectionEndpointResourceSystemData + // REQUIRED; The azure resource id of the logic app receiver. + ResourceID *string - // READ-ONLY; The type of the resource. - Type *string + // The principal id of the managed identity. The value can be "None", "SystemAssigned" + ManagedIdentity *string + + // Indicates whether to use common alert schema. + UseCommonAlertSchema *bool } -// DataCollectionEndpointResourceIdentity - Managed service identity of the resource. -type DataCollectionEndpointResourceIdentity struct { +// ManagedServiceIdentity - Managed service identity (system assigned and/or user assigned identities) +type ManagedServiceIdentity struct { // REQUIRED; Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). Type *ManagedServiceIdentityType @@ -954,2802 +497,75 @@ type DataCollectionEndpointResourceIdentity struct { TenantID *string } -// DataCollectionEndpointResourceListResult - A pageable list of resources. -type DataCollectionEndpointResourceListResult struct { - // REQUIRED; A list of resources. - Value []*DataCollectionEndpointResource - - // The URL to use for getting the next set of results. - NextLink *string -} - -// DataCollectionEndpointResourceProperties - Resource properties. -type DataCollectionEndpointResourceProperties struct { - // The endpoint used by clients to access their configuration. - ConfigurationAccess *DataCollectionEndpointConfigurationAccess - - // Description of the data collection endpoint. - Description *string +// NotificationRequestBody - The request body which contain contact detail metadata +type NotificationRequestBody struct { + // REQUIRED; The value of the supported alert type. Supported alert type values are: servicehealth, metricstaticthreshold, + // metricsdynamicthreshold, logalertv2, smartalert, webtestalert, logalertv1numresult, + // logalertv1metricmeasurement, resourcehealth, activitylog, actualcostbudget, forecastedbudget + AlertType *string - // The immutable ID of this data collection endpoint resource. This property is READ-ONLY. - ImmutableID *string + // The list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are + // supported. + ArmRoleReceivers []*ArmRoleReceiver - // The endpoint used by clients to ingest logs. - LogsIngestion *DataCollectionEndpointLogsIngestion + // The list of AutomationRunbook receivers that are part of this action group. + AutomationRunbookReceivers []*AutomationRunbookReceiver - // The endpoint used by clients to ingest metrics. - MetricsIngestion *DataCollectionEndpointMetricsIngestion + // The list of AzureAppPush receivers that are part of this action group. + AzureAppPushReceivers []*AzureAppPushReceiver - // Network access control rules for the endpoints. - NetworkACLs *DataCollectionEndpointNetworkACLs + // The list of azure function receivers that are part of this action group. + AzureFunctionReceivers []*AzureFunctionReceiver - // READ-ONLY; Failover configuration on this endpoint. This property is READ-ONLY. - FailoverConfiguration *DataCollectionEndpointFailoverConfiguration + // The list of email receivers that are part of this action group. + EmailReceivers []*EmailReceiver - // READ-ONLY; Metadata for the resource. This property is READ-ONLY. - Metadata *DataCollectionEndpointMetadata + // The list of event hub receivers that are part of this action group. + EventHubReceivers []*EventHubReceiver - // READ-ONLY; List of Azure Monitor Private Link Scope Resources to which this data collection endpoint resource is associated. - // This property is READ-ONLY. - PrivateLinkScopedResources []*PrivateLinkScopedResource + // The list of incident receivers that are part of this action group. + IncidentReceivers []*IncidentReceiver - // READ-ONLY; The resource provisioning state. This property is READ-ONLY. - ProvisioningState *KnownDataCollectionEndpointProvisioningState -} + // The list of ITSM receivers that are part of this action group. + ItsmReceivers []*ItsmReceiver -// DataCollectionEndpointResourceSystemData - Metadata pertaining to creation and last modification of the resource. -type DataCollectionEndpointResourceSystemData struct { - // The timestamp of resource creation (UTC). - CreatedAt *time.Time + // The list of logic app receivers that are part of this action group. + LogicAppReceivers []*LogicAppReceiver - // The identity that created the resource. - CreatedBy *string + // The list of SMS receivers that are part of this action group. + SmsReceivers []*SmsReceiver - // The type of identity that created the resource. - CreatedByType *CreatedByType + // The list of voice receivers that are part of this action group. + VoiceReceivers []*VoiceReceiver - // The timestamp of resource last modification (UTC) - LastModifiedAt *time.Time + // The list of webhook receivers that are part of this action group. + WebhookReceivers []*WebhookReceiver +} - // The identity that last modified the resource. - LastModifiedBy *string +// RuleResolveConfiguration - TBD. Relevant only for rules of the kind LogAlert. +type RuleResolveConfiguration struct { + // The flag that indicates whether or not to auto resolve a fired alert. + AutoResolved *bool - // The type of identity that last modified the resource. - LastModifiedByType *CreatedByType + // The duration a rule must evaluate as healthy before the fired alert is automatically resolved represented in ISO 8601 duration + // format. + TimeToResolve *string } -// DataCollectionRule - Definition of what monitoring data to collect and where that data should be sent. -type DataCollectionRule struct { - // The resource ID of the data collection endpoint that this rule can be used with. - DataCollectionEndpointID *string +// ScheduledQueryRuleCriteria - The rule criteria that defines the conditions of the scheduled query rule. +type ScheduledQueryRuleCriteria struct { + // A list of conditions to evaluate against the specified scopes + AllOf []*Condition +} - // The specification of data flows. - DataFlows []*DataFlow +// ScheduledQueryRuleProperties - scheduled query rule Definition +type ScheduledQueryRuleProperties struct { + // Actions to invoke when the alert fires. + Actions *Actions - // The specification of data sources. This property is optional and can be omitted if the rule is meant to be used via direct - // calls to the provisioned endpoint. - DataSources *DataCollectionRuleDataSources - - // Description of the data collection rule. - Description *string - - // The specification of destinations. - Destinations *DataCollectionRuleDestinations - - // Declaration of custom streams used in this rule. - StreamDeclarations map[string]*StreamDeclaration - - // READ-ONLY; The immutable ID of this data collection rule. This property is READ-ONLY. - ImmutableID *string - - // READ-ONLY; Metadata about the resource - Metadata *DataCollectionRuleMetadata - - // READ-ONLY; The resource provisioning state. - ProvisioningState *KnownDataCollectionRuleProvisioningState -} - -// DataCollectionRuleAssociation - Definition of association of a data collection rule with a monitored Azure resource. -type DataCollectionRuleAssociation struct { - // The resource ID of the data collection endpoint that is to be associated. - DataCollectionEndpointID *string - - // The resource ID of the data collection rule that is to be associated. - DataCollectionRuleID *string - - // Description of the association. - Description *string - - // READ-ONLY; Metadata about the resource - Metadata *DataCollectionRuleAssociationMetadata - - // READ-ONLY; The resource provisioning state. - ProvisioningState *KnownDataCollectionRuleAssociationProvisioningState -} - -// DataCollectionRuleAssociationMetadata - Metadata about the resource -type DataCollectionRuleAssociationMetadata struct { - // READ-ONLY; Azure offering managing this resource on-behalf-of customer. - ProvisionedBy *string - - // READ-ONLY; Resource Id of azure offering managing this resource on-behalf-of customer. - ProvisionedByResourceID *string -} - -// DataCollectionRuleAssociationProxyOnlyResource - Definition of generic ARM proxy resource. -type DataCollectionRuleAssociationProxyOnlyResource struct { - // Resource properties. - Properties *DataCollectionRuleAssociationProxyOnlyResourceProperties - - // READ-ONLY; Resource entity tag (ETag). - Etag *string - - // READ-ONLY; Fully qualified ID of the resource. - ID *string - - // READ-ONLY; The name of the resource. - Name *string - - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *DataCollectionRuleAssociationProxyOnlyResourceSystemData - - // READ-ONLY; The type of the resource. - Type *string -} - -// DataCollectionRuleAssociationProxyOnlyResourceListResult - A pageable list of resources. -type DataCollectionRuleAssociationProxyOnlyResourceListResult struct { - // REQUIRED; A list of resources. - Value []*DataCollectionRuleAssociationProxyOnlyResource - - // The URL to use for getting the next set of results. - NextLink *string -} - -// DataCollectionRuleAssociationProxyOnlyResourceProperties - Resource properties. -type DataCollectionRuleAssociationProxyOnlyResourceProperties struct { - // The resource ID of the data collection endpoint that is to be associated. - DataCollectionEndpointID *string - - // The resource ID of the data collection rule that is to be associated. - DataCollectionRuleID *string - - // Description of the association. - Description *string - - // READ-ONLY; Metadata about the resource - Metadata *DataCollectionRuleAssociationMetadata - - // READ-ONLY; The resource provisioning state. - ProvisioningState *KnownDataCollectionRuleAssociationProvisioningState -} - -// DataCollectionRuleAssociationProxyOnlyResourceSystemData - Metadata pertaining to creation and last modification of the -// resource. -type DataCollectionRuleAssociationProxyOnlyResourceSystemData struct { - // The timestamp of resource creation (UTC). - CreatedAt *time.Time - - // The identity that created the resource. - CreatedBy *string - - // The type of identity that created the resource. - CreatedByType *CreatedByType - - // The timestamp of resource last modification (UTC) - LastModifiedAt *time.Time - - // The identity that last modified the resource. - LastModifiedBy *string - - // The type of identity that last modified the resource. - LastModifiedByType *CreatedByType -} - -// DataCollectionRuleDataSources - The specification of data sources. This property is optional and can be omitted if the -// rule is meant to be used via direct calls to the provisioned endpoint. -type DataCollectionRuleDataSources struct { - // Specifications of pull based data sources - DataImports *DataSourcesSpecDataImports - - // The list of Azure VM extension data source configurations. - Extensions []*ExtensionDataSource - - // The list of IIS logs source configurations. - IisLogs []*IisLogsDataSource - - // The list of Log files source configurations. - LogFiles []*LogFilesDataSource - - // The list of performance counter data source configurations. - PerformanceCounters []*PerfCounterDataSource - - // The list of platform telemetry configurations - PlatformTelemetry []*PlatformTelemetryDataSource - - // The list of Prometheus forwarder data source configurations. - PrometheusForwarder []*PrometheusForwarderDataSource - - // The list of Syslog data source configurations. - Syslog []*SyslogDataSource - - // The list of Windows Event Log data source configurations. - WindowsEventLogs []*WindowsEventLogDataSource - - // The list of Windows Firewall logs source configurations. - WindowsFirewallLogs []*WindowsFirewallLogsDataSource -} - -// DataCollectionRuleDestinations - The specification of destinations. -type DataCollectionRuleDestinations struct { - // Azure Monitor Metrics destination. - AzureMonitorMetrics *DestinationsSpecAzureMonitorMetrics - - // List of Event Hubs destinations. - EventHubs []*EventHubDestination - - // List of Event Hubs Direct destinations. - EventHubsDirect []*EventHubDirectDestination - - // List of Log Analytics destinations. - LogAnalytics []*LogAnalyticsDestination - - // List of monitoring account destinations. - MonitoringAccounts []*MonitoringAccountDestination - - // List of storage accounts destinations. - StorageAccounts []*StorageBlobDestination - - // List of Storage Blob Direct destinations. To be used only for sending data directly to store from the agent. - StorageBlobsDirect []*StorageBlobDestination - - // List of Storage Table Direct destinations. - StorageTablesDirect []*StorageTableDestination -} - -// DataCollectionRuleMetadata - Metadata about the resource -type DataCollectionRuleMetadata struct { - // READ-ONLY; Azure offering managing this resource on-behalf-of customer. - ProvisionedBy *string - - // READ-ONLY; Resource Id of azure offering managing this resource on-behalf-of customer. - ProvisionedByResourceID *string -} - -// DataCollectionRuleResource - Definition of ARM tracked top level resource. -type DataCollectionRuleResource struct { - // REQUIRED; The geo-location where the resource lives. - Location *string - - // Managed service identity of the resource. - Identity *DataCollectionRuleResourceIdentity - - // The kind of the resource. - Kind *KnownDataCollectionRuleResourceKind - - // Resource properties. - Properties *DataCollectionRuleResourceProperties - - // Resource tags. - Tags map[string]*string - - // READ-ONLY; Resource entity tag (ETag). - Etag *string - - // READ-ONLY; Fully qualified ID of the resource. - ID *string - - // READ-ONLY; The name of the resource. - Name *string - - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. - SystemData *DataCollectionRuleResourceSystemData - - // READ-ONLY; The type of the resource. - Type *string -} - -// DataCollectionRuleResourceIdentity - Managed service identity of the resource. -type DataCollectionRuleResourceIdentity struct { - // REQUIRED; Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). - Type *ManagedServiceIdentityType - - // The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM - // resource ids in the form: - // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - // The dictionary values can be empty objects ({}) in - // requests. - UserAssignedIdentities map[string]*UserAssignedIdentity - - // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned - // identity. - PrincipalID *string - - // READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. - TenantID *string -} - -// DataCollectionRuleResourceListResult - A pageable list of resources. -type DataCollectionRuleResourceListResult struct { - // REQUIRED; A list of resources. - Value []*DataCollectionRuleResource - - // The URL to use for getting the next set of results. - NextLink *string -} - -// DataCollectionRuleResourceProperties - Resource properties. -type DataCollectionRuleResourceProperties struct { - // The resource ID of the data collection endpoint that this rule can be used with. - DataCollectionEndpointID *string - - // The specification of data flows. - DataFlows []*DataFlow - - // The specification of data sources. This property is optional and can be omitted if the rule is meant to be used via direct - // calls to the provisioned endpoint. - DataSources *DataCollectionRuleDataSources - - // Description of the data collection rule. - Description *string - - // The specification of destinations. - Destinations *DataCollectionRuleDestinations - - // Declaration of custom streams used in this rule. - StreamDeclarations map[string]*StreamDeclaration - - // READ-ONLY; The immutable ID of this data collection rule. This property is READ-ONLY. - ImmutableID *string - - // READ-ONLY; Metadata about the resource - Metadata *DataCollectionRuleMetadata - - // READ-ONLY; The resource provisioning state. - ProvisioningState *KnownDataCollectionRuleProvisioningState -} - -// DataCollectionRuleResourceSystemData - Metadata pertaining to creation and last modification of the resource. -type DataCollectionRuleResourceSystemData struct { - // The timestamp of resource creation (UTC). - CreatedAt *time.Time - - // The identity that created the resource. - CreatedBy *string - - // The type of identity that created the resource. - CreatedByType *CreatedByType - - // The timestamp of resource last modification (UTC) - LastModifiedAt *time.Time - - // The identity that last modified the resource. - LastModifiedBy *string - - // The type of identity that last modified the resource. - LastModifiedByType *CreatedByType -} - -// DataContainer - Information about a container with data for a given resource. -type DataContainer struct { - // REQUIRED; Log Analytics workspace information. - Workspace *WorkspaceInfo -} - -// DataFlow - Definition of which streams are sent to which destinations. -type DataFlow struct { - // The builtIn transform to transform stream data - BuiltInTransform *string - - // List of destinations for this data flow. - Destinations []*string - - // The output stream of the transform. Only required if the transform changes data to a different stream. - OutputStream *string - - // List of streams for this data flow. - Streams []*KnownDataFlowStreams - - // The KQL query to transform stream data. - TransformKql *string -} - -type DataImportSources struct { - // Definition of Event Hub configuration. - EventHub *DataImportSourcesEventHub -} - -// DataImportSourcesEventHub - Definition of Event Hub configuration. -type DataImportSourcesEventHub struct { - // Event Hub consumer group name - ConsumerGroup *string - - // A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the - // data collection rule. - Name *string - - // The stream to collect from EventHub - Stream *string -} - -// DataSourcesSpec - Specification of data sources that will be collected. -type DataSourcesSpec struct { - // Specifications of pull based data sources - DataImports *DataSourcesSpecDataImports - - // The list of Azure VM extension data source configurations. - Extensions []*ExtensionDataSource - - // The list of IIS logs source configurations. - IisLogs []*IisLogsDataSource - - // The list of Log files source configurations. - LogFiles []*LogFilesDataSource - - // The list of performance counter data source configurations. - PerformanceCounters []*PerfCounterDataSource - - // The list of platform telemetry configurations - PlatformTelemetry []*PlatformTelemetryDataSource - - // The list of Prometheus forwarder data source configurations. - PrometheusForwarder []*PrometheusForwarderDataSource - - // The list of Syslog data source configurations. - Syslog []*SyslogDataSource - - // The list of Windows Event Log data source configurations. - WindowsEventLogs []*WindowsEventLogDataSource - - // The list of Windows Firewall logs source configurations. - WindowsFirewallLogs []*WindowsFirewallLogsDataSource -} - -// DataSourcesSpecDataImports - Specifications of pull based data sources -type DataSourcesSpecDataImports struct { - // Definition of Event Hub configuration. - EventHub *DataImportSourcesEventHub -} - -// DefaultErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. -// (This also follows the OData error response format.). -type DefaultErrorResponse struct { - // The error object. - Error *ErrorDetail -} - -// DestinationsSpec - Specification of destinations that can be used in data flows. -type DestinationsSpec struct { - // Azure Monitor Metrics destination. - AzureMonitorMetrics *DestinationsSpecAzureMonitorMetrics - - // List of Event Hubs destinations. - EventHubs []*EventHubDestination - - // List of Event Hubs Direct destinations. - EventHubsDirect []*EventHubDirectDestination - - // List of Log Analytics destinations. - LogAnalytics []*LogAnalyticsDestination - - // List of monitoring account destinations. - MonitoringAccounts []*MonitoringAccountDestination - - // List of storage accounts destinations. - StorageAccounts []*StorageBlobDestination - - // List of Storage Blob Direct destinations. To be used only for sending data directly to store from the agent. - StorageBlobsDirect []*StorageBlobDestination - - // List of Storage Table Direct destinations. - StorageTablesDirect []*StorageTableDestination -} - -// DestinationsSpecAzureMonitorMetrics - Azure Monitor Metrics destination. -type DestinationsSpecAzureMonitorMetrics struct { - // A friendly name for the destination. This name should be unique across all destinations (regardless of type) within the - // data collection rule. - Name *string -} - -// DiagnosticSettings - The diagnostic settings. -type DiagnosticSettings struct { - // The resource Id for the event hub authorization rule. - EventHubAuthorizationRuleID *string - - // The name of the event hub. If none is specified, the default event hub will be selected. - EventHubName *string - - // A string indicating whether the export to Log Analytics should use the default destination type, i.e. AzureDiagnostics, - // or use a destination type constructed as follows: _. Possible values are: - // Dedicated and null (null is default.) - LogAnalyticsDestinationType *string - - // The list of logs settings. - Logs []*LogSettings - - // The full ARM resource ID of the Marketplace resource to which you would like to send Diagnostic Logs. - MarketplacePartnerID *string - - // The list of metric settings. - Metrics []*MetricSettings - - // The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. - ServiceBusRuleID *string - - // The resource ID of the storage account to which you would like to send Diagnostic Logs. - StorageAccountID *string - - // The full ARM resource ID of the Log Analytics workspace to which you would like to send Diagnostic Logs. Example: - // /subscriptions/4b9e8510-67ab-4e9a-95a9-e2f1e570ea9c/resourceGroups/insights-integration/providers/Microsoft.OperationalInsights/workspaces/viruela2 - WorkspaceID *string -} - -// DiagnosticSettingsCategory - The diagnostic settings Category. -type DiagnosticSettingsCategory struct { - // the collection of what category groups are supported. - CategoryGroups []*string - - // The type of the diagnostic settings category. - CategoryType *CategoryType -} - -// DiagnosticSettingsCategoryResource - The diagnostic settings category resource. -type DiagnosticSettingsCategoryResource 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 - Name *string - - // READ-ONLY; The properties of a Diagnostic Settings Category. - Properties *DiagnosticSettingsCategory - - // READ-ONLY; The system metadata related to this resource. - SystemData *SystemData - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// DiagnosticSettingsCategoryResourceCollection - Represents a collection of diagnostic setting category resources. -type DiagnosticSettingsCategoryResourceCollection struct { - // The collection of diagnostic settings category resources. - Value []*DiagnosticSettingsCategoryResource -} - -// DiagnosticSettingsResource - The diagnostic setting resource. -type DiagnosticSettingsResource struct { - // Properties of a Diagnostic Settings Resource. - Properties *DiagnosticSettings - - // 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; The system metadata related to this resource. - SystemData *SystemData - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// DiagnosticSettingsResourceCollection - Represents a collection of alert rule resources. -type DiagnosticSettingsResourceCollection struct { - // The collection of diagnostic settings resources;. - Value []*DiagnosticSettingsResource -} - -// Dimension splitting and filtering definition -type Dimension struct { - // REQUIRED; Name of the dimension - Name *string - - // REQUIRED; Operator for dimension values - Operator *DimensionOperator - - // REQUIRED; List of dimension values - Values []*string -} - -// DynamicMetricCriteria - Criterion for dynamic threshold. -type DynamicMetricCriteria struct { - // REQUIRED; The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric - // series pattern. - AlertSensitivity *DynamicThresholdSensitivity - - // REQUIRED; Specifies the type of threshold criteria - CriterionType *CriterionType - - // REQUIRED; The minimum number of violations required within the selected lookback time window required to raise an alert. - FailingPeriods *DynamicThresholdFailingPeriods - - // REQUIRED; Name of the metric. - MetricName *string - - // REQUIRED; Name of the criteria. - Name *string - - // REQUIRED; The operator used to compare the metric value against the threshold. - Operator *DynamicThresholdOperator - - // REQUIRED; the criteria time aggregation types. - TimeAggregation *AggregationTypeEnum - - // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]any - - // List of dimension conditions. - Dimensions []*MetricDimension - - // Use this option to set the date from which to start learning the metric historical data and calculate the dynamic thresholds - // (in ISO8601 format) - IgnoreDataBefore *time.Time - - // Namespace of the metric. - MetricNamespace *string - - // Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool -} - -// GetMultiMetricCriteria implements the MultiMetricCriteriaClassification interface for type DynamicMetricCriteria. -func (d *DynamicMetricCriteria) GetMultiMetricCriteria() *MultiMetricCriteria { - return &MultiMetricCriteria{ - AdditionalProperties: d.AdditionalProperties, - CriterionType: d.CriterionType, - Dimensions: d.Dimensions, - MetricName: d.MetricName, - MetricNamespace: d.MetricNamespace, - Name: d.Name, - SkipMetricValidation: d.SkipMetricValidation, - TimeAggregation: d.TimeAggregation, - } -} - -// DynamicThresholdFailingPeriods - The minimum number of violations required within the selected lookback time window required -// to raise an alert. -type DynamicThresholdFailingPeriods struct { - // REQUIRED; The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. - MinFailingPeriodsToAlert *float32 - - // REQUIRED; The number of aggregated lookback points. The lookback time window is calculated based on the aggregation granularity - // (windowSize) and the selected number of aggregated points. - NumberOfEvaluationPeriods *float32 -} - -// EmailNotification - Email notification of an autoscale event. -type EmailNotification struct { - // the custom e-mails list. This value can be null or empty, in which case this attribute will be ignored. - CustomEmails []*string - - // a value indicating whether to send email to subscription administrator. - SendToSubscriptionAdministrator *bool - - // a value indicating whether to send email to subscription co-administrators. - SendToSubscriptionCoAdministrators *bool -} - -// EmailReceiver - An email receiver. -type EmailReceiver struct { - // REQUIRED; The email address of this receiver. - EmailAddress *string - - // REQUIRED; The name of the email receiver. Names must be unique across all receivers within an action group. - Name *string - - // Indicates whether to use common alert schema. - UseCommonAlertSchema *bool - - // READ-ONLY; The receiver status of the e-mail. - Status *ReceiverStatus -} - -// EmailReceiverAutoGenerated - An email receiver. -type EmailReceiverAutoGenerated struct { - // REQUIRED; The email address of this receiver. - EmailAddress *string - - // REQUIRED; The name of the email receiver. Names must be unique across all receivers within a tenant action group. - Name *string - - // Indicates whether to use common alert schema. - UseCommonAlertSchema *bool - - // READ-ONLY; The receiver status of the e-mail. - Status *ReceiverStatus -} - -// EnableRequest - Describes a receiver that should be resubscribed. -type EnableRequest struct { - // REQUIRED; The name of the receiver to resubscribe. - ReceiverName *string -} - -// Error details. -type Error struct { - // REQUIRED; Error code identifying the specific error. - Code *string - - // Error message in the caller's locale. - Message *string -} - -// ErrorAdditionalInfo - The resource management error additional info. -type ErrorAdditionalInfo struct { - // READ-ONLY; The additional info. - Info any - - // READ-ONLY; The additional info type. - Type *string -} - -// ErrorContract - Common error response for all Azure Resource Manager APIs to return error details for failed operations. -// (This also follows the OData error response format.) -type ErrorContract struct { - // The error object. - Error *ErrorResponse -} - -// ErrorContractAutoGenerated - Describes the format of Error response. -type ErrorContractAutoGenerated struct { - // The error details. - Error *ErrorResponseDetails -} - -// ErrorDetail - The error detail. -type ErrorDetail struct { - // READ-ONLY; The error additional info. - AdditionalInfo []*ErrorAdditionalInfo - - // READ-ONLY; The error code. - Code *string - - // READ-ONLY; The error details. - Details []*ErrorDetail - - // READ-ONLY; The error message. - Message *string - - // READ-ONLY; The error target. - Target *string -} - -// ErrorDetailAutoGenerated - The error detail. -type ErrorDetailAutoGenerated struct { - // READ-ONLY; The error additional info. - AdditionalInfo []*ErrorAdditionalInfo - - // READ-ONLY; The error code. - Code *string - - // READ-ONLY; The error details. - Details []*ErrorDetailAutoGenerated - - // READ-ONLY; The error message. - Message *string - - // READ-ONLY; The error target. - Target *string -} - -// ErrorResponse - Describes the format of Error response. -type ErrorResponse struct { - // Error code - Code *string - - // Error message indicating why the operation failed. - Message *string -} - -// ErrorResponseAdditionalInfo - The resource management error additional info. -type ErrorResponseAdditionalInfo struct { - // READ-ONLY; The additional info. - Info any - - // READ-ONLY; The additional info type. - Type *string -} - -// ErrorResponseAutoGenerated - The error response. -type ErrorResponseAutoGenerated struct { - // READ-ONLY; The error code. - Code *string - - // READ-ONLY; The error message indicating why the operation failed. - Message *string -} - -// ErrorResponseAutoGenerated2 - Common error response for all Azure Resource Manager APIs to return error details for failed -// operations. (This also follows the OData error response format.). -type ErrorResponseAutoGenerated2 struct { - // The error object. - Error *ErrorDetailAutoGenerated -} - -// ErrorResponseCommonV2 - Common error response for all Azure Resource Manager APIs to return error details for failed operations. -// (This also follows the OData error response format.). -type ErrorResponseCommonV2 struct { - // The error object. - Error *ErrorDetail -} - -// ErrorResponseDetails - Common error response for all Azure Resource Manager APIs to return error details for failed operations. -// (This also follows the OData error response format.) -type ErrorResponseDetails struct { - // READ-ONLY; The error additional info. - AdditionalInfo []*ErrorResponseAdditionalInfo - - // READ-ONLY; The error code. - Code *string - - // READ-ONLY; The error details. - Details []*ErrorResponseDetails - - // READ-ONLY; The error message. - Message *string - - // READ-ONLY; The error target. - Target *string -} - -// EventCategoryCollection - A collection of event categories. Currently possible values are: Administrative, Security, ServiceHealth, -// Alert, Recommendation, Policy. -type EventCategoryCollection struct { - // REQUIRED; the list that includes the Azure event categories. - Value []*LocalizableString -} - -// EventData - The Azure event log entries are of type EventData -type EventData struct { - // READ-ONLY; The sender authorization information. - Authorization *SenderAuthorization - - // READ-ONLY; the email address of the user who has performed the operation, the UPN claim or SPN claim based on availability. - Caller *string - - // READ-ONLY; the event category. - Category *LocalizableString - - // READ-ONLY; key value pairs to identify ARM permissions. - Claims map[string]*string - - // READ-ONLY; the correlation Id, usually a GUID in the string format. The correlation Id is shared among the events that - // belong to the same uber operation. - CorrelationID *string - - // READ-ONLY; the description of the event. - Description *string - - // READ-ONLY; the event data Id. This is a unique identifier for an event. - EventDataID *string - - // READ-ONLY; the event name. This value should not be confused with OperationName. For practical purposes, OperationName - // might be more appealing to end users. - EventName *LocalizableString - - // READ-ONLY; the timestamp of when the event was generated by the Azure service processing the request corresponding the - // event. It in ISO 8601 format. - EventTimestamp *time.Time - - // READ-ONLY; the HTTP request info. Usually includes the 'clientRequestId', 'clientIpAddress' (IP address of the user who - // initiated the event) and 'method' (HTTP method e.g. PUT). - HTTPRequest *HTTPRequestInfo - - // READ-ONLY; the Id of this event as required by ARM for RBAC. It contains the EventDataID and a timestamp information. - ID *string - - // READ-ONLY; the event level - Level *EventLevel - - // READ-ONLY; It is usually a GUID shared among the events corresponding to single operation. This value should not be confused - // with EventName. - OperationID *string - - // READ-ONLY; the operation name. - OperationName *LocalizableString - - // READ-ONLY; the set of pairs (usually a Dictionary) that includes details about the event. - Properties map[string]*string - - // READ-ONLY; the resource group name of the impacted resource. - ResourceGroupName *string - - // READ-ONLY; the resource uri that uniquely identifies the resource that caused this event. - ResourceID *string - - // READ-ONLY; the resource provider name of the impacted resource. - ResourceProviderName *LocalizableString - - // READ-ONLY; the resource type - ResourceType *LocalizableString - - // READ-ONLY; a string describing the status of the operation. Some typical values are: Started, In progress, Succeeded, Failed, - // Resolved. - Status *LocalizableString - - // READ-ONLY; the event sub status. Most of the time, when included, this captures the HTTP status code of the REST call. - // Common values are: OK (HTTP Status Code: 200), Created (HTTP Status Code: 201), Accepted - // (HTTP Status Code: 202), No Content (HTTP Status Code: 204), Bad Request(HTTP Status Code: 400), Not Found (HTTP Status - // Code: 404), Conflict (HTTP Status Code: 409), Internal Server Error (HTTP Status - // Code: 500), Service Unavailable (HTTP Status Code:503), Gateway Timeout (HTTP Status Code: 504) - SubStatus *LocalizableString - - // READ-ONLY; the timestamp of when the event became available for querying via this API. It is in ISO 8601 format. This value - // should not be confused eventTimestamp. As there might be a delay between the occurrence - // time of the event, and the time that the event is submitted to the Azure logging infrastructure. - SubmissionTimestamp *time.Time - - // READ-ONLY; the Azure subscription Id usually a GUID. - SubscriptionID *string - - // READ-ONLY; the Azure tenant Id - TenantID *string -} - -// EventDataCollection - Represents collection of events. -type EventDataCollection struct { - // REQUIRED; this list that includes the Azure audit logs. - Value []*EventData - - // Provides the link to retrieve the next set of events. - NextLink *string -} - -type EventHubDataSource struct { - // Event Hub consumer group name - ConsumerGroup *string - - // A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the - // data collection rule. - Name *string - - // The stream to collect from EventHub - Stream *string -} - -type EventHubDestination struct { - // The resource ID of the event hub. - EventHubResourceID *string - - // A friendly name for the destination. This name should be unique across all destinations (regardless of type) within the - // data collection rule. - Name *string -} - -type EventHubDirectDestination struct { - // The resource ID of the event hub. - EventHubResourceID *string - - // A friendly name for the destination. This name should be unique across all destinations (regardless of type) within the - // data collection rule. - Name *string -} - -// EventHubReceiver - An Event hub receiver. -type EventHubReceiver struct { - // REQUIRED; The name of the specific Event Hub queue - EventHubName *string - - // REQUIRED; The Event Hub namespace - EventHubNameSpace *string - - // REQUIRED; The name of the Event hub receiver. Names must be unique across all receivers within an action group. - Name *string - - // REQUIRED; The Id for the subscription containing this event hub - SubscriptionID *string - - // The tenant Id for the subscription containing this event hub - TenantID *string - - // Indicates whether to use common alert schema. - UseCommonAlertSchema *bool -} - -// ExtensionDataSource - Definition of which data will be collected from a separate VM extension that integrates with the -// Azure Monitor Agent. Collected from either Windows and Linux machines, depending on which extension is -// defined. -type ExtensionDataSource struct { - // REQUIRED; The name of the VM extension. - ExtensionName *string - - // The extension settings. The format is specific for particular extension. - ExtensionSettings any - - // The list of data sources this extension needs data from. - InputDataSources []*string - - // A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the - // data collection rule. - Name *string - - // List of streams that this data source will be sent to. A stream indicates what schema will be used for this data and usually - // what table in Log Analytics the data will be sent to. - Streams []*KnownExtensionDataSourceStreams -} - -type FailoverConfigurationSpec struct { - // Active location where data flow will occur. - ActiveLocation *string - - // Locations that are configured for failover. - Locations []*LocationSpec -} - -// HTTPRequestInfo - The Http request info. -type HTTPRequestInfo struct { - // the client Ip Address - ClientIPAddress *string - - // the client request id. - ClientRequestID *string - - // the Http request method. - Method *string - - // the Uri. - URI *string -} - -// Identity for the resource. -type Identity struct { - // REQUIRED; Type of managed service identity. - Type *IdentityType - - // The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource - // ids in the form: - // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - UserAssignedIdentities map[string]*UserIdentityProperties - - // READ-ONLY; The principal ID of resource identity. - PrincipalID *string - - // READ-ONLY; The tenant ID of resource. - TenantID *string -} - -// IisLogsDataSource - Enables IIS logs to be collected by this data collection rule. -type IisLogsDataSource struct { - // REQUIRED; IIS streams - Streams []*string - - // Absolute paths file location - LogDirectories []*string - - // A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the - // data collection rule. - Name *string -} - -// Incident - An alert incident indicates the activation status of an alert rule. -type Incident struct { - // READ-ONLY; The time at which the incident was activated in ISO8601 format. - ActivatedTime *time.Time - - // READ-ONLY; A boolean to indicate whether the incident is active or resolved. - IsActive *bool - - // READ-ONLY; Incident name. - Name *string - - // READ-ONLY; The time at which the incident was resolved in ISO8601 format. If null, it means the incident is still active. - ResolvedTime *time.Time - - // READ-ONLY; Rule name that is associated with the incident. - RuleName *string -} - -// IncidentListResult - The List incidents operation response. -type IncidentListResult struct { - // the incident collection. - Value []*Incident -} - -// IngestionSettings - Settings for data ingestion -type IngestionSettings struct { - // READ-ONLY; The Azure resource Id of the default data collection endpoint for this workspace. - DataCollectionEndpointResourceID *string - - // READ-ONLY; The Azure resource Id of the default data collection rule for this workspace. - DataCollectionRuleResourceID *string -} - -// ItsmReceiver - An Itsm receiver. -type ItsmReceiver struct { - // REQUIRED; Unique identification of ITSM connection among multiple defined in above workspace. - ConnectionID *string - - // REQUIRED; The name of the Itsm receiver. Names must be unique across all receivers within an action group. - Name *string - - // REQUIRED; Region in which workspace resides. Supported values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' - Region *string - - // REQUIRED; JSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob - // as well. - TicketConfiguration *string - - // REQUIRED; OMS LA instance identifier. - WorkspaceID *string -} - -// LocalizableString - The localizable string class. -type LocalizableString struct { - // REQUIRED; the invariant value. - Value *string - - // the locale specific value. - LocalizedValue *string -} - -type LocationSpec struct { - // Name of location. - Location *string - - // The resource provisioning state in this location. - ProvisioningStatus *KnownLocationSpecProvisioningStatus -} - -// LocationThresholdRuleCondition - A rule condition based on a certain number of locations failing. -type LocationThresholdRuleCondition struct { - // REQUIRED; the number of locations that must fail to activate the alert. - FailedLocationCount *int32 - - // REQUIRED; specifies the type of condition. This can be one of three types: ManagementEventRuleCondition (occurrences of - // management events), LocationThresholdRuleCondition (based on the number of failures of a - // web test), and ThresholdRuleCondition (based on the threshold of a metric). - ODataType *string - - // the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource RuleDataSourceClassification - - // the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified - // then it must be between 5 minutes and 1 day. - WindowSize *string -} - -// GetRuleCondition implements the RuleConditionClassification interface for type LocationThresholdRuleCondition. -func (l *LocationThresholdRuleCondition) GetRuleCondition() *RuleCondition { - return &RuleCondition{ - DataSource: l.DataSource, - ODataType: l.ODataType, - } -} - -// LogAnalyticsDestination - Log Analytics destination. -type LogAnalyticsDestination struct { - // A friendly name for the destination. This name should be unique across all destinations (regardless of type) within the - // data collection rule. - Name *string - - // The resource ID of the Log Analytics workspace. - WorkspaceResourceID *string - - // READ-ONLY; The Customer ID of the Log Analytics workspace. - WorkspaceID *string -} - -// LogFileSettings - Settings for different log file formats -type LogFileSettings struct { - // Text settings - Text *LogFileSettingsText -} - -// LogFileSettingsText - Text settings -type LogFileSettingsText struct { - // REQUIRED; One of the supported timestamp formats - RecordStartTimestampFormat *KnownLogFileTextSettingsRecordStartTimestampFormat -} - -// LogFileTextSettings - Settings for text log files -type LogFileTextSettings struct { - // REQUIRED; One of the supported timestamp formats - RecordStartTimestampFormat *KnownLogFileTextSettingsRecordStartTimestampFormat -} - -// LogFilesDataSource - Definition of which custom log files will be collected by this data collection rule -type LogFilesDataSource struct { - // REQUIRED; File Patterns where the log files are located - FilePatterns []*string - - // REQUIRED; The data format of the log files - Format *KnownLogFilesDataSourceFormat - - // REQUIRED; List of streams that this data source will be sent to. A stream indicates what schema will be used for this data - // source - Streams []*string - - // A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the - // data collection rule. - Name *string - - // The log files specific settings. - Settings *LogFilesDataSourceSettings -} - -// LogFilesDataSourceSettings - The log files specific settings. -type LogFilesDataSourceSettings struct { - // Text settings - Text *LogFileSettingsText -} - -// LogProfileCollection - Represents a collection of log profiles. -type LogProfileCollection struct { - // REQUIRED; the values of the log profiles. - Value []*LogProfileResource -} - -// LogProfileProperties - The log profile properties. -type LogProfileProperties struct { - // REQUIRED; the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', - // 'Delete', and/or 'Action.' - Categories []*string - - // REQUIRED; List of regions for which Activity Log events should be stored or streamed. It is a comma separated list of valid - // ARM locations including the 'global' location. - Locations []*string - - // REQUIRED; the retention policy for the events in the log. - RetentionPolicy *RetentionPolicy - - // The service bus rule ID of the service bus namespace in which you would like to have Event Hubs created for streaming the - // Activity Log. The rule ID is of the format: '{service bus resource - // ID}/authorizationrules/{key name}'. - ServiceBusRuleID *string - - // the resource id of the storage account to which you would like to send the Activity Log. - StorageAccountID *string -} - -// LogProfileResource - The log profile resource. -type LogProfileResource struct { - // REQUIRED; Resource location - Location *string - - // REQUIRED; The log profile properties of the resource. - Properties *LogProfileProperties - - // Resource tags - Tags map[string]*string - - // READ-ONLY; Azure resource Id - ID *string - - // READ-ONLY; Azure resource name - Name *string - - // READ-ONLY; Azure resource type - Type *string -} - -// LogProfileResourcePatch - The log profile resource for patch operations. -type LogProfileResourcePatch struct { - // The log profile properties for an update operation. - Properties *LogProfileProperties - - // Resource tags - Tags map[string]*string -} - -// LogSettings - Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. -type LogSettings struct { - // REQUIRED; a value indicating whether this log is enabled. - Enabled *bool - - // Name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log - // categories for a resource, first perform a GET diagnostic settings operation. - Category *string - - // Name of a Diagnostic Log category group for a resource type this setting is applied to. To obtain the list of Diagnostic - // Log categories for a resource, first perform a GET diagnostic settings - // operation. - CategoryGroup *string - - // the retention policy for this log. - RetentionPolicy *RetentionPolicy -} - -// LogicAppReceiver - A logic app receiver. -type LogicAppReceiver struct { - // REQUIRED; The callback url where http request sent to. - CallbackURL *string - - // REQUIRED; The name of the logic app receiver. Names must be unique across all receivers within an action group. - Name *string - - // REQUIRED; The azure resource id of the logic app receiver. - ResourceID *string - - // Indicates whether to use common alert schema. - UseCommonAlertSchema *bool -} - -// LogsIngestionEndpointSpec - Definition of the endpoint used for ingesting logs. -type LogsIngestionEndpointSpec struct { - // READ-ONLY; The endpoint. This property is READ-ONLY. - Endpoint *string -} - -// ManagedServiceIdentity - Managed service identity (system assigned and/or user assigned identities) -type ManagedServiceIdentity struct { - // REQUIRED; Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). - Type *ManagedServiceIdentityType - - // The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM - // resource ids in the form: - // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - // The dictionary values can be empty objects ({}) in - // requests. - UserAssignedIdentities map[string]*UserAssignedIdentity - - // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned - // identity. - PrincipalID *string - - // READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. - TenantID *string -} - -// ManagementEventAggregationCondition - How the data that is collected should be combined over time. -type ManagementEventAggregationCondition struct { - // the condition operator. - Operator *ConditionOperator - - // The threshold value that activates the alert. - Threshold *float64 - - // the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified - // then it must be between 5 minutes and 1 day. - WindowSize *string -} - -// ManagementEventRuleCondition - A management event rule condition. -type ManagementEventRuleCondition struct { - // REQUIRED; specifies the type of condition. This can be one of three types: ManagementEventRuleCondition (occurrences of - // management events), LocationThresholdRuleCondition (based on the number of failures of a - // web test), and ThresholdRuleCondition (based on the threshold of a metric). - ODataType *string - - // How the data that is collected should be combined over time and when the alert is activated. Note that for management event - // alerts aggregation is optional – if it is not provided then any event will - // cause the alert to activate. - Aggregation *ManagementEventAggregationCondition - - // the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource RuleDataSourceClassification -} - -// GetRuleCondition implements the RuleConditionClassification interface for type ManagementEventRuleCondition. -func (m *ManagementEventRuleCondition) GetRuleCondition() *RuleCondition { - return &RuleCondition{ - DataSource: m.DataSource, - ODataType: m.ODataType, - } -} - -// Metadata about the resource -type Metadata struct { - // READ-ONLY; Azure offering managing this resource on-behalf-of customer. - ProvisionedBy *string - - // READ-ONLY; Resource Id of azure offering managing this resource on-behalf-of customer. - ProvisionedByResourceID *string -} - -// MetadataValue - Represents a metric metadata value. -type MetadataValue struct { - // the name of the metadata. - Name *LocalizableString - - // the value of the metadata. - Value *string -} - -// Metric - The result data of a query. -type Metric struct { - // REQUIRED; the metric Id. - ID *string - - // REQUIRED; the name and the display name of the metric, i.e. it is localizable string. - Name *LocalizableString - - // REQUIRED; the time series returned when a data query is performed. - Timeseries []*TimeSeriesElement - - // REQUIRED; the resource type of the metric resource. - Type *string - - // REQUIRED; The unit of the metric. - Unit *Unit - - // Detailed description of this metric. - DisplayDescription *string - - // 'Success' or the error details on query failures for this metric. - ErrorCode *string - - // Error message encountered querying this specific metric. - ErrorMessage *string -} - -// MetricAlertAction - An alert action. -type MetricAlertAction struct { - // the id of the action group to use. - ActionGroupID *string - - // This field allows specifying custom properties, which would be appended to the alert payload sent as input to the webhook. - WebHookProperties map[string]*string -} - -// MetricAlertCriteria - The rule criteria that defines the conditions of the alert rule. -type MetricAlertCriteria struct { - // REQUIRED; specifies the type of the alert criteria. - ODataType *Odatatype - - // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]any -} - -// GetMetricAlertCriteria implements the MetricAlertCriteriaClassification interface for type MetricAlertCriteria. -func (m *MetricAlertCriteria) GetMetricAlertCriteria() *MetricAlertCriteria { return m } - -// MetricAlertMultipleResourceMultipleMetricCriteria - Specifies the metric alert criteria for multiple resource that has -// multiple metric criteria. -type MetricAlertMultipleResourceMultipleMetricCriteria struct { - // REQUIRED; specifies the type of the alert criteria. - ODataType *Odatatype - - // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]any - - // the list of multiple metric criteria for this 'all of' operation. - AllOf []MultiMetricCriteriaClassification -} - -// GetMetricAlertCriteria implements the MetricAlertCriteriaClassification interface for type MetricAlertMultipleResourceMultipleMetricCriteria. -func (m *MetricAlertMultipleResourceMultipleMetricCriteria) GetMetricAlertCriteria() *MetricAlertCriteria { - return &MetricAlertCriteria{ - AdditionalProperties: m.AdditionalProperties, - ODataType: m.ODataType, - } -} - -// MetricAlertProperties - An alert rule. -type MetricAlertProperties struct { - // REQUIRED; defines the specific alert criteria information. - Criteria MetricAlertCriteriaClassification - - // REQUIRED; the flag that indicates whether the metric alert is enabled. - Enabled *bool - - // REQUIRED; how often the metric alert is evaluated represented in ISO 8601 duration format. - EvaluationFrequency *string - - // REQUIRED; the list of resource id's that this metric alert is scoped to. - Scopes []*string - - // REQUIRED; Alert severity {0, 1, 2, 3, 4} - Severity *int32 - - // REQUIRED; the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. - WindowSize *string - - // the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions []*MetricAlertAction - - // the flag that indicates whether the alert should be auto resolved or not. The default is true. - AutoMitigate *bool - - // the description of the metric alert that will be included in the alert email. - Description *string - - // the region of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, - // resource group, or more than one resource. - TargetResourceRegion *string - - // the resource type of the target resource(s) on which the alert is created/updated. Mandatory if the scope contains a subscription, - // resource group, or more than one resource. - TargetResourceType *string - - // READ-ONLY; the value indicating whether this alert rule is migrated. - IsMigrated *bool - - // READ-ONLY; Last time the rule was updated in ISO8601 format. - LastUpdatedTime *time.Time -} - -// MetricAlertPropertiesPatch - An alert rule properties for patch. -type MetricAlertPropertiesPatch struct { - // the array of actions that are performed when the alert rule becomes active, and when an alert condition is resolved. - Actions []*MetricAlertAction - - // the flag that indicates whether the alert should be auto resolved or not. The default is true. - AutoMitigate *bool - - // defines the specific alert criteria information. - Criteria MetricAlertCriteriaClassification - - // the description of the metric alert that will be included in the alert email. - Description *string - - // the flag that indicates whether the metric alert is enabled. - Enabled *bool - - // how often the metric alert is evaluated represented in ISO 8601 duration format. - EvaluationFrequency *string - - // the list of resource id's that this metric alert is scoped to. - Scopes []*string - - // Alert severity {0, 1, 2, 3, 4} - Severity *int32 - - // the region of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. - TargetResourceRegion *string - - // the resource type of the target resource(s) on which the alert is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. - TargetResourceType *string - - // the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. - WindowSize *string - - // READ-ONLY; the value indicating whether this alert rule is migrated. - IsMigrated *bool - - // READ-ONLY; Last time the rule was updated in ISO8601 format. - LastUpdatedTime *time.Time -} - -// MetricAlertResource - The metric alert resource. -type MetricAlertResource struct { - // REQUIRED; Resource location - Location *string - - // REQUIRED; The alert rule properties of the resource. - Properties *MetricAlertProperties - - // Resource tags - Tags map[string]*string - - // READ-ONLY; Azure resource Id - ID *string - - // READ-ONLY; Azure resource name - Name *string - - // READ-ONLY; Azure resource type - Type *string -} - -// MetricAlertResourceCollection - Represents a collection of alert rule resources. -type MetricAlertResourceCollection struct { - // the values for the alert rule resources. - Value []*MetricAlertResource -} - -// MetricAlertResourcePatch - The metric alert resource for patch operations. -type MetricAlertResourcePatch struct { - // The alert rule properties of the resource. - Properties *MetricAlertPropertiesPatch - - // Resource tags - Tags map[string]*string -} - -// MetricAlertSingleResourceMultipleMetricCriteria - Specifies the metric alert criteria for a single resource that has multiple -// metric criteria. -type MetricAlertSingleResourceMultipleMetricCriteria struct { - // REQUIRED; specifies the type of the alert criteria. - ODataType *Odatatype - - // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]any - - // The list of metric criteria for this 'all of' operation. - AllOf []*MetricCriteria -} - -// GetMetricAlertCriteria implements the MetricAlertCriteriaClassification interface for type MetricAlertSingleResourceMultipleMetricCriteria. -func (m *MetricAlertSingleResourceMultipleMetricCriteria) GetMetricAlertCriteria() *MetricAlertCriteria { - return &MetricAlertCriteria{ - AdditionalProperties: m.AdditionalProperties, - ODataType: m.ODataType, - } -} - -// MetricAlertStatus - An alert status. -type MetricAlertStatus struct { - // The alert rule arm id. - ID *string - - // The status name. - Name *string - - // The alert status properties of the metric alert status. - Properties *MetricAlertStatusProperties - - // The extended resource type name. - Type *string -} - -// MetricAlertStatusCollection - Represents a collection of alert rule resources. -type MetricAlertStatusCollection struct { - // the values for the alert rule resources. - Value []*MetricAlertStatus -} - -// MetricAlertStatusProperties - An alert status properties. -type MetricAlertStatusProperties struct { - // An object describing the type of the dimensions. - Dimensions map[string]*string - - // status value - Status *string - - // UTC time when the status was checked. - Timestamp *time.Time -} - -// MetricAvailability - Metric availability specifies the time grain (aggregation interval or frequency) and the retention -// period for that time grain. -type MetricAvailability struct { - // the retention period for the metric at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. - Retention *string - - // the time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. - TimeGrain *string -} - -// MetricBaselinesProperties - The response to a metric baselines query. -type MetricBaselinesProperties struct { - // REQUIRED; The baseline for each time series that was queried. - Baselines []*TimeSeriesBaseline - - // REQUIRED; The interval (window size) for which the metric data was returned in. This may be adjusted in the future and - // returned back from what was originally requested. This is not present if a metadata request - // was made. - Interval *string - - // REQUIRED; The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by - // '/'. This may be adjusted in the future and returned back from what was originally - // requested. - Timespan *string - - // The namespace of the metrics been queried. - Namespace *string -} - -// MetricBaselinesResponse - A list of metric baselines. -type MetricBaselinesResponse struct { - // The list of metric baselines. - Value []*SingleMetricBaseline -} - -// MetricCriteria - Criterion to filter metrics. -type MetricCriteria struct { - // REQUIRED; Specifies the type of threshold criteria - CriterionType *CriterionType - - // REQUIRED; Name of the metric. - MetricName *string - - // REQUIRED; Name of the criteria. - Name *string - - // REQUIRED; the criteria operator. - Operator *Operator - - // REQUIRED; the criteria threshold value that activates the alert. - Threshold *float64 - - // REQUIRED; the criteria time aggregation types. - TimeAggregation *AggregationTypeEnum - - // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]any - - // List of dimension conditions. - Dimensions []*MetricDimension - - // Namespace of the metric. - MetricNamespace *string - - // Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool -} - -// GetMultiMetricCriteria implements the MultiMetricCriteriaClassification interface for type MetricCriteria. -func (m *MetricCriteria) GetMultiMetricCriteria() *MultiMetricCriteria { - return &MultiMetricCriteria{ - AdditionalProperties: m.AdditionalProperties, - CriterionType: m.CriterionType, - Dimensions: m.Dimensions, - MetricName: m.MetricName, - MetricNamespace: m.MetricNamespace, - Name: m.Name, - SkipMetricValidation: m.SkipMetricValidation, - TimeAggregation: m.TimeAggregation, - } -} - -// MetricDefinition - Metric definition class specifies the metadata for a metric. -type MetricDefinition struct { - // Custom category name for this metric. - Category *string - - // the name and the display name of the dimension, i.e. it is a localizable string. - Dimensions []*LocalizableString - - // Detailed description of this metric. - DisplayDescription *string - - // the resource identifier of the metric definition. - ID *string - - // Flag to indicate whether the dimension is required. - IsDimensionRequired *bool - - // the collection of what aggregation intervals are available to be queried. - MetricAvailabilities []*MetricAvailability - - // The class of the metric. - MetricClass *MetricClass - - // the name and the display name of the metric, i.e. it is a localizable string. - Name *LocalizableString - - // the namespace the metric belongs to. - Namespace *string - - // the primary aggregation type value defining how to use the values for display. - PrimaryAggregationType *AggregationType - - // the resource identifier of the resource that emitted the metric. - ResourceID *string - - // the collection of what aggregation types are supported. - SupportedAggregationTypes []*AggregationType - - // the unit of the metric. - Unit *MetricUnit -} - -// MetricDefinitionCollection - Represents collection of metric definitions. -type MetricDefinitionCollection struct { - // REQUIRED; the values for the metric definitions. - Value []*MetricDefinition -} - -// MetricDimension - Specifies a metric dimension. -type MetricDimension struct { - // REQUIRED; Name of the dimension. - Name *string - - // REQUIRED; the dimension operator. Only 'Include' and 'Exclude' are supported - Operator *string - - // REQUIRED; list of dimension values. - Values []*string -} - -// MetricNamespace - Metric namespace class specifies the metadata for a metric namespace. -type MetricNamespace struct { - // Kind of namespace - Classification *NamespaceClassification - - // The ID of the metric namespace. - ID *string - - // The escaped name of the namespace. - Name *string - - // Properties which include the fully qualified namespace name. - Properties *MetricNamespaceName - - // The type of the namespace. - Type *string -} - -// MetricNamespaceCollection - Represents collection of metric namespaces. -type MetricNamespaceCollection struct { - // REQUIRED; The values for the metric namespaces. - Value []*MetricNamespace -} - -// MetricNamespaceName - The fully qualified metric namespace name. -type MetricNamespaceName struct { - // The metric namespace name. - MetricNamespaceName *string -} - -// MetricSettings - Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. -type MetricSettings struct { - // REQUIRED; a value indicating whether this category is enabled. - Enabled *bool - - // Name of a Diagnostic Metric category for a resource type this setting is applied to. To obtain the list of Diagnostic metric - // categories for a resource, first perform a GET diagnostic settings - // operation. - Category *string - - // the retention policy for this category. - RetentionPolicy *RetentionPolicy - - // the timegrain of the metric in ISO8601 format. - TimeGrain *string -} - -// MetricSingleDimension - The metric dimension name and value. -type MetricSingleDimension struct { - // REQUIRED; Name of the dimension. - Name *string - - // REQUIRED; Value of the dimension. - Value *string -} - -// MetricTrigger - The trigger that results in a scaling action. -type MetricTrigger struct { - // REQUIRED; the name of the metric that defines what the rule monitors. - MetricName *string - - // REQUIRED; the resource identifier of the resource the rule monitors. - MetricResourceURI *string - - // REQUIRED; the operator that is used to compare the metric data and the threshold. - Operator *ComparisonOperationType - - // REQUIRED; the metric statistic type. How the metrics from multiple instances are combined. - Statistic *MetricStatisticType - - // REQUIRED; the threshold of the metric that triggers the scale action. - Threshold *float64 - - // REQUIRED; time aggregation type. How the data that is collected should be combined over time. The default value is Average. - TimeAggregation *TimeAggregationType - - // REQUIRED; the granularity of metrics the rule monitors. Must be one of the predefined values returned from metric definitions - // for the metric. Must be between 12 hours and 1 minute. - TimeGrain *string - - // REQUIRED; the range of time in which instance data is collected. This value must be greater than the delay in metric collection, - // which can vary from resource-to-resource. Must be between 12 hours and 5 minutes. - TimeWindow *string - - // List of dimension conditions. For example: [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment","Operator":"Equals","Values":["default"]}]. - Dimensions []*ScaleRuleMetricDimension - - // a value indicating whether metric should divide per instance. - DividePerInstance *bool - - // the namespace of the metric that defines what the rule monitors. - MetricNamespace *string - - // the location of the resource the rule monitors. - MetricResourceLocation *string -} - -// MetricValue - Represents a metric value. -type MetricValue struct { - // REQUIRED; the timestamp for the metric value in ISO 8601 format. - TimeStamp *time.Time - - // the average value in the time range. - Average *float64 - - // the number of samples in the time range. Can be used to determine the number of values that contributed to the average - // value. - Count *float64 - - // the greatest value in the time range. - Maximum *float64 - - // the least value in the time range. - Minimum *float64 - - // the sum of all of the values in the time range. - Total *float64 -} - -// Metrics - Information about metrics for the workspace -type Metrics struct { - // READ-ONLY; An internal identifier for the metrics container. Only to be used by the system - InternalID *string - - // READ-ONLY; The Prometheus query endpoint for the workspace - PrometheusQueryEndpoint *string -} - -// MetricsIngestionEndpointSpec - Definition of the endpoint used for ingesting metrics. -type MetricsIngestionEndpointSpec struct { - // READ-ONLY; The endpoint. This property is READ-ONLY. - Endpoint *string -} - -// MonitoringAccountDestination - Monitoring account destination. -type MonitoringAccountDestination struct { - // The resource ID of the monitoring account. - AccountResourceID *string - - // A friendly name for the destination. This name should be unique across all destinations (regardless of type) within the - // data collection rule. - Name *string - - // READ-ONLY; The immutable ID of the account. - AccountID *string -} - -// MultiMetricCriteria - The types of conditions for a multi resource alert. -type MultiMetricCriteria struct { - // REQUIRED; Specifies the type of threshold criteria - CriterionType *CriterionType - - // REQUIRED; Name of the metric. - MetricName *string - - // REQUIRED; Name of the criteria. - Name *string - - // REQUIRED; the criteria time aggregation types. - TimeAggregation *AggregationTypeEnum - - // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]any - - // List of dimension conditions. - Dimensions []*MetricDimension - - // Namespace of the metric. - MetricNamespace *string - - // Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be skipped. - SkipMetricValidation *bool -} - -// GetMultiMetricCriteria implements the MultiMetricCriteriaClassification interface for type MultiMetricCriteria. -func (m *MultiMetricCriteria) GetMultiMetricCriteria() *MultiMetricCriteria { return m } - -// NetworkRuleSet - Definition of the network rules. -type NetworkRuleSet struct { - // The configuration to set whether network access from public internet to the endpoints are allowed. - PublicNetworkAccess *KnownPublicNetworkAccessOptions -} - -// NotificationRequestBody - The request body which contain contact detail metadata -type NotificationRequestBody struct { - // REQUIRED; The value of the supported alert type. Supported alert type values are: servicehealth, metricstaticthreshold, - // metricsdynamicthreshold, logalertv2, smartalert, webtestalert, logalertv1numresult, - // logalertv1metricmeasurement, resourcehealth, activitylog, actualcostbudget, forecastedbudget - AlertType *string - - // The list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are - // supported. - ArmRoleReceivers []*ArmRoleReceiver - - // The list of AutomationRunbook receivers that are part of this action group. - AutomationRunbookReceivers []*AutomationRunbookReceiver - - // The list of AzureAppPush receivers that are part of this action group. - AzureAppPushReceivers []*AzureAppPushReceiver - - // The list of azure function receivers that are part of this action group. - AzureFunctionReceivers []*AzureFunctionReceiver - - // The list of email receivers that are part of this action group. - EmailReceivers []*EmailReceiver - - // The list of event hub receivers that are part of this action group. - EventHubReceivers []*EventHubReceiver - - // The list of ITSM receivers that are part of this action group. - ItsmReceivers []*ItsmReceiver - - // The list of logic app receivers that are part of this action group. - LogicAppReceivers []*LogicAppReceiver - - // The list of SMS receivers that are part of this action group. - SmsReceivers []*SmsReceiver - - // The list of voice receivers that are part of this action group. - VoiceReceivers []*VoiceReceiver - - // The list of webhook receivers that are part of this action group. - WebhookReceivers []*WebhookReceiver -} - -// Operation - Microsoft Insights API operation definition. -type Operation struct { - // Display metadata associated with the operation. - Display *OperationDisplay - - // Operation name: {provider}/{resource}/{operation} - Name *string -} - -// OperationAutoGenerated - Details of a REST API operation, returned from the Resource Provider Operations API -type OperationAutoGenerated struct { - // Localized display information for this particular operation. - Display *OperationDisplayAutoGenerated - - // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - ActionType *ActionType - - // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane - // operations. - IsDataAction *bool - - // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", - // "Microsoft.Compute/virtualMachines/capture/action" - Name *string - - // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default - // value is "user,system" - Origin *Origin -} - -// OperationDisplay - Display metadata associated with the operation. -type OperationDisplay struct { - // Operation type: Read, write, delete, etc. - Operation *string - - // Service provider: Microsoft.Insights - Provider *string - - // Resource on which the operation is performed: AlertRules, Autoscale, etc. - Resource *string -} - -// OperationDisplayAutoGenerated - Localized display information for this particular operation. -type OperationDisplayAutoGenerated struct { - // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. - Description *string - - // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual - // Machine", "Restart Virtual Machine". - Operation *string - - // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft - // Compute". - Provider *string - - // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job - // Schedule Collections". - Resource *string -} - -// OperationListResult - Result of the request to list Microsoft.Insights operations. It contains a list of operations and -// a URL link to get the next set of results. -type OperationListResult struct { - // URL to get the next set of operation list results if there are any. - NextLink *string - - // List of operations supported by the Microsoft.Insights provider. - Value []*Operation -} - -// OperationListResultAutoGenerated - A list of REST API operations supported by an Azure Resource Provider. It contains an -// URL link to get the next set of results. -type OperationListResultAutoGenerated struct { - // READ-ONLY; URL to get the next set of operation list results (if there are any). - NextLink *string - - // READ-ONLY; List of operations supported by the resource provider - Value []*OperationAutoGenerated -} - -// OperationStatus - The status of operation. -type OperationStatus struct { - // End time of the job in standard ISO8601 format. - EndTime *time.Time - - // The error detail of the operation if any. - Error *ErrorDetail - - // The operation Id. - ID *string - - // The operation name. - Name *string - - // Start time of the job in standard ISO8601 format. - StartTime *time.Time - - // The status of the operation. - Status *string -} - -// PerfCounterDataSource - Definition of which performance counters will be collected and how they will be collected by this -// data collection rule. Collected from both Windows and Linux machines where the counter is present. -type PerfCounterDataSource struct { - // A list of specifier names of the performance counters you want to collect. Use a wildcard (*) to collect a counter for - // all instances. To get a list of performance counters on Windows, run the command - // 'typeperf'. - CounterSpecifiers []*string - - // A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the - // data collection rule. - Name *string - - // The number of seconds between consecutive counter measurements (samples). - SamplingFrequencyInSeconds *int32 - - // List of streams that this data source will be sent to. A stream indicates what schema will be used for this data and usually - // what table in Log Analytics the data will be sent to. - Streams []*KnownPerfCounterDataSourceStreams -} - -// PlatformTelemetryDataSource - Definition of platform telemetry data source configuration -type PlatformTelemetryDataSource struct { - // REQUIRED; List of platform telemetry streams to collect - Streams []*string - - // A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the - // data collection rule. - Name *string -} - -// PredictiveAutoscalePolicy - The parameters for enabling predictive autoscale. -type PredictiveAutoscalePolicy struct { - // REQUIRED; the predictive autoscale mode - ScaleMode *PredictiveAutoscalePolicyScaleMode - - // the amount of time to specify by which instances are launched in advance. It must be between 1 minute and 60 minutes in - // ISO 8601 format. - ScaleLookAheadTime *string -} - -// PredictiveResponse - The response to a metrics query. -type PredictiveResponse struct { - // the value of the collection. - Data []*PredictiveValue - - // The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back - // from what was originally requested. This is not present if a metadata request - // was made. - Interval *string - - // The metrics being queried - MetricName *string - - // resource of the predictive metric. - TargetResourceID *string - - // The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by '/'. This - // may be adjusted in the future and returned back from what was originally - // requested. - Timespan *string -} - -// PredictiveValue - Represents a predictive metric value in the given bucket. -type PredictiveValue struct { - // REQUIRED; the timestamp for the metric value in ISO 8601 format. - TimeStamp *time.Time - - // REQUIRED; Predictive value in this time bucket. - Value *float64 -} - -// PrivateEndpoint - The Private Endpoint resource. -type PrivateEndpoint struct { - // READ-ONLY; The ARM identifier for Private Endpoint - ID *string -} - -// PrivateEndpointConnection - The Private Endpoint Connection resource. -type PrivateEndpointConnection struct { - // Resource properties. - Properties *PrivateEndpointConnectionProperties - - // 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; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// PrivateEndpointConnectionListResult - List of private endpoint connection associated with the specified storage account -type PrivateEndpointConnectionListResult struct { - // Array of private endpoint connections - Value []*PrivateEndpointConnection -} - -// PrivateEndpointConnectionProperties - Properties of the PrivateEndpointConnectProperties. -type PrivateEndpointConnectionProperties struct { - // REQUIRED; A collection of information about the state of the connection between service consumer and provider. - PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState - - // The resource of private end point. - PrivateEndpoint *PrivateEndpoint - - // READ-ONLY; The provisioning state of the private endpoint connection resource. - ProvisioningState *PrivateEndpointConnectionProvisioningState -} - -// PrivateLinkResource - A private link resource -type PrivateLinkResource struct { - // Resource properties. - Properties *PrivateLinkResourceProperties - - // 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; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// PrivateLinkResourceListResult - A list of private link resources -type PrivateLinkResourceListResult struct { - // Array of private link resources - Value []*PrivateLinkResource -} - -// PrivateLinkResourceProperties - Properties of a private link resource. -type PrivateLinkResourceProperties struct { - // The private link resource Private link DNS zone name. - RequiredZoneNames []*string - - // READ-ONLY; The private link resource group id. - GroupID *string - - // READ-ONLY; The private link resource required member names. - RequiredMembers []*string -} - -type PrivateLinkScopedResource struct { - // The resourceId of the Azure Monitor Private Link Scope Scoped Resource through which this DCE is associated with a Azure - // Monitor Private Link Scope. - ResourceID *string - - // The immutableId of the Azure Monitor Private Link Scope Resource to which the association is. - ScopeID *string -} - -// PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer -// and provider. -type PrivateLinkServiceConnectionState struct { - // A message indicating if changes on the service provider require any updates on the consumer. - ActionsRequired *string - - // The reason for approval/rejection of the connection. - Description *string - - // Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. - Status *PrivateEndpointServiceConnectionStatus -} - -// PrometheusForwarderDataSource - Definition of Prometheus metrics forwarding configuration. -type PrometheusForwarderDataSource struct { - // The list of label inclusion filters in the form of label "name-value" pairs. Currently only one label is supported: 'microsoftmetricsinclude_label'. - // Label values are matched case-insensitively. - LabelIncludeFilter map[string]*string - - // A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the - // data collection rule. - Name *string - - // List of streams that this data source will be sent to. - Streams []*KnownPrometheusForwarderDataSourceStreams -} - -// ProxyResource - An azure resource object -type ProxyResource struct { - // READ-ONLY; Azure resource Id - ID *string - - // READ-ONLY; Azure resource name - Name *string - - // READ-ONLY; Azure resource type - Type *string -} - -// ProxyResourceAutoGenerated - The resource model definition for a Azure Resource Manager proxy resource. It will not have -// tags and a location -type ProxyResourceAutoGenerated 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 - Name *string - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// Recurrence - The repeating times at which this profile begins. This element is not used if the FixedDate element is used. -type Recurrence struct { - // REQUIRED; the recurrence frequency. How often the schedule profile should take effect. This value must be Week, meaning - // each week will have the same set of profiles. For example, to set a daily schedule, set - // schedule to every day of the week. The frequency property specifies that the schedule is repeated weekly. - Frequency *RecurrenceFrequency - - // REQUIRED; the scheduling constraints for when the profile begins. - Schedule *RecurrentSchedule -} - -// RecurrentSchedule - The scheduling constraints for when the profile begins. -type RecurrentSchedule struct { - // REQUIRED; the collection of days that the profile takes effect on. Possible values are Sunday through Saturday. - Days []*string - - // REQUIRED; A collection of hours that the profile takes effect on. Values supported are 0 to 23 on the 24-hour clock (AM/PM - // times are not supported). - Hours []*int32 - - // REQUIRED; A collection of minutes at which the profile takes effect at. - Minutes []*int32 - - // REQUIRED; the timezone for the hours of the profile. Some examples of valid time zones are: Dateline Standard Time, UTC-11, - // Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time (Mexico), Pacific - // Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central America Standard - // Time, Central Standard Time, Central Standard Time (Mexico), Canada Central - // Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela Standard Time, Paraguay - // Standard Time, Atlantic Standard Time, Central Brazilian Standard Time, SA - // Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America Standard Time, Argentina - // Standard Time, SA Eastern Standard Time, Greenland Standard Time, Montevideo - // Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, Cape Verde Standard Time, - // Morocco Standard Time, UTC, GMT Standard Time, Greenwich Standard Time, W. - // Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European Standard Time, W. Central Africa - // Standard Time, Namibia Standard Time, Jordan Standard Time, GTB Standard - // Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard Time, South Africa Standard - // Time, FLE Standard Time, Turkey Standard Time, Israel Standard Time, - // Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus Standard Time, Russian - // Standard Time, E. Africa Standard Time, Iran Standard Time, Arabian Standard - // Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, Caucasus Standard - // Time, Afghanistan Standard Time, West Asia Standard Time, Ekaterinburg Standard - // Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, Central Asia Standard - // Time, Bangladesh Standard Time, N. Central Asia Standard Time, Myanmar Standard - // Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard Time, Singapore Standard - // Time, W. Australia Standard Time, Taipei Standard Time, Ulaanbaatar - // Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard Time, AUS Central - // Standard Time, E. Australia Standard Time, AUS Eastern Standard Time, West - // Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia Time Zone 10, Central - // Pacific Standard Time, Russia Time Zone 11, New Zealand Standard Time, - // UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line Islands Standard Time - TimeZone *string -} - -// Resource - The autoscale setting resource. -type Resource struct { - // REQUIRED; Resource location - Location *string - - // Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this - // resource (across resource groups). A maximum of 15 tags can be provided for a - // resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. - Tags map[string]*string - - // READ-ONLY; Azure resource Id - ID *string - - // READ-ONLY; Azure resource name - Name *string - - // READ-ONLY; The system metadata related to the response. - SystemData *SystemData - - // READ-ONLY; Azure resource type - Type *string -} - -// ResourceAutoGenerated - An azure resource object -type ResourceAutoGenerated struct { - // REQUIRED; Resource location - Location *string - - // Resource tags - Tags map[string]*string - - // READ-ONLY; Azure resource Id - ID *string - - // READ-ONLY; Azure resource name - Name *string - - // READ-ONLY; Azure resource type - Type *string -} - -// ResourceAutoGenerated2 - An azure resource object -type ResourceAutoGenerated2 struct { - // REQUIRED; Resource location - Location *string - - // Resource tags - Tags map[string]*string - - // READ-ONLY; Azure resource Id - ID *string - - // READ-ONLY; Azure resource name - Name *string - - // READ-ONLY; Azure resource type - Type *string -} - -// ResourceAutoGenerated3 - Common fields that are returned in the response for all Azure Resource Manager resources -type ResourceAutoGenerated3 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 - Name *string - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// ResourceAutoGenerated4 - An azure resource object -type ResourceAutoGenerated4 struct { - // REQUIRED; Resource location - Location *string - - // Resource tags - Tags map[string]*string - - // READ-ONLY; Azure resource Id - ID *string - - // READ-ONLY; Azure resource name - Name *string - - // READ-ONLY; Azure resource type - Type *string -} - -// ResourceAutoGenerated5 - Common fields that are returned in the response for all Azure Resource Manager resources -type ResourceAutoGenerated5 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 - 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 -} - -// ResourceForUpdate - Definition of ARM tracked top level resource properties for update operation. -type ResourceForUpdate struct { - // Managed Service Identity. - Identity *ResourceForUpdateIdentity - - // Resource tags. - Tags map[string]*string -} - -// ResourceForUpdateIdentity - Managed Service Identity. -type ResourceForUpdateIdentity struct { - // REQUIRED; Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). - Type *ManagedServiceIdentityType - - // The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM - // resource ids in the form: - // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - // The dictionary values can be empty objects ({}) in - // requests. - UserAssignedIdentities map[string]*UserAssignedIdentity - - // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned - // identity. - PrincipalID *string - - // READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. - TenantID *string -} - -// Response - The response to a metrics query. -type Response struct { - // REQUIRED; The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by - // '/'. This may be adjusted in the future and returned back from what was originally - // requested. - Timespan *string - - // REQUIRED; the value of the collection. - Value []*Metric - - // The integer value representing the relative cost of the query. - Cost *int32 - - // The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back - // from what was originally requested. This is not present if a metadata request - // was made. - Interval *string - - // The namespace of the metrics being queried - Namespace *string - - // The region of the resource being queried for metrics. - Resourceregion *string -} - -// ResponseWithError - An error response from the API. -type ResponseWithError struct { - // REQUIRED; Error information. - Error *Error -} - -// RetentionPolicy - Specifies the retention policy for the log. -type RetentionPolicy struct { - // REQUIRED; the number of days for the retention in days. A value of 0 will retain the events indefinitely. - Days *int32 - - // REQUIRED; a value indicating whether the retention policy is enabled. - Enabled *bool -} - -// RuleAction - The action that is performed when the alert rule becomes active, and when an alert condition is resolved. -type RuleAction struct { - // REQUIRED; specifies the type of the action. There are two types of actions: RuleEmailAction and RuleWebhookAction. - ODataType *string -} - -// GetRuleAction implements the RuleActionClassification interface for type RuleAction. -func (r *RuleAction) GetRuleAction() *RuleAction { return r } - -// RuleCondition - The condition that results in the alert rule being activated. -type RuleCondition struct { - // REQUIRED; specifies the type of condition. This can be one of three types: ManagementEventRuleCondition (occurrences of - // management events), LocationThresholdRuleCondition (based on the number of failures of a - // web test), and ThresholdRuleCondition (based on the threshold of a metric). - ODataType *string - - // the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource RuleDataSourceClassification -} - -// GetRuleCondition implements the RuleConditionClassification interface for type RuleCondition. -func (r *RuleCondition) GetRuleCondition() *RuleCondition { return r } - -// RuleDataSource - The resource from which the rule collects its data. -type RuleDataSource struct { - // REQUIRED; specifies the type of data source. There are two types of rule data sources: RuleMetricDataSource and RuleManagementEventDataSource - ODataType *string - - // the legacy resource identifier of the resource the rule monitors. NOTE: this property cannot be updated for an existing - // rule. - LegacyResourceID *string - - // the namespace of the metric. - MetricNamespace *string - - // the location of the resource. - ResourceLocation *string - - // the resource identifier of the resource the rule monitors. NOTE: this property cannot be updated for an existing rule. - ResourceURI *string -} - -// GetRuleDataSource implements the RuleDataSourceClassification interface for type RuleDataSource. -func (r *RuleDataSource) GetRuleDataSource() *RuleDataSource { return r } - -// RuleEmailAction - Specifies the action to send email when the rule condition is evaluated. The discriminator is always -// RuleEmailAction in this case. -type RuleEmailAction struct { - // REQUIRED; specifies the type of the action. There are two types of actions: RuleEmailAction and RuleWebhookAction. - ODataType *string - - // the list of administrator's custom email addresses to notify of the activation of the alert. - CustomEmails []*string - - // Whether the administrators (service and co-administrators) of the service should be notified when the alert is activated. - SendToServiceOwners *bool -} - -// GetRuleAction implements the RuleActionClassification interface for type RuleEmailAction. -func (r *RuleEmailAction) GetRuleAction() *RuleAction { - return &RuleAction{ - ODataType: r.ODataType, - } -} - -// RuleManagementEventClaimsDataSource - The claims for a rule management event data source. -type RuleManagementEventClaimsDataSource struct { - // the email address. - EmailAddress *string -} - -// RuleManagementEventDataSource - A rule management event data source. The discriminator fields is always RuleManagementEventDataSource -// in this case. -type RuleManagementEventDataSource struct { - // REQUIRED; specifies the type of data source. There are two types of rule data sources: RuleMetricDataSource and RuleManagementEventDataSource - ODataType *string - - // the claims. - Claims *RuleManagementEventClaimsDataSource - - // the event name. - EventName *string - - // the event source. - EventSource *string - - // the legacy resource identifier of the resource the rule monitors. NOTE: this property cannot be updated for an existing - // rule. - LegacyResourceID *string - - // the level. - Level *string - - // the namespace of the metric. - MetricNamespace *string - - // The name of the operation that should be checked for. If no name is provided, any operation will match. - OperationName *string - - // the resource group name. - ResourceGroupName *string - - // the location of the resource. - ResourceLocation *string - - // the resource provider name. - ResourceProviderName *string - - // the resource identifier of the resource the rule monitors. NOTE: this property cannot be updated for an existing rule. - ResourceURI *string - - // The status of the operation that should be checked for. If no status is provided, any status will match. - Status *string - - // the substatus. - SubStatus *string -} - -// GetRuleDataSource implements the RuleDataSourceClassification interface for type RuleManagementEventDataSource. -func (r *RuleManagementEventDataSource) GetRuleDataSource() *RuleDataSource { - return &RuleDataSource{ - LegacyResourceID: r.LegacyResourceID, - MetricNamespace: r.MetricNamespace, - ODataType: r.ODataType, - ResourceLocation: r.ResourceLocation, - ResourceURI: r.ResourceURI, - } -} - -// RuleMetricDataSource - A rule metric data source. The discriminator value is always RuleMetricDataSource in this case. -type RuleMetricDataSource struct { - // REQUIRED; specifies the type of data source. There are two types of rule data sources: RuleMetricDataSource and RuleManagementEventDataSource - ODataType *string - - // the legacy resource identifier of the resource the rule monitors. NOTE: this property cannot be updated for an existing - // rule. - LegacyResourceID *string - - // the name of the metric that defines what the rule monitors. - MetricName *string - - // the namespace of the metric. - MetricNamespace *string - - // the location of the resource. - ResourceLocation *string - - // the resource identifier of the resource the rule monitors. NOTE: this property cannot be updated for an existing rule. - ResourceURI *string -} - -// GetRuleDataSource implements the RuleDataSourceClassification interface for type RuleMetricDataSource. -func (r *RuleMetricDataSource) GetRuleDataSource() *RuleDataSource { - return &RuleDataSource{ - LegacyResourceID: r.LegacyResourceID, - MetricNamespace: r.MetricNamespace, - ODataType: r.ODataType, - ResourceLocation: r.ResourceLocation, - ResourceURI: r.ResourceURI, - } -} - -// RuleResolveConfiguration - TBD. Relevant only for rules of the kind LogAlert. -type RuleResolveConfiguration struct { - // The flag that indicates whether or not to auto resolve a fired alert. - AutoResolved *bool - - // The duration a rule must evaluate as healthy before the fired alert is automatically resolved represented in ISO 8601 duration - // format. - TimeToResolve *string -} - -// RuleWebhookAction - Specifies the action to post to service when the rule condition is evaluated. The discriminator is -// always RuleWebhookAction in this case. -type RuleWebhookAction struct { - // REQUIRED; specifies the type of the action. There are two types of actions: RuleEmailAction and RuleWebhookAction. - ODataType *string - - // the dictionary of custom properties to include with the post operation. These data are appended to the webhook payload. - Properties map[string]*string - - // the service uri to Post the notification when the alert activates or resolves. - ServiceURI *string -} - -// GetRuleAction implements the RuleActionClassification interface for type RuleWebhookAction. -func (r *RuleWebhookAction) GetRuleAction() *RuleAction { - return &RuleAction{ - ODataType: r.ODataType, - } -} - -// ScaleAction - The parameters for the scaling action. -type ScaleAction struct { - // REQUIRED; the amount of time to wait since the last scaling action before this action occurs. It must be between 1 week - // and 1 minute in ISO 8601 format. - Cooldown *string - - // REQUIRED; the scale direction. Whether the scaling action increases or decreases the number of instances. - Direction *ScaleDirection - - // REQUIRED; the type of action that should occur when the scale rule fires. - Type *ScaleType - - // the number of instances that are involved in the scaling action. This value must be 1 or greater. The default value is - // 1. - Value *string -} - -// ScaleCapacity - The number of instances that can be used during this profile. -type ScaleCapacity struct { - // REQUIRED; the number of instances that will be set if metrics are not available for evaluation. The default is only used - // if the current instance count is lower than the default. - Default *string - - // REQUIRED; the maximum number of instances for the resource. The actual maximum number of instances is limited by the cores - // that are available in the subscription. - Maximum *string - - // REQUIRED; the minimum number of instances for the resource. - Minimum *string -} - -// ScaleRule - A rule that provide the triggers and parameters for the scaling action. -type ScaleRule struct { - // REQUIRED; the trigger that results in a scaling action. - MetricTrigger *MetricTrigger - - // REQUIRED; the parameters for the scaling action. - ScaleAction *ScaleAction -} - -// ScaleRuleMetricDimension - Specifies an auto scale rule metric dimension. -type ScaleRuleMetricDimension struct { - // REQUIRED; Name of the dimension. - DimensionName *string - - // REQUIRED; the dimension operator. Only 'Equals' and 'NotEquals' are supported. 'Equals' being equal to any of the values. - // 'NotEquals' being not equal to all of the values - Operator *ScaleRuleMetricDimensionOperationType - - // REQUIRED; list of dimension values. For example: ["App1","App2"]. - Values []*string -} - -// ScheduledQueryRuleCriteria - The rule criteria that defines the conditions of the scheduled query rule. -type ScheduledQueryRuleCriteria struct { - // A list of conditions to evaluate against the specified scopes - AllOf []*Condition -} - -// ScheduledQueryRuleProperties - scheduled query rule Definition -type ScheduledQueryRuleProperties struct { - // Actions to invoke when the alert fires. - Actions *Actions - - // The flag that indicates whether the alert should be automatically resolved or not. The default is true. Relevant only for - // rules of the kind LogAlert. - AutoMitigate *bool + // The flag that indicates whether the alert should be automatically resolved or not. The default is true. Relevant only for + // rules of kinds LogAlert and SimpleLogAlert. + AutoMitigate *bool // The flag which indicates whether this scheduled query rule should be stored in the customer's storage. The default is false. // Relevant only for rules of the kind LogAlert. @@ -3773,416 +589,117 @@ type ScheduledQueryRuleProperties struct { // Mute actions for the chosen period of time (in ISO 8601 duration format) after the alert is fired. Relevant only for rules // of the kind LogAlert. - MuteActionsDuration *string - - // If specified then overrides the query time range (default is WindowSize*NumberOfEvaluationPeriods). Relevant only for rules - // of the kind LogAlert. - OverrideQueryTimeRange *string - - // This determines if traffic is allowed over public network. By default it is enabled. - PublicNetworkAccess *PublicNetworkAccess - - // Defines the configuration for resolving fired alerts. Relevant only for rules of the kind LogAlert. - RuleResolveConfiguration *RuleResolveConfiguration - - // The list of resource id's that this scheduled query rule is scoped to. - Scopes []*string - - // Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. Relevant and required only for rules - // of the kind LogAlert. - Severity *AlertSeverity - - // The flag which indicates whether the provided query should be validated or not. The default is false. Relevant only for - // rules of the kind LogAlert. - SkipQueryValidation *bool - - // List of resource type of the target resource(s) on which the alert is created/updated. For example if the scope is a resource - // group and targetResourceTypes is Microsoft.Compute/virtualMachines, then a - // different alert will be fired for each virtual machine in the resource group which meet the alert criteria. Relevant only - // for rules of the kind LogAlert - TargetResourceTypes []*string - - // The period of time (in ISO 8601 duration format) on which the Alert query will be executed (bin size). Relevant and required - // only for rules of the kind LogAlert. - WindowSize *string - - // READ-ONLY; The api-version used when creating this alert rule - CreatedWithAPIVersion *string - - // READ-ONLY; True if alert rule is legacy Log Analytic rule - IsLegacyLogAnalyticsRule *bool - - // READ-ONLY; The flag which indicates whether this scheduled query rule has been configured to be stored in the customer's - // storage. The default is false. - IsWorkspaceAlertsStorageConfigured *bool -} - -// ScheduledQueryRuleResource - The scheduled query rule resource. -type ScheduledQueryRuleResource struct { - // REQUIRED; The geo-location where the resource lives - Location *string - - // REQUIRED; The rule properties of the resource. - Properties *ScheduledQueryRuleProperties - - // The identity of the resource. - Identity *Identity - - // Indicates the type of scheduled query rule. The default is LogAlert. - Kind *Kind - - // Resource tags. - Tags map[string]*string - - // READ-ONLY; The etag field is not required. If it is provided in the response body, it must also be provided as a header - // per the normal etag convention. Entity tags are used for comparing two or more entities - // from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match - // (section 14.26), and If-Range (section 14.27) header fields. - Etag *string - - // 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; SystemData of ScheduledQueryRule. - SystemData *SystemData - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// ScheduledQueryRuleResourceCollection - Represents a collection of scheduled query rule resources. -type ScheduledQueryRuleResourceCollection struct { - // The values for the scheduled query rule resources. - Value []*ScheduledQueryRuleResource - - // READ-ONLY; Provides the link to retrieve the next set of elements. - NextLink *string -} - -// ScheduledQueryRuleResourcePatch - The scheduled query rule resource for patch operations. -type ScheduledQueryRuleResourcePatch struct { - // The identity of the resource. - Identity *Identity - - // The scheduled query rule properties of the resource. - Properties *ScheduledQueryRuleProperties - - // Resource tags - Tags map[string]*string -} - -// ScopedResource - A private link scoped resource -type ScopedResource struct { - // Resource properties. - Properties *ScopedResourceProperties - - // 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; System data - SystemData *SystemData - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// ScopedResourceListResult - A list of scoped resources in a private link scope. -type ScopedResourceListResult struct { - // READ-ONLY; Link to retrieve next page of results. - NextLink *string - - // READ-ONLY; Array of results. - Value []*ScopedResource -} - -// ScopedResourceProperties - Properties of a private link scoped resource. -type ScopedResourceProperties struct { - // The resource id of the scoped Azure monitor resource. - LinkedResourceID *string - - // READ-ONLY; State of the private endpoint connection. - ProvisioningState *string -} - -// SenderAuthorization - the authorization used by the user who has performed the operation that led to this event. This captures -// the RBAC properties of the event. These usually include the 'action', 'role' and the 'scope' -type SenderAuthorization struct { - // the permissible actions. For instance: microsoft.support/supporttickets/write - Action *string - - // the role of the user. For instance: Subscription Admin - Role *string - - // the scope. - Scope *string -} - -// SingleBaseline - The baseline values for a single sensitivity value. -type SingleBaseline struct { - // REQUIRED; The high thresholds of the baseline. - HighThresholds []*float64 - - // REQUIRED; The low thresholds of the baseline. - LowThresholds []*float64 - - // REQUIRED; the sensitivity of the baseline. - Sensitivity *BaselineSensitivity -} - -// SingleMetricBaseline - The baseline results of a single metric. -type SingleMetricBaseline struct { - // REQUIRED; The metric baseline Id. - ID *string - - // REQUIRED; The name of the metric for which the baselines were retrieved. - Name *string - - // REQUIRED; The metric baseline properties of the metric. - Properties *MetricBaselinesProperties - - // REQUIRED; The resource type of the metric baseline resource. - Type *string -} - -// SmsReceiver - An SMS receiver. -type SmsReceiver struct { - // REQUIRED; The country code of the SMS receiver. - CountryCode *string - - // REQUIRED; The name of the SMS receiver. Names must be unique across all receivers within an action group. - Name *string - - // REQUIRED; The phone number of the SMS receiver. - PhoneNumber *string - - // READ-ONLY; The status of the receiver. - Status *ReceiverStatus -} - -// SmsReceiverAutoGenerated - An SMS receiver. -type SmsReceiverAutoGenerated struct { - // REQUIRED; The country code of the SMS receiver. - CountryCode *string - - // REQUIRED; The name of the SMS receiver. Names must be unique across all receivers within a tenant action group. - Name *string - - // REQUIRED; The phone number of the SMS receiver. - PhoneNumber *string - - // READ-ONLY; The status of the receiver. - Status *ReceiverStatus -} - -type StorageBlobDestination struct { - // The container name of the Storage Blob. - ContainerName *string - - // A friendly name for the destination. This name should be unique across all destinations (regardless of type) within the - // data collection rule. - Name *string - - // The resource ID of the storage account. - StorageAccountResourceID *string -} - -type StorageTableDestination struct { - // A friendly name for the destination. This name should be unique across all destinations (regardless of type) within the - // data collection rule. - Name *string - - // The resource ID of the storage account. - StorageAccountResourceID *string - - // The name of the Storage Table. - TableName *string -} - -// StreamDeclaration - Declaration of a custom stream. -type StreamDeclaration struct { - // List of columns used by data in this stream. - Columns []*ColumnDefinition -} - -// SubscriptionScopeMetric - The result data of a query. -type SubscriptionScopeMetric struct { - // REQUIRED; the metric Id. - ID *string - - // REQUIRED; the name and the display name of the metric, i.e. it is localizable string. - Name *LocalizableString + MuteActionsDuration *string - // REQUIRED; the time series returned when a data query is performed. - Timeseries []*TimeSeriesElement + // If specified then overrides the query time range (default is WindowSize*NumberOfEvaluationPeriods). Relevant only for rules + // of the kind LogAlert. + OverrideQueryTimeRange *string - // REQUIRED; the resource type of the metric resource. - Type *string + // Defines the configuration for resolving fired alerts. Relevant only for rules of kinds LogAlert and SimpleLogAlert. + ResolveConfiguration *RuleResolveConfiguration - // REQUIRED; The unit of the metric. - Unit *MetricUnit + // The list of resource id's that this scheduled query rule is scoped to. + Scopes []*string - // Detailed description of this metric. - DisplayDescription *string + // Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. Relevant and required only for rules + // of the kind LogAlert. + Severity *AlertSeverity - // 'Success' or the error details on query failures for this metric. - ErrorCode *string + // The flag which indicates whether the provided query should be validated or not. The default is false. Relevant only for + // rules of the kind LogAlert. + SkipQueryValidation *bool - // Error message encountered querying this specific metric. - ErrorMessage *string -} + // List of resource type of the target resource(s) on which the alert is created/updated. For example if the scope is a resource + // group and targetResourceTypes is Microsoft.Compute/virtualMachines, then a + // different alert will be fired for each virtual machine in the resource group which meet the alert criteria. Relevant only + // for rules of the kind LogAlert + TargetResourceTypes []*string -// SubscriptionScopeMetricDefinition - Metric definition class specifies the metadata for a metric. -type SubscriptionScopeMetricDefinition struct { - // Custom category name for this metric. - Category *string + // The period of time (in ISO 8601 duration format) on which the Alert query will be executed (bin size). Relevant and required + // only for rules of the kind LogAlert. + WindowSize *string - // the name and the display name of the dimension, i.e. it is a localizable string. - Dimensions []*LocalizableString + // READ-ONLY; The api-version used when creating this alert rule + CreatedWithAPIVersion *string - // Detailed description of this metric. - DisplayDescription *string + // READ-ONLY; True if alert rule is legacy Log Analytic rule + IsLegacyLogAnalyticsRule *bool - // the resource identifier of the metric definition. - ID *string + // READ-ONLY; The flag which indicates whether this scheduled query rule has been configured to be stored in the customer's + // storage. The default is false. + IsWorkspaceAlertsStorageConfigured *bool +} - // Flag to indicate whether the dimension is required. - IsDimensionRequired *bool +// ScheduledQueryRuleResource - The scheduled query rule resource. +type ScheduledQueryRuleResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string - // the collection of what aggregation intervals are available to be queried. - MetricAvailabilities []*MetricAvailability + // REQUIRED; The rule properties of the resource. + Properties *ScheduledQueryRuleProperties - // The class of the metric. - MetricClass *MetricClass + // The identity of the resource. + Identity *Identity - // the name and the display name of the metric, i.e. it is a localizable string. - Name *LocalizableString + // Indicates the type of scheduled query rule. The default is LogAlert. + Kind *Kind - // the namespace the metric belongs to. - Namespace *string + // Resource tags. + Tags map[string]*string - // the primary aggregation type value defining how to use the values for display. - PrimaryAggregationType *MetricAggregationType + // READ-ONLY; The etag field is not required. If it is provided in the response body, it must also be provided as a header + // per the normal etag convention. Entity tags are used for comparing two or more entities + // from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match + // (section 14.26), and If-Range (section 14.27) header fields. + Etag *string - // the resource identifier of the resource that emitted the metric. - ResourceID *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string - // the collection of what aggregation types are supported. - SupportedAggregationTypes []*MetricAggregationType + // READ-ONLY; The name of the resource + Name *string - // the unit of the metric. - Unit *MetricUnit -} + // READ-ONLY; SystemData of ScheduledQueryRule. + SystemData *SystemData -// SubscriptionScopeMetricDefinitionCollection - Represents collection of metric definitions. -type SubscriptionScopeMetricDefinitionCollection struct { - // REQUIRED; The values for the metric definitions. - Value []*SubscriptionScopeMetricDefinition + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } -// SubscriptionScopeMetricResponse - The response to a subscription scope metrics query. -type SubscriptionScopeMetricResponse struct { - // REQUIRED; The timespan for which the data was retrieved. Its value consists of two datetimes concatenated, separated by - // '/'. This may be adjusted in the future and returned back from what was originally - // requested. - Timespan *string - - // REQUIRED; the value of the collection. - Value []*SubscriptionScopeMetric - - // The integer value representing the relative cost of the query. - Cost *int32 +// ScheduledQueryRuleResourceCollection - Represents a collection of scheduled query rule resources. +type ScheduledQueryRuleResourceCollection struct { + // The values for the scheduled query rule resources. + Value []*ScheduledQueryRuleResource - // The interval (window size) for which the metric data was returned in. This may be adjusted in the future and returned back - // from what was originally requested. This is not present if a metadata request - // was made. - Interval *string + // READ-ONLY; Provides the link to retrieve the next set of elements. + NextLink *string +} - // The namespace of the metrics being queried - Namespace *string +// ScheduledQueryRuleResourcePatch - The scheduled query rule resource for patch operations. +type ScheduledQueryRuleResourcePatch struct { + // The identity of the resource. + Identity *Identity - // The region of the resource being queried for metrics. - Resourceregion *string -} + // The scheduled query rule properties of the resource. + Properties *ScheduledQueryRuleProperties -// SubscriptionScopeMetricsRequestBodyParameters - Query parameters can also be specified in the body, specifying the same -// parameter in both the body and query parameters will result in an error. -type SubscriptionScopeMetricsRequestBodyParameters struct { - // The list of aggregation types (comma separated) to retrieve. - Aggregation *string - - // When set to true, if the timespan passed in is not supported by this metric, the API will return the result using the closest - // supported timespan. When set to false, an error is returned for invalid - // timespan parameters. Defaults to false. - AutoAdjustTimegrain *bool - - // The $filter is used to reduce the set of metric data returned. - // Example: - // Metric contains metadata A, B and C. - // - Return all time series of C where A = a1 and B = b1 or b2 - // $filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘’ - // - Invalid variant: - // $filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘’ or B = ‘b2’ - // This is invalid because the logical or operator cannot separate two different metadata names. - // - Return all time series where A = a1, B = b1 and C = c1: - // $filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’ - // - Return all time series where A = a1 - // $filter=A eq ‘a1’ and B eq ‘’ and C eq ‘’. - Filter *string - - // The interval (i.e. timegrain) of the query. - Interval *string - - // The names of the metrics (comma separated) to retrieve. - MetricNames *string - - // Metric namespace where the metrics you want reside. - MetricNamespace *string - - // The aggregation to use for sorting results and the direction of the sort. Only one order can be specified. Examples: sum - // asc. - OrderBy *string - - // Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details. - ResultType *MetricResultType - - // Dimension name(s) to rollup results by. For example if you only want to see metric values with a filter like 'City eq Seattle - // or City eq Tacoma' but don't want to see separate values for each city, - // you can specify 'RollUpBy=City' to see the results for Seattle and Tacoma rolled up into one timeseries. - RollUpBy *string - - // The timespan of the query. It is a string with the following format 'startDateTimeISO/endDateTimeISO'. - Timespan *time.Time - - // The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10. - Top *int32 - - // When set to false, invalid filter parameter values will be ignored. When set to true, an error is returned for invalid - // filter parameters. Defaults to true. - ValidateDimensions *bool + // Resource tags + Tags map[string]*string } -// SyslogDataSource - Definition of which syslog data will be collected and how it will be collected. Only collected from -// Linux machines. -type SyslogDataSource struct { - // The list of facility names. - FacilityNames []*KnownSyslogDataSourceFacilityNames - - // The log levels to collect. - LogLevels []*KnownSyslogDataSourceLogLevels +// SmsReceiver - An SMS receiver. +type SmsReceiver struct { + // REQUIRED; The country code of the SMS receiver. + CountryCode *string - // A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the - // data collection rule. + // REQUIRED; The name of the SMS receiver. Names must be unique across all receivers within an action group. Name *string - // List of streams that this data source will be sent to. A stream indicates what schema will be used for this data and usually - // what table in Log Analytics the data will be sent to. - Streams []*KnownSyslogDataSourceStreams + // REQUIRED; The phone number of the SMS receiver. + PhoneNumber *string + + // READ-ONLY; The status of the receiver. + Status *ReceiverStatus } // SystemData - Metadata pertaining to creation and last modification of the resource. @@ -4206,68 +723,6 @@ type SystemData struct { LastModifiedByType *CreatedByType } -// TagsResource - A container holding only the Tags for a resource, allowing the user to update the tags on a PrivateLinkScope -// instance. -type TagsResource struct { - // Resource tags - Tags map[string]*string -} - -// TenantActionGroup - A tenant action group. -type TenantActionGroup struct { - // REQUIRED; Indicates whether this tenant action group is enabled. If a tenant action group is not enabled, then none of - // its receivers will receive communications. - Enabled *bool - - // REQUIRED; The short name of the action group. This will be used in SMS messages. - GroupShortName *string - - // The list of AzureAppPush receivers that are part of this tenant action group. - AzureAppPushReceivers []*AzureAppPushReceiverAutoGenerated - - // The list of email receivers that are part of this tenant action group. - EmailReceivers []*EmailReceiverAutoGenerated - - // The list of SMS receivers that are part of this tenant action group. - SmsReceivers []*SmsReceiverAutoGenerated - - // The list of voice receivers that are part of this tenant action group. - VoiceReceivers []*VoiceReceiverAutoGenerated - - // The list of webhook receivers that are part of this tenant action group. - WebhookReceivers []*WebhookReceiverAutoGenerated -} - -// TenantActionGroupList - A list of tenant action groups. -type TenantActionGroupList struct { - // Provides the link to retrieve the next set of elements. - NextLink *string - - // The list of tenant action groups. - Value []*TenantActionGroupResource -} - -// TenantActionGroupResource - A tenant action group resource. -type TenantActionGroupResource struct { - // REQUIRED; Resource location - Location *string - - // The tenant action groups properties of the resource. - Properties *TenantActionGroup - - // Resource tags - Tags map[string]*string - - // READ-ONLY; Azure resource Id - ID *string - - // READ-ONLY; Azure resource name - Name *string - - // READ-ONLY; Azure resource type - Type *string -} - // TestNotificationDetailsResponse - The details of the test notification results. type TestNotificationDetailsResponse struct { // REQUIRED; The overall state @@ -4286,146 +741,6 @@ type TestNotificationDetailsResponse struct { CreatedTime *string } -// ThresholdRuleCondition - A rule condition based on a metric crossing a threshold. -type ThresholdRuleCondition struct { - // REQUIRED; specifies the type of condition. This can be one of three types: ManagementEventRuleCondition (occurrences of - // management events), LocationThresholdRuleCondition (based on the number of failures of a - // web test), and ThresholdRuleCondition (based on the threshold of a metric). - ODataType *string - - // REQUIRED; the operator used to compare the data and the threshold. - Operator *ConditionOperator - - // REQUIRED; the threshold value that activates the alert. - Threshold *float64 - - // the resource from which the rule collects its data. For this type dataSource will always be of type RuleMetricDataSource. - DataSource RuleDataSourceClassification - - // the time aggregation operator. How the data that are collected should be combined over time. The default value is the PrimaryAggregationType - // of the Metric. - TimeAggregation *TimeAggregationOperator - - // the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. If specified - // then it must be between 5 minutes and 1 day. - WindowSize *string -} - -// GetRuleCondition implements the RuleConditionClassification interface for type ThresholdRuleCondition. -func (t *ThresholdRuleCondition) GetRuleCondition() *RuleCondition { - return &RuleCondition{ - DataSource: t.DataSource, - ODataType: t.ODataType, - } -} - -// TimeSeriesBaseline - The baseline values for a single time series. -type TimeSeriesBaseline struct { - // REQUIRED; The aggregation type of the metric. - Aggregation *string - - // REQUIRED; The baseline values for each sensitivity. - Data []*SingleBaseline - - // REQUIRED; The list of timestamps of the baselines. - Timestamps []*time.Time - - // The dimensions of this time series. - Dimensions []*MetricSingleDimension - - // The baseline metadata values. - MetadataValues []*BaselineMetadata -} - -// TimeSeriesElement - A time series result type. The discriminator value is always TimeSeries in this case. -type TimeSeriesElement struct { - // An array of data points representing the metric values. This is only returned if a result type of data is specified. - Data []*MetricValue - - // the metadata values returned if $filter was specified in the call. - Metadatavalues []*MetadataValue -} - -// TimeWindow - A specific date-time for the profile. -type TimeWindow struct { - // REQUIRED; the end time for the profile in ISO 8601 format. - End *time.Time - - // REQUIRED; the start time for the profile in ISO 8601 format. - Start *time.Time - - // the timezone of the start and end times for the profile. Some examples of valid time zones are: Dateline Standard Time, - // UTC-11, Hawaiian Standard Time, Alaskan Standard Time, Pacific Standard Time - // (Mexico), Pacific Standard Time, US Mountain Standard Time, Mountain Standard Time (Mexico), Mountain Standard Time, Central - // America Standard Time, Central Standard Time, Central Standard Time - // (Mexico), Canada Central Standard Time, SA Pacific Standard Time, Eastern Standard Time, US Eastern Standard Time, Venezuela - // Standard Time, Paraguay Standard Time, Atlantic Standard Time, Central - // Brazilian Standard Time, SA Western Standard Time, Pacific SA Standard Time, Newfoundland Standard Time, E. South America - // Standard Time, Argentina Standard Time, SA Eastern Standard Time, Greenland - // Standard Time, Montevideo Standard Time, Bahia Standard Time, UTC-02, Mid-Atlantic Standard Time, Azores Standard Time, - // Cape Verde Standard Time, Morocco Standard Time, UTC, GMT Standard Time, - // Greenwich Standard Time, W. Europe Standard Time, Central Europe Standard Time, Romance Standard Time, Central European - // Standard Time, W. Central Africa Standard Time, Namibia Standard Time, Jordan - // Standard Time, GTB Standard Time, Middle East Standard Time, Egypt Standard Time, Syria Standard Time, E. Europe Standard - // Time, South Africa Standard Time, FLE Standard Time, Turkey Standard Time, - // Israel Standard Time, Kaliningrad Standard Time, Libya Standard Time, Arabic Standard Time, Arab Standard Time, Belarus - // Standard Time, Russian Standard Time, E. Africa Standard Time, Iran Standard - // Time, Arabian Standard Time, Azerbaijan Standard Time, Russia Time Zone 3, Mauritius Standard Time, Georgian Standard Time, - // Caucasus Standard Time, Afghanistan Standard Time, West Asia Standard Time, - // Ekaterinburg Standard Time, Pakistan Standard Time, India Standard Time, Sri Lanka Standard Time, Nepal Standard Time, - // Central Asia Standard Time, Bangladesh Standard Time, N. Central Asia Standard - // Time, Myanmar Standard Time, SE Asia Standard Time, North Asia Standard Time, China Standard Time, North Asia East Standard - // Time, Singapore Standard Time, W. Australia Standard Time, Taipei Standard - // Time, Ulaanbaatar Standard Time, Tokyo Standard Time, Korea Standard Time, Yakutsk Standard Time, Cen. Australia Standard - // Time, AUS Central Standard Time, E. Australia Standard Time, AUS Eastern - // Standard Time, West Pacific Standard Time, Tasmania Standard Time, Magadan Standard Time, Vladivostok Standard Time, Russia - // Time Zone 10, Central Pacific Standard Time, Russia Time Zone 11, New - // Zealand Standard Time, UTC+12, Fiji Standard Time, Kamchatka Standard Time, Tonga Standard Time, Samoa Standard Time, Line - // Islands Standard Time - TimeZone *string -} - -// TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' -// and a 'location' -type TrackedResource struct { - // REQUIRED; The geo-location where the resource lives - Location *string - - // Resource tags. - Tags map[string]*string - - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string - - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// TrackedResourceAutoGenerated - The resource model definition for an Azure Resource Manager tracked top level resource which -// has 'tags' and a 'location' -type TrackedResourceAutoGenerated struct { - // REQUIRED; The geo-location where the resource lives - Location *string - - // Resource tags. - Tags map[string]*string - - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string - - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - // UserAssignedIdentity - User assigned identity properties type UserAssignedIdentity struct { // READ-ONLY; The client ID of the assigned identity. @@ -4444,38 +759,6 @@ type UserIdentityProperties struct { PrincipalID *string } -// VMInsightsOnboardingStatus - VM Insights onboarding status for a resource. -type VMInsightsOnboardingStatus struct { - // Resource properties. - Properties *VMInsightsOnboardingStatusProperties - - // READ-ONLY; Azure resource Id - ID *string - - // READ-ONLY; Azure resource name - Name *string - - // READ-ONLY; Azure resource type - Type *string -} - -// VMInsightsOnboardingStatusProperties - Resource properties. -type VMInsightsOnboardingStatusProperties struct { - // REQUIRED; The status of VM Insights data from the resource. When reported as present the data array will contain information - // about the data containers to which data for the specified resource is being routed. - DataStatus *DataStatus - - // REQUIRED; The onboarding status for the resource. Note that, a higher level scope, e.g., resource group or subscription, - // is considered onboarded if at least one resource under it is onboarded. - OnboardingStatus *OnboardingStatus - - // REQUIRED; Azure Resource Manager identifier of the resource whose onboarding status is being represented. - ResourceID *string - - // Containers that currently store VM Insights data for the specified resource. - Data []*DataContainer -} - // VoiceReceiver - A voice receiver. type VoiceReceiver struct { // REQUIRED; The country code of the voice receiver. @@ -4488,27 +771,6 @@ type VoiceReceiver struct { PhoneNumber *string } -// VoiceReceiverAutoGenerated - A voice receiver. -type VoiceReceiverAutoGenerated struct { - // REQUIRED; The country code of the voice receiver. - CountryCode *string - - // REQUIRED; The name of the voice receiver. Names must be unique across all receivers within a tenant action group. - Name *string - - // REQUIRED; The phone number of the voice receiver. - PhoneNumber *string -} - -// WebhookNotification - Webhook notification of an autoscale event. -type WebhookNotification struct { - // a property bag of settings. This value can be empty. - Properties map[string]*string - - // the service address to receive the notification. - ServiceURI *string -} - // WebhookReceiver - A webhook receiver. type WebhookReceiver struct { // REQUIRED; The name of the webhook receiver. Names must be unique across all receivers within an action group. @@ -4520,29 +782,8 @@ type WebhookReceiver struct { // Indicates the identifier uri for aad auth. IdentifierURI *string - // Indicates the webhook app object Id for aad auth. - ObjectID *string - - // Indicates the tenant id for aad auth. - TenantID *string - - // Indicates whether or not use AAD authentication. - UseAADAuth *bool - - // Indicates whether to use common alert schema. - UseCommonAlertSchema *bool -} - -// WebhookReceiverAutoGenerated - A webhook receiver. -type WebhookReceiverAutoGenerated struct { - // REQUIRED; The name of the webhook receiver. Names must be unique across all receivers within a tenant action group. - Name *string - - // REQUIRED; The URI where webhooks should be sent. - ServiceURI *string - - // Indicates the identifier uri for aad auth. - IdentifierURI *string + // The principal id of the managed identity. The value can be "None", "SystemAssigned" + ManagedIdentity *string // Indicates the webhook app object Id for aad auth. ObjectID *string @@ -4556,72 +797,3 @@ type WebhookReceiverAutoGenerated struct { // Indicates whether to use common alert schema. UseCommonAlertSchema *bool } - -// WebtestLocationAvailabilityCriteria - Specifies the metric alert rule criteria for a web test resource. -type WebtestLocationAvailabilityCriteria struct { - // REQUIRED; The Application Insights resource Id. - ComponentID *string - - // REQUIRED; The number of failed locations. - FailedLocationCount *float32 - - // REQUIRED; specifies the type of the alert criteria. - ODataType *Odatatype - - // REQUIRED; The Application Insights web test Id. - WebTestID *string - - // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]any -} - -// GetMetricAlertCriteria implements the MetricAlertCriteriaClassification interface for type WebtestLocationAvailabilityCriteria. -func (w *WebtestLocationAvailabilityCriteria) GetMetricAlertCriteria() *MetricAlertCriteria { - return &MetricAlertCriteria{ - AdditionalProperties: w.AdditionalProperties, - ODataType: w.ODataType, - } -} - -// WindowsEventLogDataSource - Definition of which Windows Event Log events will be collected and how they will be collected. -// Only collected from Windows machines. -type WindowsEventLogDataSource struct { - // A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the - // data collection rule. - Name *string - - // List of streams that this data source will be sent to. A stream indicates what schema will be used for this data and usually - // what table in Log Analytics the data will be sent to. - Streams []*KnownWindowsEventLogDataSourceStreams - - // A list of Windows Event Log queries in XPATH format. - XPathQueries []*string -} - -// WindowsFirewallLogsDataSource - Enables Firewall logs to be collected by this data collection rule. -type WindowsFirewallLogsDataSource struct { - // REQUIRED; Firewall logs streams - Streams []*string - - // A friendly name for the data source. This name should be unique across all data sources (regardless of type) within the - // data collection rule. - Name *string -} - -// WorkspaceInfo - Information about a Log Analytics Workspace. -type WorkspaceInfo struct { - // REQUIRED; Azure Resource Manager identifier of the Log Analytics Workspace. - ID *string - - // REQUIRED; Location of the Log Analytics workspace. - Location *string - - // REQUIRED; Resource properties. - Properties *WorkspaceInfoProperties -} - -// WorkspaceInfoProperties - Resource properties. -type WorkspaceInfoProperties struct { - // REQUIRED; Log Analytics workspace identifier. - CustomerID *string -} diff --git a/sdk/resourcemanager/monitor/armmonitor/models_serde.go b/sdk/resourcemanager/monitor/armmonitor/models_serde.go index 2f4c598b5226..31cb6439bc68 100644 --- a/sdk/resourcemanager/monitor/armmonitor/models_serde.go +++ b/sdk/resourcemanager/monitor/armmonitor/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. @@ -13,79 +10,8 @@ import ( "fmt" "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" - "time" ) -// MarshalJSON implements the json.Marshaller interface for type AccessModeSettings. -func (a AccessModeSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "exclusions", a.Exclusions) - populate(objectMap, "ingestionAccessMode", a.IngestionAccessMode) - populate(objectMap, "queryAccessMode", a.QueryAccessMode) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AccessModeSettings. -func (a *AccessModeSettings) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "exclusions": - err = unpopulate(val, "Exclusions", &a.Exclusions) - delete(rawMsg, key) - case "ingestionAccessMode": - err = unpopulate(val, "IngestionAccessMode", &a.IngestionAccessMode) - delete(rawMsg, key) - case "queryAccessMode": - err = unpopulate(val, "QueryAccessMode", &a.QueryAccessMode) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AccessModeSettingsExclusion. -func (a AccessModeSettingsExclusion) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "ingestionAccessMode", a.IngestionAccessMode) - populate(objectMap, "privateEndpointConnectionName", a.PrivateEndpointConnectionName) - populate(objectMap, "queryAccessMode", a.QueryAccessMode) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AccessModeSettingsExclusion. -func (a *AccessModeSettingsExclusion) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "ingestionAccessMode": - err = unpopulate(val, "IngestionAccessMode", &a.IngestionAccessMode) - delete(rawMsg, key) - case "privateEndpointConnectionName": - err = unpopulate(val, "PrivateEndpointConnectionName", &a.PrivateEndpointConnectionName) - delete(rawMsg, key) - case "queryAccessMode": - err = unpopulate(val, "QueryAccessMode", &a.QueryAccessMode) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type ActionDetail. func (a ActionDetail) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -144,6 +70,7 @@ func (a ActionGroup) MarshalJSON() ([]byte, error) { populate(objectMap, "enabled", a.Enabled) populate(objectMap, "eventHubReceivers", a.EventHubReceivers) populate(objectMap, "groupShortName", a.GroupShortName) + populate(objectMap, "incidentReceivers", a.IncidentReceivers) populate(objectMap, "itsmReceivers", a.ItsmReceivers) populate(objectMap, "logicAppReceivers", a.LogicAppReceivers) populate(objectMap, "smsReceivers", a.SmsReceivers) @@ -185,6 +112,9 @@ func (a *ActionGroup) UnmarshalJSON(data []byte) error { case "groupShortName": err = unpopulate(val, "GroupShortName", &a.GroupShortName) delete(rawMsg, key) + case "incidentReceivers": + err = unpopulate(val, "IncidentReceivers", &a.IncidentReceivers) + delete(rawMsg, key) case "itsmReceivers": err = unpopulate(val, "ItsmReceivers", &a.ItsmReceivers) delete(rawMsg, key) @@ -208,37 +138,6 @@ func (a *ActionGroup) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ActionGroupAutoGenerated. -func (a ActionGroupAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actionGroupId", a.ActionGroupID) - populate(objectMap, "webhookProperties", a.WebhookProperties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ActionGroupAutoGenerated. -func (a *ActionGroupAutoGenerated) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actionGroupId": - err = unpopulate(val, "ActionGroupID", &a.ActionGroupID) - delete(rawMsg, key) - case "webhookProperties": - err = unpopulate(val, "WebhookProperties", &a.WebhookProperties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type ActionGroupList. func (a ActionGroupList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -297,36 +196,10 @@ func (a *ActionGroupPatch) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ActionGroupPatchAutoGenerated. -func (a ActionGroupPatchAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "enabled", a.Enabled) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ActionGroupPatchAutoGenerated. -func (a *ActionGroupPatchAutoGenerated) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "enabled": - err = unpopulate(val, "Enabled", &a.Enabled) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type ActionGroupPatchBody. func (a ActionGroupPatchBody) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "identity", a.Identity) populate(objectMap, "properties", a.Properties) populate(objectMap, "tags", a.Tags) return json.Marshal(objectMap) @@ -341,37 +214,9 @@ func (a *ActionGroupPatchBody) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) + case "identity": + err = unpopulate(val, "Identity", &a.Identity) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ActionGroupPatchBodyAutoGenerated. -func (a ActionGroupPatchBodyAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ActionGroupPatchBodyAutoGenerated. -func (a *ActionGroupPatchBodyAutoGenerated) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { case "properties": err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) @@ -390,6 +235,7 @@ func (a *ActionGroupPatchBodyAutoGenerated) UnmarshalJSON(data []byte) error { func (a ActionGroupResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", a.ID) + populate(objectMap, "identity", a.Identity) populate(objectMap, "location", a.Location) populate(objectMap, "name", a.Name) populate(objectMap, "properties", a.Properties) @@ -410,6 +256,9 @@ func (a *ActionGroupResource) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &a.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &a.Location) delete(rawMsg, key) @@ -433,37 +282,11 @@ func (a *ActionGroupResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ActionList. -func (a ActionList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actionGroups", a.ActionGroups) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ActionList. -func (a *ActionList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actionGroups": - err = unpopulate(val, "ActionGroups", &a.ActionGroups) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type Actions. func (a Actions) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "actionGroups", a.ActionGroups) + populate(objectMap, "actionProperties", a.ActionProperties) populate(objectMap, "customProperties", a.CustomProperties) return json.Marshal(objectMap) } @@ -480,6 +303,9 @@ func (a *Actions) UnmarshalJSON(data []byte) error { case "actionGroups": err = unpopulate(val, "ActionGroups", &a.ActionGroups) delete(rawMsg, key) + case "actionProperties": + err = unpopulate(val, "ActionProperties", &a.ActionProperties) + delete(rawMsg, key) case "customProperties": err = unpopulate(val, "CustomProperties", &a.CustomProperties) delete(rawMsg, key) @@ -491,20 +317,17 @@ func (a *Actions) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ActivityLogAlertResource. -func (a ActivityLogAlertResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ArmRoleReceiver. +func (a ArmRoleReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", a.ID) - populate(objectMap, "location", a.Location) populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) + populate(objectMap, "roleId", a.RoleID) + populate(objectMap, "useCommonAlertSchema", a.UseCommonAlertSchema) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ActivityLogAlertResource. -func (a *ActivityLogAlertResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ArmRoleReceiver. +func (a *ArmRoleReceiver) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -512,23 +335,14 @@ func (a *ActivityLogAlertResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &a.Location) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) + case "roleId": + err = unpopulate(val, "RoleID", &a.RoleID) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) + case "useCommonAlertSchema": + err = unpopulate(val, "UseCommonAlertSchema", &a.UseCommonAlertSchema) delete(rawMsg, key) } if err != nil { @@ -538,22 +352,22 @@ func (a *ActivityLogAlertResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AlertRule. -func (a AlertRule) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AutomationRunbookReceiver. +func (a AutomationRunbookReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "action", a.Action) - populate(objectMap, "actions", a.Actions) - populate(objectMap, "condition", a.Condition) - populate(objectMap, "description", a.Description) - populate(objectMap, "isEnabled", a.IsEnabled) - populateDateTimeRFC3339(objectMap, "lastUpdatedTime", a.LastUpdatedTime) + populate(objectMap, "automationAccountId", a.AutomationAccountID) + populate(objectMap, "isGlobalRunbook", a.IsGlobalRunbook) + populate(objectMap, "managedIdentity", a.ManagedIdentity) populate(objectMap, "name", a.Name) - populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "runbookName", a.RunbookName) + populate(objectMap, "serviceUri", a.ServiceURI) + populate(objectMap, "useCommonAlertSchema", a.UseCommonAlertSchema) + populate(objectMap, "webhookResourceId", a.WebhookResourceID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRule. -func (a *AlertRule) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationRunbookReceiver. +func (a *AutomationRunbookReceiver) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -561,29 +375,29 @@ func (a *AlertRule) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "action": - a.Action, err = unmarshalRuleActionClassification(val) + case "automationAccountId": + err = unpopulate(val, "AutomationAccountID", &a.AutomationAccountID) delete(rawMsg, key) - case "actions": - a.Actions, err = unmarshalRuleActionClassificationArray(val) + case "isGlobalRunbook": + err = unpopulate(val, "IsGlobalRunbook", &a.IsGlobalRunbook) delete(rawMsg, key) - case "condition": - a.Condition, err = unmarshalRuleConditionClassification(val) + case "managedIdentity": + err = unpopulate(val, "ManagedIdentity", &a.ManagedIdentity) delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &a.Description) + case "name": + err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &a.IsEnabled) + case "runbookName": + err = unpopulate(val, "RunbookName", &a.RunbookName) delete(rawMsg, key) - case "lastUpdatedTime": - err = unpopulateDateTimeRFC3339(val, "LastUpdatedTime", &a.LastUpdatedTime) + case "serviceUri": + err = unpopulate(val, "ServiceURI", &a.ServiceURI) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) + case "useCommonAlertSchema": + err = unpopulate(val, "UseCommonAlertSchema", &a.UseCommonAlertSchema) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + case "webhookResourceId": + err = unpopulate(val, "WebhookResourceID", &a.WebhookResourceID) delete(rawMsg, key) } if err != nil { @@ -593,15 +407,16 @@ func (a *AlertRule) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AlertRuleAllOfCondition. -func (a AlertRuleAllOfCondition) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureAppPushReceiver. +func (a AzureAppPushReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "allOf", a.AllOf) + populate(objectMap, "emailAddress", a.EmailAddress) + populate(objectMap, "name", a.Name) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleAllOfCondition. -func (a *AlertRuleAllOfCondition) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureAppPushReceiver. +func (a *AzureAppPushReceiver) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -609,8 +424,11 @@ func (a *AlertRuleAllOfCondition) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "allOf": - err = unpopulate(val, "AllOf", &a.AllOf) + case "emailAddress": + err = unpopulate(val, "EmailAddress", &a.EmailAddress) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) } if err != nil { @@ -620,18 +438,20 @@ func (a *AlertRuleAllOfCondition) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AlertRuleAnyOfOrLeafCondition. -func (a AlertRuleAnyOfOrLeafCondition) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureFunctionReceiver. +func (a AzureFunctionReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "anyOf", a.AnyOf) - populate(objectMap, "containsAny", a.ContainsAny) - populate(objectMap, "equals", a.Equals) - populate(objectMap, "field", a.Field) + populate(objectMap, "functionAppResourceId", a.FunctionAppResourceID) + populate(objectMap, "functionName", a.FunctionName) + populate(objectMap, "httpTriggerUrl", a.HTTPTriggerURL) + populate(objectMap, "managedIdentity", a.ManagedIdentity) + populate(objectMap, "name", a.Name) + populate(objectMap, "useCommonAlertSchema", a.UseCommonAlertSchema) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleAnyOfOrLeafCondition. -func (a *AlertRuleAnyOfOrLeafCondition) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFunctionReceiver. +func (a *AzureFunctionReceiver) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -639,17 +459,23 @@ func (a *AlertRuleAnyOfOrLeafCondition) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "anyOf": - err = unpopulate(val, "AnyOf", &a.AnyOf) + case "functionAppResourceId": + err = unpopulate(val, "FunctionAppResourceID", &a.FunctionAppResourceID) + delete(rawMsg, key) + case "functionName": + err = unpopulate(val, "FunctionName", &a.FunctionName) + delete(rawMsg, key) + case "httpTriggerUrl": + err = unpopulate(val, "HTTPTriggerURL", &a.HTTPTriggerURL) delete(rawMsg, key) - case "containsAny": - err = unpopulate(val, "ContainsAny", &a.ContainsAny) + case "managedIdentity": + err = unpopulate(val, "ManagedIdentity", &a.ManagedIdentity) delete(rawMsg, key) - case "equals": - err = unpopulate(val, "Equals", &a.Equals) + case "name": + err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) - case "field": - err = unpopulate(val, "Field", &a.Field) + case "useCommonAlertSchema": + err = unpopulate(val, "UseCommonAlertSchema", &a.UseCommonAlertSchema) delete(rawMsg, key) } if err != nil { @@ -659,17 +485,20 @@ func (a *AlertRuleAnyOfOrLeafCondition) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AlertRuleLeafCondition. -func (a AlertRuleLeafCondition) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AzureResource. +func (a AzureResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "containsAny", a.ContainsAny) - populate(objectMap, "equals", a.Equals) - populate(objectMap, "field", a.Field) + populate(objectMap, "id", a.ID) + populate(objectMap, "identity", a.Identity) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleLeafCondition. -func (a *AlertRuleLeafCondition) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResource. +func (a *AzureResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", a, err) @@ -677,14 +506,23 @@ func (a *AlertRuleLeafCondition) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "containsAny": - err = unpopulate(val, "ContainsAny", &a.ContainsAny) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &a.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) delete(rawMsg, key) - case "equals": - err = unpopulate(val, "Equals", &a.Equals) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) delete(rawMsg, key) - case "field": - err = unpopulate(val, "Field", &a.Field) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { @@ -694,10425 +532,1264 @@ func (a *AlertRuleLeafCondition) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AlertRuleList. -func (a AlertRuleList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) +// MarshalJSON implements the json.Marshaller interface for type Condition. +func (c Condition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "alertSensitivity", c.AlertSensitivity) + populate(objectMap, "criterionType", c.CriterionType) + populate(objectMap, "dimensions", c.Dimensions) + populate(objectMap, "failingPeriods", c.FailingPeriods) + populateDateTimeRFC3339(objectMap, "ignoreDataBefore", c.IgnoreDataBefore) + populate(objectMap, "metricMeasureColumn", c.MetricMeasureColumn) + populate(objectMap, "metricName", c.MetricName) + populate(objectMap, "minRecurrenceCount", c.MinRecurrenceCount) + populate(objectMap, "operator", c.Operator) + populate(objectMap, "query", c.Query) + populate(objectMap, "resourceIdColumn", c.ResourceIDColumn) + populate(objectMap, "threshold", c.Threshold) + populate(objectMap, "timeAggregation", c.TimeAggregation) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleList. -func (a *AlertRuleList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Condition. +func (c *Condition) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &a.NextLink) + case "alertSensitivity": + err = unpopulate(val, "AlertSensitivity", &c.AlertSensitivity) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &a.Value) + case "criterionType": + err = unpopulate(val, "CriterionType", &c.CriterionType) + delete(rawMsg, key) + case "dimensions": + err = unpopulate(val, "Dimensions", &c.Dimensions) + delete(rawMsg, key) + case "failingPeriods": + err = unpopulate(val, "FailingPeriods", &c.FailingPeriods) + delete(rawMsg, key) + case "ignoreDataBefore": + err = unpopulateDateTimeRFC3339(val, "IgnoreDataBefore", &c.IgnoreDataBefore) + delete(rawMsg, key) + case "metricMeasureColumn": + err = unpopulate(val, "MetricMeasureColumn", &c.MetricMeasureColumn) + delete(rawMsg, key) + case "metricName": + err = unpopulate(val, "MetricName", &c.MetricName) + delete(rawMsg, key) + case "minRecurrenceCount": + err = unpopulate(val, "MinRecurrenceCount", &c.MinRecurrenceCount) + delete(rawMsg, key) + case "operator": + err = unpopulate(val, "Operator", &c.Operator) + delete(rawMsg, key) + case "query": + err = unpopulate(val, "Query", &c.Query) + delete(rawMsg, key) + case "resourceIdColumn": + err = unpopulate(val, "ResourceIDColumn", &c.ResourceIDColumn) + delete(rawMsg, key) + case "threshold": + err = unpopulate(val, "Threshold", &c.Threshold) + delete(rawMsg, key) + case "timeAggregation": + err = unpopulate(val, "TimeAggregation", &c.TimeAggregation) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AlertRulePatchObject. -func (a AlertRulePatchObject) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ConditionFailingPeriods. +func (c ConditionFailingPeriods) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) + populate(objectMap, "minFailingPeriodsToAlert", c.MinFailingPeriodsToAlert) + populate(objectMap, "numberOfEvaluationPeriods", c.NumberOfEvaluationPeriods) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRulePatchObject. -func (a *AlertRulePatchObject) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ConditionFailingPeriods. +func (c *ConditionFailingPeriods) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &a.Properties) + case "minFailingPeriodsToAlert": + err = unpopulate(val, "MinFailingPeriodsToAlert", &c.MinFailingPeriodsToAlert) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) + case "numberOfEvaluationPeriods": + err = unpopulate(val, "NumberOfEvaluationPeriods", &c.NumberOfEvaluationPeriods) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AlertRulePatchProperties. -func (a AlertRulePatchProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Context. +func (c Context) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "enabled", a.Enabled) + populate(objectMap, "contextType", c.ContextType) + populate(objectMap, "notificationSource", c.NotificationSource) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRulePatchProperties. -func (a *AlertRulePatchProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Context. +func (c *Context) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "enabled": - err = unpopulate(val, "Enabled", &a.Enabled) + case "contextType": + err = unpopulate(val, "ContextType", &c.ContextType) + delete(rawMsg, key) + case "notificationSource": + err = unpopulate(val, "NotificationSource", &c.NotificationSource) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AlertRuleProperties. -func (a AlertRuleProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Dimension. +func (d Dimension) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "actions", a.Actions) - populate(objectMap, "condition", a.Condition) - populate(objectMap, "description", a.Description) - populate(objectMap, "enabled", a.Enabled) - populate(objectMap, "scopes", a.Scopes) + populate(objectMap, "name", d.Name) + populate(objectMap, "operator", d.Operator) + populate(objectMap, "values", d.Values) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleProperties. -func (a *AlertRuleProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Dimension. +func (d *Dimension) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "actions": - err = unpopulate(val, "Actions", &a.Actions) - delete(rawMsg, key) - case "condition": - err = unpopulate(val, "Condition", &a.Condition) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &a.Description) + case "name": + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &a.Enabled) + case "operator": + err = unpopulate(val, "Operator", &d.Operator) delete(rawMsg, key) - case "scopes": - err = unpopulate(val, "Scopes", &a.Scopes) + case "values": + err = unpopulate(val, "Values", &d.Values) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AlertRuleResource. -func (a AlertRuleResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EmailReceiver. +func (e EmailReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", a.ID) - populate(objectMap, "location", a.Location) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) + populate(objectMap, "emailAddress", e.EmailAddress) + populate(objectMap, "name", e.Name) + populate(objectMap, "status", e.Status) + populate(objectMap, "useCommonAlertSchema", e.UseCommonAlertSchema) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleResource. -func (a *AlertRuleResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EmailReceiver. +func (e *EmailReceiver) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &a.Location) + case "emailAddress": + err = unpopulate(val, "EmailAddress", &e.EmailAddress) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) + err = unpopulate(val, "Name", &e.Name) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) + case "status": + err = unpopulate(val, "Status", &e.Status) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) + case "useCommonAlertSchema": + err = unpopulate(val, "UseCommonAlertSchema", &e.UseCommonAlertSchema) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AlertRuleResourceCollection. -func (a AlertRuleResourceCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EnableRequest. +func (e EnableRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", a.Value) + populate(objectMap, "receiverName", e.ReceiverName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleResourceCollection. -func (a *AlertRuleResourceCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EnableRequest. +func (e *EnableRequest) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &a.Value) + case "receiverName": + err = unpopulate(val, "ReceiverName", &e.ReceiverName) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AlertRuleResourcePatch. -func (a AlertRuleResourcePatch) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) + populateAny(objectMap, "info", e.Info) + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleResourcePatch. -func (a *AlertRuleResourcePatch) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &a.Properties) + case "info": + err = unpopulate(val, "Info", &e.Info) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) + case "type": + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ArmRoleReceiver. -func (a ArmRoleReceiver) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorContract. +func (e ErrorContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", a.Name) - populate(objectMap, "roleId", a.RoleID) - populate(objectMap, "useCommonAlertSchema", a.UseCommonAlertSchema) + populate(objectMap, "error", e.Error) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ArmRoleReceiver. -func (a *ArmRoleReceiver) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorContract. +func (e *ErrorContract) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "roleId": - err = unpopulate(val, "RoleID", &a.RoleID) - delete(rawMsg, key) - case "useCommonAlertSchema": - err = unpopulate(val, "UseCommonAlertSchema", &a.UseCommonAlertSchema) + case "error": + err = unpopulate(val, "Error", &e.Error) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AutomationRunbookReceiver. -func (a AutomationRunbookReceiver) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. +func (e ErrorResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "automationAccountId", a.AutomationAccountID) - populate(objectMap, "isGlobalRunbook", a.IsGlobalRunbook) - populate(objectMap, "name", a.Name) - populate(objectMap, "runbookName", a.RunbookName) - populate(objectMap, "serviceUri", a.ServiceURI) - populate(objectMap, "useCommonAlertSchema", a.UseCommonAlertSchema) - populate(objectMap, "webhookResourceId", a.WebhookResourceID) + populate(objectMap, "code", e.Code) + populate(objectMap, "message", e.Message) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationRunbookReceiver. -func (a *AutomationRunbookReceiver) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. +func (e *ErrorResponse) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "automationAccountId": - err = unpopulate(val, "AutomationAccountID", &a.AutomationAccountID) - delete(rawMsg, key) - case "isGlobalRunbook": - err = unpopulate(val, "IsGlobalRunbook", &a.IsGlobalRunbook) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "runbookName": - err = unpopulate(val, "RunbookName", &a.RunbookName) - delete(rawMsg, key) - case "serviceUri": - err = unpopulate(val, "ServiceURI", &a.ServiceURI) + case "code": + err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) - case "useCommonAlertSchema": - err = unpopulate(val, "UseCommonAlertSchema", &a.UseCommonAlertSchema) - delete(rawMsg, key) - case "webhookResourceId": - err = unpopulate(val, "WebhookResourceID", &a.WebhookResourceID) + case "message": + err = unpopulate(val, "Message", &e.Message) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AutoscaleErrorResponse. -func (a AutoscaleErrorResponse) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ErrorResponseAutoGenerated. +func (e ErrorResponseAutoGenerated) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "error", a.Error) - populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AutoscaleErrorResponse. -func (a *AutoscaleErrorResponse) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAutoGenerated. +func (e *ErrorResponseAutoGenerated) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "error": - err = unpopulate(val, "Error", &a.Error) + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &a.SystemData) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AutoscaleErrorResponseError. -func (a AutoscaleErrorResponseError) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventHubReceiver. +func (e EventHubReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "code", a.Code) - populate(objectMap, "details", a.Details) - populate(objectMap, "message", a.Message) - populate(objectMap, "target", a.Target) + populate(objectMap, "eventHubName", e.EventHubName) + populate(objectMap, "eventHubNameSpace", e.EventHubNameSpace) + populate(objectMap, "managedIdentity", e.ManagedIdentity) + populate(objectMap, "name", e.Name) + populate(objectMap, "subscriptionId", e.SubscriptionID) + populate(objectMap, "tenantId", e.TenantID) + populate(objectMap, "useCommonAlertSchema", e.UseCommonAlertSchema) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AutoscaleErrorResponseError. -func (a *AutoscaleErrorResponseError) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubReceiver. +func (e *EventHubReceiver) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } for key, val := range rawMsg { var err error switch key { - case "code": - err = unpopulate(val, "Code", &a.Code) + case "eventHubName": + err = unpopulate(val, "EventHubName", &e.EventHubName) delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &a.Details) + case "eventHubNameSpace": + err = unpopulate(val, "EventHubNameSpace", &e.EventHubNameSpace) delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &a.Message) + case "managedIdentity": + err = unpopulate(val, "ManagedIdentity", &e.ManagedIdentity) delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &a.Target) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "subscriptionId": + err = unpopulate(val, "SubscriptionID", &e.SubscriptionID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &e.TenantID) + delete(rawMsg, key) + case "useCommonAlertSchema": + err = unpopulate(val, "UseCommonAlertSchema", &e.UseCommonAlertSchema) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AutoscaleNotification. -func (a AutoscaleNotification) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Identity. +func (i Identity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "email", a.Email) - objectMap["operation"] = "Scale" - populate(objectMap, "webhooks", a.Webhooks) + populate(objectMap, "principalId", i.PrincipalID) + populate(objectMap, "tenantId", i.TenantID) + populate(objectMap, "type", i.Type) + populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AutoscaleNotification. -func (a *AutoscaleNotification) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Identity. +func (i *Identity) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "email": - err = unpopulate(val, "Email", &a.Email) + case "principalId": + err = unpopulate(val, "PrincipalID", &i.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &i.TenantID) delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &a.Operation) + case "type": + err = unpopulate(val, "Type", &i.Type) delete(rawMsg, key) - case "webhooks": - err = unpopulate(val, "Webhooks", &a.Webhooks) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &i.UserAssignedIdentities) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AutoscaleProfile. -func (a AutoscaleProfile) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IncidentReceiver. +func (i IncidentReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "capacity", a.Capacity) - populate(objectMap, "fixedDate", a.FixedDate) - populate(objectMap, "name", a.Name) - populate(objectMap, "recurrence", a.Recurrence) - populate(objectMap, "rules", a.Rules) + populate(objectMap, "connection", i.Connection) + populate(objectMap, "incidentManagementService", i.IncidentManagementService) + populate(objectMap, "mappings", i.Mappings) + populate(objectMap, "name", i.Name) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AutoscaleProfile. -func (a *AutoscaleProfile) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IncidentReceiver. +func (i *IncidentReceiver) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "capacity": - err = unpopulate(val, "Capacity", &a.Capacity) - delete(rawMsg, key) - case "fixedDate": - err = unpopulate(val, "FixedDate", &a.FixedDate) + case "connection": + err = unpopulate(val, "Connection", &i.Connection) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) + case "incidentManagementService": + err = unpopulate(val, "IncidentManagementService", &i.IncidentManagementService) delete(rawMsg, key) - case "recurrence": - err = unpopulate(val, "Recurrence", &a.Recurrence) + case "mappings": + err = unpopulate(val, "Mappings", &i.Mappings) delete(rawMsg, key) - case "rules": - err = unpopulate(val, "Rules", &a.Rules) + case "name": + err = unpopulate(val, "Name", &i.Name) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AutoscaleSetting. -func (a AutoscaleSetting) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type IncidentServiceConnection. +func (i IncidentServiceConnection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "enabled", a.Enabled) - populate(objectMap, "name", a.Name) - populate(objectMap, "notifications", a.Notifications) - populate(objectMap, "predictiveAutoscalePolicy", a.PredictiveAutoscalePolicy) - populate(objectMap, "profiles", a.Profiles) - populate(objectMap, "targetResourceLocation", a.TargetResourceLocation) - populate(objectMap, "targetResourceUri", a.TargetResourceURI) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AutoscaleSetting. -func (a *AutoscaleSetting) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type IncidentServiceConnection. +func (i *IncidentServiceConnection) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "enabled": - err = unpopulate(val, "Enabled", &a.Enabled) + case "id": + err = unpopulate(val, "ID", &i.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "notifications": - err = unpopulate(val, "Notifications", &a.Notifications) - delete(rawMsg, key) - case "predictiveAutoscalePolicy": - err = unpopulate(val, "PredictiveAutoscalePolicy", &a.PredictiveAutoscalePolicy) - delete(rawMsg, key) - case "profiles": - err = unpopulate(val, "Profiles", &a.Profiles) - delete(rawMsg, key) - case "targetResourceLocation": - err = unpopulate(val, "TargetResourceLocation", &a.TargetResourceLocation) - delete(rawMsg, key) - case "targetResourceUri": - err = unpopulate(val, "TargetResourceURI", &a.TargetResourceURI) + err = unpopulate(val, "Name", &i.Name) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AutoscaleSettingResource. -func (a AutoscaleSettingResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ItsmReceiver. +func (i ItsmReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", a.ID) - populate(objectMap, "location", a.Location) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) + populate(objectMap, "connectionId", i.ConnectionID) + populate(objectMap, "name", i.Name) + populate(objectMap, "region", i.Region) + populate(objectMap, "ticketConfiguration", i.TicketConfiguration) + populate(objectMap, "workspaceId", i.WorkspaceID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AutoscaleSettingResource. -func (a *AutoscaleSettingResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ItsmReceiver. +func (i *ItsmReceiver) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &a.Location) + case "connectionId": + err = unpopulate(val, "ConnectionID", &i.ConnectionID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) + err = unpopulate(val, "Name", &i.Name) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &a.SystemData) + case "region": + err = unpopulate(val, "Region", &i.Region) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) + case "ticketConfiguration": + err = unpopulate(val, "TicketConfiguration", &i.TicketConfiguration) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) + case "workspaceId": + err = unpopulate(val, "WorkspaceID", &i.WorkspaceID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", i, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AutoscaleSettingResourceCollection. -func (a AutoscaleSettingResourceCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type LogicAppReceiver. +func (l LogicAppReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) + populate(objectMap, "callbackUrl", l.CallbackURL) + populate(objectMap, "managedIdentity", l.ManagedIdentity) + populate(objectMap, "name", l.Name) + populate(objectMap, "resourceId", l.ResourceID) + populate(objectMap, "useCommonAlertSchema", l.UseCommonAlertSchema) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AutoscaleSettingResourceCollection. -func (a *AutoscaleSettingResourceCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type LogicAppReceiver. +func (l *LogicAppReceiver) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &a.NextLink) + case "callbackUrl": + err = unpopulate(val, "CallbackURL", &l.CallbackURL) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &a.Value) + case "managedIdentity": + err = unpopulate(val, "ManagedIdentity", &l.ManagedIdentity) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &l.Name) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &l.ResourceID) + delete(rawMsg, key) + case "useCommonAlertSchema": + err = unpopulate(val, "UseCommonAlertSchema", &l.UseCommonAlertSchema) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", l, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AutoscaleSettingResourcePatch. -func (a AutoscaleSettingResourcePatch) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. +func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) + populate(objectMap, "principalId", m.PrincipalID) + populate(objectMap, "tenantId", m.TenantID) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AutoscaleSettingResourcePatch. -func (a *AutoscaleSettingResourcePatch) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServiceIdentity. +func (m *ManagedServiceIdentity) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &a.Properties) + case "principalId": + err = unpopulate(val, "PrincipalID", &m.PrincipalID) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureAppPushReceiver. -func (a AzureAppPushReceiver) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type NotificationRequestBody. +func (n NotificationRequestBody) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "emailAddress", a.EmailAddress) - populate(objectMap, "name", a.Name) + populate(objectMap, "alertType", n.AlertType) + populate(objectMap, "armRoleReceivers", n.ArmRoleReceivers) + populate(objectMap, "automationRunbookReceivers", n.AutomationRunbookReceivers) + populate(objectMap, "azureAppPushReceivers", n.AzureAppPushReceivers) + populate(objectMap, "azureFunctionReceivers", n.AzureFunctionReceivers) + populate(objectMap, "emailReceivers", n.EmailReceivers) + populate(objectMap, "eventHubReceivers", n.EventHubReceivers) + populate(objectMap, "incidentReceivers", n.IncidentReceivers) + populate(objectMap, "itsmReceivers", n.ItsmReceivers) + populate(objectMap, "logicAppReceivers", n.LogicAppReceivers) + populate(objectMap, "smsReceivers", n.SmsReceivers) + populate(objectMap, "voiceReceivers", n.VoiceReceivers) + populate(objectMap, "webhookReceivers", n.WebhookReceivers) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureAppPushReceiver. -func (a *AzureAppPushReceiver) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type NotificationRequestBody. +func (n *NotificationRequestBody) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } for key, val := range rawMsg { var err error switch key { - case "emailAddress": - err = unpopulate(val, "EmailAddress", &a.EmailAddress) + case "alertType": + err = unpopulate(val, "AlertType", &n.AlertType) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) + case "armRoleReceivers": + err = unpopulate(val, "ArmRoleReceivers", &n.ArmRoleReceivers) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureAppPushReceiverAutoGenerated. -func (a AzureAppPushReceiverAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "emailAddress", a.EmailAddress) - populate(objectMap, "name", a.Name) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureAppPushReceiverAutoGenerated. -func (a *AzureAppPushReceiverAutoGenerated) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "emailAddress": - err = unpopulate(val, "EmailAddress", &a.EmailAddress) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureFunctionReceiver. -func (a AzureFunctionReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "functionAppResourceId", a.FunctionAppResourceID) - populate(objectMap, "functionName", a.FunctionName) - populate(objectMap, "httpTriggerUrl", a.HTTPTriggerURL) - populate(objectMap, "name", a.Name) - populate(objectMap, "useCommonAlertSchema", a.UseCommonAlertSchema) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFunctionReceiver. -func (a *AzureFunctionReceiver) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "functionAppResourceId": - err = unpopulate(val, "FunctionAppResourceID", &a.FunctionAppResourceID) - delete(rawMsg, key) - case "functionName": - err = unpopulate(val, "FunctionName", &a.FunctionName) - delete(rawMsg, key) - case "httpTriggerUrl": - err = unpopulate(val, "HTTPTriggerURL", &a.HTTPTriggerURL) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "useCommonAlertSchema": - err = unpopulate(val, "UseCommonAlertSchema", &a.UseCommonAlertSchema) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureMonitorMetricsDestination. -func (a AzureMonitorMetricsDestination) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", a.Name) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorMetricsDestination. -func (a *AzureMonitorMetricsDestination) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureMonitorPrivateLinkScope. -func (a AzureMonitorPrivateLinkScope) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", a.ID) - populate(objectMap, "location", a.Location) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorPrivateLinkScope. -func (a *AzureMonitorPrivateLinkScope) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &a.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &a.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureMonitorPrivateLinkScopeListResult. -func (a AzureMonitorPrivateLinkScopeListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorPrivateLinkScopeListResult. -func (a *AzureMonitorPrivateLinkScopeListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &a.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &a.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureMonitorPrivateLinkScopeProperties. -func (a AzureMonitorPrivateLinkScopeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "accessModeSettings", a.AccessModeSettings) - populate(objectMap, "privateEndpointConnections", a.PrivateEndpointConnections) - populate(objectMap, "provisioningState", a.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorPrivateLinkScopeProperties. -func (a *AzureMonitorPrivateLinkScopeProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "accessModeSettings": - err = unpopulate(val, "AccessModeSettings", &a.AccessModeSettings) - delete(rawMsg, key) - case "privateEndpointConnections": - err = unpopulate(val, "PrivateEndpointConnections", &a.PrivateEndpointConnections) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureMonitorWorkspace. -func (a AzureMonitorWorkspace) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "accountId", a.AccountID) - populate(objectMap, "defaultIngestionSettings", a.DefaultIngestionSettings) - populate(objectMap, "metrics", a.Metrics) - populate(objectMap, "provisioningState", a.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorWorkspace. -func (a *AzureMonitorWorkspace) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "accountId": - err = unpopulate(val, "AccountID", &a.AccountID) - delete(rawMsg, key) - case "defaultIngestionSettings": - err = unpopulate(val, "DefaultIngestionSettings", &a.DefaultIngestionSettings) - delete(rawMsg, key) - case "metrics": - err = unpopulate(val, "Metrics", &a.Metrics) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureMonitorWorkspaceDefaultIngestionSettings. -func (a AzureMonitorWorkspaceDefaultIngestionSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataCollectionEndpointResourceId", a.DataCollectionEndpointResourceID) - populate(objectMap, "dataCollectionRuleResourceId", a.DataCollectionRuleResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorWorkspaceDefaultIngestionSettings. -func (a *AzureMonitorWorkspaceDefaultIngestionSettings) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataCollectionEndpointResourceId": - err = unpopulate(val, "DataCollectionEndpointResourceID", &a.DataCollectionEndpointResourceID) - delete(rawMsg, key) - case "dataCollectionRuleResourceId": - err = unpopulate(val, "DataCollectionRuleResourceID", &a.DataCollectionRuleResourceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureMonitorWorkspaceMetrics. -func (a AzureMonitorWorkspaceMetrics) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "internalId", a.InternalID) - populate(objectMap, "prometheusQueryEndpoint", a.PrometheusQueryEndpoint) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorWorkspaceMetrics. -func (a *AzureMonitorWorkspaceMetrics) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "internalId": - err = unpopulate(val, "InternalID", &a.InternalID) - delete(rawMsg, key) - case "prometheusQueryEndpoint": - err = unpopulate(val, "PrometheusQueryEndpoint", &a.PrometheusQueryEndpoint) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureMonitorWorkspaceResource. -func (a AzureMonitorWorkspaceResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "etag", a.Etag) - populate(objectMap, "id", a.ID) - populate(objectMap, "location", a.Location) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorWorkspaceResource. -func (a *AzureMonitorWorkspaceResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &a.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &a.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &a.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureMonitorWorkspaceResourceForUpdate. -func (a AzureMonitorWorkspaceResourceForUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "tags", a.Tags) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorWorkspaceResourceForUpdate. -func (a *AzureMonitorWorkspaceResourceForUpdate) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "tags": - err = unpopulate(val, "Tags", &a.Tags) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureMonitorWorkspaceResourceListResult. -func (a AzureMonitorWorkspaceResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorWorkspaceResourceListResult. -func (a *AzureMonitorWorkspaceResourceListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &a.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &a.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureMonitorWorkspaceResourceProperties. -func (a AzureMonitorWorkspaceResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "accountId", a.AccountID) - populate(objectMap, "defaultIngestionSettings", a.DefaultIngestionSettings) - populate(objectMap, "metrics", a.Metrics) - populate(objectMap, "provisioningState", a.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureMonitorWorkspaceResourceProperties. -func (a *AzureMonitorWorkspaceResourceProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "accountId": - err = unpopulate(val, "AccountID", &a.AccountID) - delete(rawMsg, key) - case "defaultIngestionSettings": - err = unpopulate(val, "DefaultIngestionSettings", &a.DefaultIngestionSettings) - delete(rawMsg, key) - case "metrics": - err = unpopulate(val, "Metrics", &a.Metrics) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureResource. -func (a AzureResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", a.ID) - populate(objectMap, "location", a.Location) - populate(objectMap, "name", a.Name) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResource. -func (a *AzureResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &a.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type AzureResourceAutoGenerated. -func (a AzureResourceAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", a.ID) - populate(objectMap, "location", a.Location) - populate(objectMap, "name", a.Name) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResourceAutoGenerated. -func (a *AzureResourceAutoGenerated) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &a.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BaselineMetadata. -func (b BaselineMetadata) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", b.Name) - populate(objectMap, "value", b.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BaselineMetadata. -func (b *BaselineMetadata) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &b.Name) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &b.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ColumnDefinition. -func (c ColumnDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", c.Name) - populate(objectMap, "type", c.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ColumnDefinition. -func (c *ColumnDefinition) 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", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &c.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Condition. -func (c Condition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dimensions", c.Dimensions) - populate(objectMap, "failingPeriods", c.FailingPeriods) - populate(objectMap, "metricMeasureColumn", c.MetricMeasureColumn) - populate(objectMap, "metricName", c.MetricName) - populate(objectMap, "operator", c.Operator) - populate(objectMap, "query", c.Query) - populate(objectMap, "resourceIdColumn", c.ResourceIDColumn) - populate(objectMap, "threshold", c.Threshold) - populate(objectMap, "timeAggregation", c.TimeAggregation) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Condition. -func (c *Condition) 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", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dimensions": - err = unpopulate(val, "Dimensions", &c.Dimensions) - delete(rawMsg, key) - case "failingPeriods": - err = unpopulate(val, "FailingPeriods", &c.FailingPeriods) - delete(rawMsg, key) - case "metricMeasureColumn": - err = unpopulate(val, "MetricMeasureColumn", &c.MetricMeasureColumn) - delete(rawMsg, key) - case "metricName": - err = unpopulate(val, "MetricName", &c.MetricName) - delete(rawMsg, key) - case "operator": - err = unpopulate(val, "Operator", &c.Operator) - delete(rawMsg, key) - case "query": - err = unpopulate(val, "Query", &c.Query) - delete(rawMsg, key) - case "resourceIdColumn": - err = unpopulate(val, "ResourceIDColumn", &c.ResourceIDColumn) - delete(rawMsg, key) - case "threshold": - err = unpopulate(val, "Threshold", &c.Threshold) - delete(rawMsg, key) - case "timeAggregation": - err = unpopulate(val, "TimeAggregation", &c.TimeAggregation) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ConditionFailingPeriods. -func (c ConditionFailingPeriods) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "minFailingPeriodsToAlert", c.MinFailingPeriodsToAlert) - populate(objectMap, "numberOfEvaluationPeriods", c.NumberOfEvaluationPeriods) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ConditionFailingPeriods. -func (c *ConditionFailingPeriods) 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", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "minFailingPeriodsToAlert": - err = unpopulate(val, "MinFailingPeriodsToAlert", &c.MinFailingPeriodsToAlert) - delete(rawMsg, key) - case "numberOfEvaluationPeriods": - err = unpopulate(val, "NumberOfEvaluationPeriods", &c.NumberOfEvaluationPeriods) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ConfigurationAccessEndpointSpec. -func (c ConfigurationAccessEndpointSpec) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "endpoint", c.Endpoint) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigurationAccessEndpointSpec. -func (c *ConfigurationAccessEndpointSpec) 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", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endpoint": - err = unpopulate(val, "Endpoint", &c.Endpoint) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Context. -func (c Context) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "contextType", c.ContextType) - populate(objectMap, "notificationSource", c.NotificationSource) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Context. -func (c *Context) 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", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "contextType": - err = unpopulate(val, "ContextType", &c.ContextType) - delete(rawMsg, key) - case "notificationSource": - err = unpopulate(val, "NotificationSource", &c.NotificationSource) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpoint. -func (d DataCollectionEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "configurationAccess", d.ConfigurationAccess) - populate(objectMap, "description", d.Description) - populate(objectMap, "failoverConfiguration", d.FailoverConfiguration) - populate(objectMap, "immutableId", d.ImmutableID) - populate(objectMap, "logsIngestion", d.LogsIngestion) - populate(objectMap, "metadata", d.Metadata) - populate(objectMap, "metricsIngestion", d.MetricsIngestion) - populate(objectMap, "networkAcls", d.NetworkACLs) - populate(objectMap, "privateLinkScopedResources", d.PrivateLinkScopedResources) - populate(objectMap, "provisioningState", d.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpoint. -func (d *DataCollectionEndpoint) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "configurationAccess": - err = unpopulate(val, "ConfigurationAccess", &d.ConfigurationAccess) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &d.Description) - delete(rawMsg, key) - case "failoverConfiguration": - err = unpopulate(val, "FailoverConfiguration", &d.FailoverConfiguration) - delete(rawMsg, key) - case "immutableId": - err = unpopulate(val, "ImmutableID", &d.ImmutableID) - delete(rawMsg, key) - case "logsIngestion": - err = unpopulate(val, "LogsIngestion", &d.LogsIngestion) - delete(rawMsg, key) - case "metadata": - err = unpopulate(val, "Metadata", &d.Metadata) - delete(rawMsg, key) - case "metricsIngestion": - err = unpopulate(val, "MetricsIngestion", &d.MetricsIngestion) - delete(rawMsg, key) - case "networkAcls": - err = unpopulate(val, "NetworkACLs", &d.NetworkACLs) - delete(rawMsg, key) - case "privateLinkScopedResources": - err = unpopulate(val, "PrivateLinkScopedResources", &d.PrivateLinkScopedResources) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointConfigurationAccess. -func (d DataCollectionEndpointConfigurationAccess) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "endpoint", d.Endpoint) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointConfigurationAccess. -func (d *DataCollectionEndpointConfigurationAccess) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endpoint": - err = unpopulate(val, "Endpoint", &d.Endpoint) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointFailoverConfiguration. -func (d DataCollectionEndpointFailoverConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "activeLocation", d.ActiveLocation) - populate(objectMap, "locations", d.Locations) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointFailoverConfiguration. -func (d *DataCollectionEndpointFailoverConfiguration) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "activeLocation": - err = unpopulate(val, "ActiveLocation", &d.ActiveLocation) - delete(rawMsg, key) - case "locations": - err = unpopulate(val, "Locations", &d.Locations) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointLogsIngestion. -func (d DataCollectionEndpointLogsIngestion) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "endpoint", d.Endpoint) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointLogsIngestion. -func (d *DataCollectionEndpointLogsIngestion) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endpoint": - err = unpopulate(val, "Endpoint", &d.Endpoint) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointMetadata. -func (d DataCollectionEndpointMetadata) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "provisionedBy", d.ProvisionedBy) - populate(objectMap, "provisionedByResourceId", d.ProvisionedByResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointMetadata. -func (d *DataCollectionEndpointMetadata) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "provisionedBy": - err = unpopulate(val, "ProvisionedBy", &d.ProvisionedBy) - delete(rawMsg, key) - case "provisionedByResourceId": - err = unpopulate(val, "ProvisionedByResourceID", &d.ProvisionedByResourceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointMetricsIngestion. -func (d DataCollectionEndpointMetricsIngestion) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "endpoint", d.Endpoint) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointMetricsIngestion. -func (d *DataCollectionEndpointMetricsIngestion) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endpoint": - err = unpopulate(val, "Endpoint", &d.Endpoint) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointNetworkACLs. -func (d DataCollectionEndpointNetworkACLs) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "publicNetworkAccess", d.PublicNetworkAccess) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointNetworkACLs. -func (d *DataCollectionEndpointNetworkACLs) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "publicNetworkAccess": - err = unpopulate(val, "PublicNetworkAccess", &d.PublicNetworkAccess) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointResource. -func (d DataCollectionEndpointResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "etag", d.Etag) - populate(objectMap, "id", d.ID) - populate(objectMap, "identity", d.Identity) - populate(objectMap, "kind", d.Kind) - populate(objectMap, "location", d.Location) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "systemData", d.SystemData) - populate(objectMap, "tags", d.Tags) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointResource. -func (d *DataCollectionEndpointResource) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &d.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &d.ID) - delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &d.Identity) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &d.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &d.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &d.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &d.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointResourceIdentity. -func (d DataCollectionEndpointResourceIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "principalId", d.PrincipalID) - populate(objectMap, "tenantId", d.TenantID) - populate(objectMap, "type", d.Type) - populate(objectMap, "userAssignedIdentities", d.UserAssignedIdentities) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointResourceIdentity. -func (d *DataCollectionEndpointResourceIdentity) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &d.PrincipalID) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &d.TenantID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) - delete(rawMsg, key) - case "userAssignedIdentities": - err = unpopulate(val, "UserAssignedIdentities", &d.UserAssignedIdentities) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointResourceListResult. -func (d DataCollectionEndpointResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointResourceListResult. -func (d *DataCollectionEndpointResourceListResult) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &d.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &d.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointResourceProperties. -func (d DataCollectionEndpointResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "configurationAccess", d.ConfigurationAccess) - populate(objectMap, "description", d.Description) - populate(objectMap, "failoverConfiguration", d.FailoverConfiguration) - populate(objectMap, "immutableId", d.ImmutableID) - populate(objectMap, "logsIngestion", d.LogsIngestion) - populate(objectMap, "metadata", d.Metadata) - populate(objectMap, "metricsIngestion", d.MetricsIngestion) - populate(objectMap, "networkAcls", d.NetworkACLs) - populate(objectMap, "privateLinkScopedResources", d.PrivateLinkScopedResources) - populate(objectMap, "provisioningState", d.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointResourceProperties. -func (d *DataCollectionEndpointResourceProperties) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "configurationAccess": - err = unpopulate(val, "ConfigurationAccess", &d.ConfigurationAccess) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &d.Description) - delete(rawMsg, key) - case "failoverConfiguration": - err = unpopulate(val, "FailoverConfiguration", &d.FailoverConfiguration) - delete(rawMsg, key) - case "immutableId": - err = unpopulate(val, "ImmutableID", &d.ImmutableID) - delete(rawMsg, key) - case "logsIngestion": - err = unpopulate(val, "LogsIngestion", &d.LogsIngestion) - delete(rawMsg, key) - case "metadata": - err = unpopulate(val, "Metadata", &d.Metadata) - delete(rawMsg, key) - case "metricsIngestion": - err = unpopulate(val, "MetricsIngestion", &d.MetricsIngestion) - delete(rawMsg, key) - case "networkAcls": - err = unpopulate(val, "NetworkACLs", &d.NetworkACLs) - delete(rawMsg, key) - case "privateLinkScopedResources": - err = unpopulate(val, "PrivateLinkScopedResources", &d.PrivateLinkScopedResources) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionEndpointResourceSystemData. -func (d DataCollectionEndpointResourceSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", d.CreatedAt) - populate(objectMap, "createdBy", d.CreatedBy) - populate(objectMap, "createdByType", d.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", d.LastModifiedAt) - populate(objectMap, "lastModifiedBy", d.LastModifiedBy) - populate(objectMap, "lastModifiedByType", d.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionEndpointResourceSystemData. -func (d *DataCollectionEndpointResourceSystemData) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &d.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &d.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &d.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &d.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &d.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &d.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRule. -func (d DataCollectionRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataCollectionEndpointId", d.DataCollectionEndpointID) - populate(objectMap, "dataFlows", d.DataFlows) - populate(objectMap, "dataSources", d.DataSources) - populate(objectMap, "description", d.Description) - populate(objectMap, "destinations", d.Destinations) - populate(objectMap, "immutableId", d.ImmutableID) - populate(objectMap, "metadata", d.Metadata) - populate(objectMap, "provisioningState", d.ProvisioningState) - populate(objectMap, "streamDeclarations", d.StreamDeclarations) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRule. -func (d *DataCollectionRule) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataCollectionEndpointId": - err = unpopulate(val, "DataCollectionEndpointID", &d.DataCollectionEndpointID) - delete(rawMsg, key) - case "dataFlows": - err = unpopulate(val, "DataFlows", &d.DataFlows) - delete(rawMsg, key) - case "dataSources": - err = unpopulate(val, "DataSources", &d.DataSources) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &d.Description) - delete(rawMsg, key) - case "destinations": - err = unpopulate(val, "Destinations", &d.Destinations) - delete(rawMsg, key) - case "immutableId": - err = unpopulate(val, "ImmutableID", &d.ImmutableID) - delete(rawMsg, key) - case "metadata": - err = unpopulate(val, "Metadata", &d.Metadata) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) - delete(rawMsg, key) - case "streamDeclarations": - err = unpopulate(val, "StreamDeclarations", &d.StreamDeclarations) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociation. -func (d DataCollectionRuleAssociation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataCollectionEndpointId", d.DataCollectionEndpointID) - populate(objectMap, "dataCollectionRuleId", d.DataCollectionRuleID) - populate(objectMap, "description", d.Description) - populate(objectMap, "metadata", d.Metadata) - populate(objectMap, "provisioningState", d.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleAssociation. -func (d *DataCollectionRuleAssociation) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataCollectionEndpointId": - err = unpopulate(val, "DataCollectionEndpointID", &d.DataCollectionEndpointID) - delete(rawMsg, key) - case "dataCollectionRuleId": - err = unpopulate(val, "DataCollectionRuleID", &d.DataCollectionRuleID) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &d.Description) - delete(rawMsg, key) - case "metadata": - err = unpopulate(val, "Metadata", &d.Metadata) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociationMetadata. -func (d DataCollectionRuleAssociationMetadata) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "provisionedBy", d.ProvisionedBy) - populate(objectMap, "provisionedByResourceId", d.ProvisionedByResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleAssociationMetadata. -func (d *DataCollectionRuleAssociationMetadata) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "provisionedBy": - err = unpopulate(val, "ProvisionedBy", &d.ProvisionedBy) - delete(rawMsg, key) - case "provisionedByResourceId": - err = unpopulate(val, "ProvisionedByResourceID", &d.ProvisionedByResourceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociationProxyOnlyResource. -func (d DataCollectionRuleAssociationProxyOnlyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "etag", d.Etag) - populate(objectMap, "id", d.ID) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "systemData", d.SystemData) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleAssociationProxyOnlyResource. -func (d *DataCollectionRuleAssociationProxyOnlyResource) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &d.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &d.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &d.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociationProxyOnlyResourceListResult. -func (d DataCollectionRuleAssociationProxyOnlyResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleAssociationProxyOnlyResourceListResult. -func (d *DataCollectionRuleAssociationProxyOnlyResourceListResult) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &d.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &d.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociationProxyOnlyResourceProperties. -func (d DataCollectionRuleAssociationProxyOnlyResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataCollectionEndpointId", d.DataCollectionEndpointID) - populate(objectMap, "dataCollectionRuleId", d.DataCollectionRuleID) - populate(objectMap, "description", d.Description) - populate(objectMap, "metadata", d.Metadata) - populate(objectMap, "provisioningState", d.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleAssociationProxyOnlyResourceProperties. -func (d *DataCollectionRuleAssociationProxyOnlyResourceProperties) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataCollectionEndpointId": - err = unpopulate(val, "DataCollectionEndpointID", &d.DataCollectionEndpointID) - delete(rawMsg, key) - case "dataCollectionRuleId": - err = unpopulate(val, "DataCollectionRuleID", &d.DataCollectionRuleID) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &d.Description) - delete(rawMsg, key) - case "metadata": - err = unpopulate(val, "Metadata", &d.Metadata) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleAssociationProxyOnlyResourceSystemData. -func (d DataCollectionRuleAssociationProxyOnlyResourceSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", d.CreatedAt) - populate(objectMap, "createdBy", d.CreatedBy) - populate(objectMap, "createdByType", d.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", d.LastModifiedAt) - populate(objectMap, "lastModifiedBy", d.LastModifiedBy) - populate(objectMap, "lastModifiedByType", d.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleAssociationProxyOnlyResourceSystemData. -func (d *DataCollectionRuleAssociationProxyOnlyResourceSystemData) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &d.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &d.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &d.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &d.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &d.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &d.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleDataSources. -func (d DataCollectionRuleDataSources) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataImports", d.DataImports) - populate(objectMap, "extensions", d.Extensions) - populate(objectMap, "iisLogs", d.IisLogs) - populate(objectMap, "logFiles", d.LogFiles) - populate(objectMap, "performanceCounters", d.PerformanceCounters) - populate(objectMap, "platformTelemetry", d.PlatformTelemetry) - populate(objectMap, "prometheusForwarder", d.PrometheusForwarder) - populate(objectMap, "syslog", d.Syslog) - populate(objectMap, "windowsEventLogs", d.WindowsEventLogs) - populate(objectMap, "windowsFirewallLogs", d.WindowsFirewallLogs) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleDataSources. -func (d *DataCollectionRuleDataSources) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataImports": - err = unpopulate(val, "DataImports", &d.DataImports) - delete(rawMsg, key) - case "extensions": - err = unpopulate(val, "Extensions", &d.Extensions) - delete(rawMsg, key) - case "iisLogs": - err = unpopulate(val, "IisLogs", &d.IisLogs) - delete(rawMsg, key) - case "logFiles": - err = unpopulate(val, "LogFiles", &d.LogFiles) - delete(rawMsg, key) - case "performanceCounters": - err = unpopulate(val, "PerformanceCounters", &d.PerformanceCounters) - delete(rawMsg, key) - case "platformTelemetry": - err = unpopulate(val, "PlatformTelemetry", &d.PlatformTelemetry) - delete(rawMsg, key) - case "prometheusForwarder": - err = unpopulate(val, "PrometheusForwarder", &d.PrometheusForwarder) - delete(rawMsg, key) - case "syslog": - err = unpopulate(val, "Syslog", &d.Syslog) - delete(rawMsg, key) - case "windowsEventLogs": - err = unpopulate(val, "WindowsEventLogs", &d.WindowsEventLogs) - delete(rawMsg, key) - case "windowsFirewallLogs": - err = unpopulate(val, "WindowsFirewallLogs", &d.WindowsFirewallLogs) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleDestinations. -func (d DataCollectionRuleDestinations) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "azureMonitorMetrics", d.AzureMonitorMetrics) - populate(objectMap, "eventHubs", d.EventHubs) - populate(objectMap, "eventHubsDirect", d.EventHubsDirect) - populate(objectMap, "logAnalytics", d.LogAnalytics) - populate(objectMap, "monitoringAccounts", d.MonitoringAccounts) - populate(objectMap, "storageAccounts", d.StorageAccounts) - populate(objectMap, "storageBlobsDirect", d.StorageBlobsDirect) - populate(objectMap, "storageTablesDirect", d.StorageTablesDirect) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleDestinations. -func (d *DataCollectionRuleDestinations) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "azureMonitorMetrics": - err = unpopulate(val, "AzureMonitorMetrics", &d.AzureMonitorMetrics) - delete(rawMsg, key) - case "eventHubs": - err = unpopulate(val, "EventHubs", &d.EventHubs) - delete(rawMsg, key) - case "eventHubsDirect": - err = unpopulate(val, "EventHubsDirect", &d.EventHubsDirect) - delete(rawMsg, key) - case "logAnalytics": - err = unpopulate(val, "LogAnalytics", &d.LogAnalytics) - delete(rawMsg, key) - case "monitoringAccounts": - err = unpopulate(val, "MonitoringAccounts", &d.MonitoringAccounts) - delete(rawMsg, key) - case "storageAccounts": - err = unpopulate(val, "StorageAccounts", &d.StorageAccounts) - delete(rawMsg, key) - case "storageBlobsDirect": - err = unpopulate(val, "StorageBlobsDirect", &d.StorageBlobsDirect) - delete(rawMsg, key) - case "storageTablesDirect": - err = unpopulate(val, "StorageTablesDirect", &d.StorageTablesDirect) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleMetadata. -func (d DataCollectionRuleMetadata) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "provisionedBy", d.ProvisionedBy) - populate(objectMap, "provisionedByResourceId", d.ProvisionedByResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleMetadata. -func (d *DataCollectionRuleMetadata) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "provisionedBy": - err = unpopulate(val, "ProvisionedBy", &d.ProvisionedBy) - delete(rawMsg, key) - case "provisionedByResourceId": - err = unpopulate(val, "ProvisionedByResourceID", &d.ProvisionedByResourceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleResource. -func (d DataCollectionRuleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "etag", d.Etag) - populate(objectMap, "id", d.ID) - populate(objectMap, "identity", d.Identity) - populate(objectMap, "kind", d.Kind) - populate(objectMap, "location", d.Location) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "systemData", d.SystemData) - populate(objectMap, "tags", d.Tags) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleResource. -func (d *DataCollectionRuleResource) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &d.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &d.ID) - delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &d.Identity) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &d.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &d.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &d.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &d.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleResourceIdentity. -func (d DataCollectionRuleResourceIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "principalId", d.PrincipalID) - populate(objectMap, "tenantId", d.TenantID) - populate(objectMap, "type", d.Type) - populate(objectMap, "userAssignedIdentities", d.UserAssignedIdentities) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleResourceIdentity. -func (d *DataCollectionRuleResourceIdentity) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &d.PrincipalID) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &d.TenantID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) - delete(rawMsg, key) - case "userAssignedIdentities": - err = unpopulate(val, "UserAssignedIdentities", &d.UserAssignedIdentities) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleResourceListResult. -func (d DataCollectionRuleResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleResourceListResult. -func (d *DataCollectionRuleResourceListResult) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &d.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &d.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleResourceProperties. -func (d DataCollectionRuleResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataCollectionEndpointId", d.DataCollectionEndpointID) - populate(objectMap, "dataFlows", d.DataFlows) - populate(objectMap, "dataSources", d.DataSources) - populate(objectMap, "description", d.Description) - populate(objectMap, "destinations", d.Destinations) - populate(objectMap, "immutableId", d.ImmutableID) - populate(objectMap, "metadata", d.Metadata) - populate(objectMap, "provisioningState", d.ProvisioningState) - populate(objectMap, "streamDeclarations", d.StreamDeclarations) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleResourceProperties. -func (d *DataCollectionRuleResourceProperties) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataCollectionEndpointId": - err = unpopulate(val, "DataCollectionEndpointID", &d.DataCollectionEndpointID) - delete(rawMsg, key) - case "dataFlows": - err = unpopulate(val, "DataFlows", &d.DataFlows) - delete(rawMsg, key) - case "dataSources": - err = unpopulate(val, "DataSources", &d.DataSources) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &d.Description) - delete(rawMsg, key) - case "destinations": - err = unpopulate(val, "Destinations", &d.Destinations) - delete(rawMsg, key) - case "immutableId": - err = unpopulate(val, "ImmutableID", &d.ImmutableID) - delete(rawMsg, key) - case "metadata": - err = unpopulate(val, "Metadata", &d.Metadata) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) - delete(rawMsg, key) - case "streamDeclarations": - err = unpopulate(val, "StreamDeclarations", &d.StreamDeclarations) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataCollectionRuleResourceSystemData. -func (d DataCollectionRuleResourceSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", d.CreatedAt) - populate(objectMap, "createdBy", d.CreatedBy) - populate(objectMap, "createdByType", d.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", d.LastModifiedAt) - populate(objectMap, "lastModifiedBy", d.LastModifiedBy) - populate(objectMap, "lastModifiedByType", d.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionRuleResourceSystemData. -func (d *DataCollectionRuleResourceSystemData) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &d.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &d.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &d.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &d.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &d.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &d.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataContainer. -func (d DataContainer) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "workspace", d.Workspace) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataContainer. -func (d *DataContainer) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "workspace": - err = unpopulate(val, "Workspace", &d.Workspace) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataFlow. -func (d DataFlow) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "builtInTransform", d.BuiltInTransform) - populate(objectMap, "destinations", d.Destinations) - populate(objectMap, "outputStream", d.OutputStream) - populate(objectMap, "streams", d.Streams) - populate(objectMap, "transformKql", d.TransformKql) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataFlow. -func (d *DataFlow) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "builtInTransform": - err = unpopulate(val, "BuiltInTransform", &d.BuiltInTransform) - delete(rawMsg, key) - case "destinations": - err = unpopulate(val, "Destinations", &d.Destinations) - delete(rawMsg, key) - case "outputStream": - err = unpopulate(val, "OutputStream", &d.OutputStream) - delete(rawMsg, key) - case "streams": - err = unpopulate(val, "Streams", &d.Streams) - delete(rawMsg, key) - case "transformKql": - err = unpopulate(val, "TransformKql", &d.TransformKql) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataImportSources. -func (d DataImportSources) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "eventHub", d.EventHub) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataImportSources. -func (d *DataImportSources) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "eventHub": - err = unpopulate(val, "EventHub", &d.EventHub) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataImportSourcesEventHub. -func (d DataImportSourcesEventHub) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "consumerGroup", d.ConsumerGroup) - populate(objectMap, "name", d.Name) - populate(objectMap, "stream", d.Stream) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataImportSourcesEventHub. -func (d *DataImportSourcesEventHub) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "consumerGroup": - err = unpopulate(val, "ConsumerGroup", &d.ConsumerGroup) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "stream": - err = unpopulate(val, "Stream", &d.Stream) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataSourcesSpec. -func (d DataSourcesSpec) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataImports", d.DataImports) - populate(objectMap, "extensions", d.Extensions) - populate(objectMap, "iisLogs", d.IisLogs) - populate(objectMap, "logFiles", d.LogFiles) - populate(objectMap, "performanceCounters", d.PerformanceCounters) - populate(objectMap, "platformTelemetry", d.PlatformTelemetry) - populate(objectMap, "prometheusForwarder", d.PrometheusForwarder) - populate(objectMap, "syslog", d.Syslog) - populate(objectMap, "windowsEventLogs", d.WindowsEventLogs) - populate(objectMap, "windowsFirewallLogs", d.WindowsFirewallLogs) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataSourcesSpec. -func (d *DataSourcesSpec) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataImports": - err = unpopulate(val, "DataImports", &d.DataImports) - delete(rawMsg, key) - case "extensions": - err = unpopulate(val, "Extensions", &d.Extensions) - delete(rawMsg, key) - case "iisLogs": - err = unpopulate(val, "IisLogs", &d.IisLogs) - delete(rawMsg, key) - case "logFiles": - err = unpopulate(val, "LogFiles", &d.LogFiles) - delete(rawMsg, key) - case "performanceCounters": - err = unpopulate(val, "PerformanceCounters", &d.PerformanceCounters) - delete(rawMsg, key) - case "platformTelemetry": - err = unpopulate(val, "PlatformTelemetry", &d.PlatformTelemetry) - delete(rawMsg, key) - case "prometheusForwarder": - err = unpopulate(val, "PrometheusForwarder", &d.PrometheusForwarder) - delete(rawMsg, key) - case "syslog": - err = unpopulate(val, "Syslog", &d.Syslog) - delete(rawMsg, key) - case "windowsEventLogs": - err = unpopulate(val, "WindowsEventLogs", &d.WindowsEventLogs) - delete(rawMsg, key) - case "windowsFirewallLogs": - err = unpopulate(val, "WindowsFirewallLogs", &d.WindowsFirewallLogs) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataSourcesSpecDataImports. -func (d DataSourcesSpecDataImports) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "eventHub", d.EventHub) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataSourcesSpecDataImports. -func (d *DataSourcesSpecDataImports) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "eventHub": - err = unpopulate(val, "EventHub", &d.EventHub) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DefaultErrorResponse. -func (d DefaultErrorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "error", d.Error) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefaultErrorResponse. -func (d *DefaultErrorResponse) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "error": - err = unpopulate(val, "Error", &d.Error) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DestinationsSpec. -func (d DestinationsSpec) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "azureMonitorMetrics", d.AzureMonitorMetrics) - populate(objectMap, "eventHubs", d.EventHubs) - populate(objectMap, "eventHubsDirect", d.EventHubsDirect) - populate(objectMap, "logAnalytics", d.LogAnalytics) - populate(objectMap, "monitoringAccounts", d.MonitoringAccounts) - populate(objectMap, "storageAccounts", d.StorageAccounts) - populate(objectMap, "storageBlobsDirect", d.StorageBlobsDirect) - populate(objectMap, "storageTablesDirect", d.StorageTablesDirect) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DestinationsSpec. -func (d *DestinationsSpec) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "azureMonitorMetrics": - err = unpopulate(val, "AzureMonitorMetrics", &d.AzureMonitorMetrics) - delete(rawMsg, key) - case "eventHubs": - err = unpopulate(val, "EventHubs", &d.EventHubs) - delete(rawMsg, key) - case "eventHubsDirect": - err = unpopulate(val, "EventHubsDirect", &d.EventHubsDirect) - delete(rawMsg, key) - case "logAnalytics": - err = unpopulate(val, "LogAnalytics", &d.LogAnalytics) - delete(rawMsg, key) - case "monitoringAccounts": - err = unpopulate(val, "MonitoringAccounts", &d.MonitoringAccounts) - delete(rawMsg, key) - case "storageAccounts": - err = unpopulate(val, "StorageAccounts", &d.StorageAccounts) - delete(rawMsg, key) - case "storageBlobsDirect": - err = unpopulate(val, "StorageBlobsDirect", &d.StorageBlobsDirect) - delete(rawMsg, key) - case "storageTablesDirect": - err = unpopulate(val, "StorageTablesDirect", &d.StorageTablesDirect) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DestinationsSpecAzureMonitorMetrics. -func (d DestinationsSpecAzureMonitorMetrics) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", d.Name) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DestinationsSpecAzureMonitorMetrics. -func (d *DestinationsSpecAzureMonitorMetrics) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DiagnosticSettings. -func (d DiagnosticSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "eventHubAuthorizationRuleId", d.EventHubAuthorizationRuleID) - populate(objectMap, "eventHubName", d.EventHubName) - populate(objectMap, "logAnalyticsDestinationType", d.LogAnalyticsDestinationType) - populate(objectMap, "logs", d.Logs) - populate(objectMap, "marketplacePartnerId", d.MarketplacePartnerID) - populate(objectMap, "metrics", d.Metrics) - populate(objectMap, "serviceBusRuleId", d.ServiceBusRuleID) - populate(objectMap, "storageAccountId", d.StorageAccountID) - populate(objectMap, "workspaceId", d.WorkspaceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticSettings. -func (d *DiagnosticSettings) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "eventHubAuthorizationRuleId": - err = unpopulate(val, "EventHubAuthorizationRuleID", &d.EventHubAuthorizationRuleID) - delete(rawMsg, key) - case "eventHubName": - err = unpopulate(val, "EventHubName", &d.EventHubName) - delete(rawMsg, key) - case "logAnalyticsDestinationType": - err = unpopulate(val, "LogAnalyticsDestinationType", &d.LogAnalyticsDestinationType) - delete(rawMsg, key) - case "logs": - err = unpopulate(val, "Logs", &d.Logs) - delete(rawMsg, key) - case "marketplacePartnerId": - err = unpopulate(val, "MarketplacePartnerID", &d.MarketplacePartnerID) - delete(rawMsg, key) - case "metrics": - err = unpopulate(val, "Metrics", &d.Metrics) - delete(rawMsg, key) - case "serviceBusRuleId": - err = unpopulate(val, "ServiceBusRuleID", &d.ServiceBusRuleID) - delete(rawMsg, key) - case "storageAccountId": - err = unpopulate(val, "StorageAccountID", &d.StorageAccountID) - delete(rawMsg, key) - case "workspaceId": - err = unpopulate(val, "WorkspaceID", &d.WorkspaceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DiagnosticSettingsCategory. -func (d DiagnosticSettingsCategory) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "categoryGroups", d.CategoryGroups) - populate(objectMap, "categoryType", d.CategoryType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticSettingsCategory. -func (d *DiagnosticSettingsCategory) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "categoryGroups": - err = unpopulate(val, "CategoryGroups", &d.CategoryGroups) - delete(rawMsg, key) - case "categoryType": - err = unpopulate(val, "CategoryType", &d.CategoryType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DiagnosticSettingsCategoryResource. -func (d DiagnosticSettingsCategoryResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", d.ID) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "systemData", d.SystemData) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticSettingsCategoryResource. -func (d *DiagnosticSettingsCategoryResource) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &d.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &d.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DiagnosticSettingsCategoryResourceCollection. -func (d DiagnosticSettingsCategoryResourceCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", d.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticSettingsCategoryResourceCollection. -func (d *DiagnosticSettingsCategoryResourceCollection) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &d.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DiagnosticSettingsResource. -func (d DiagnosticSettingsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", d.ID) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "systemData", d.SystemData) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticSettingsResource. -func (d *DiagnosticSettingsResource) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &d.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &d.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DiagnosticSettingsResourceCollection. -func (d DiagnosticSettingsResourceCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", d.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticSettingsResourceCollection. -func (d *DiagnosticSettingsResourceCollection) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &d.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Dimension. -func (d Dimension) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", d.Name) - populate(objectMap, "operator", d.Operator) - populate(objectMap, "values", d.Values) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Dimension. -func (d *Dimension) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "operator": - err = unpopulate(val, "Operator", &d.Operator) - delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &d.Values) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DynamicMetricCriteria. -func (d DynamicMetricCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "alertSensitivity", d.AlertSensitivity) - objectMap["criterionType"] = CriterionTypeDynamicThresholdCriterion - populate(objectMap, "dimensions", d.Dimensions) - populate(objectMap, "failingPeriods", d.FailingPeriods) - populateDateTimeRFC3339(objectMap, "ignoreDataBefore", d.IgnoreDataBefore) - populate(objectMap, "metricName", d.MetricName) - populate(objectMap, "metricNamespace", d.MetricNamespace) - populate(objectMap, "name", d.Name) - populate(objectMap, "operator", d.Operator) - populate(objectMap, "skipMetricValidation", d.SkipMetricValidation) - populate(objectMap, "timeAggregation", d.TimeAggregation) - if d.AdditionalProperties != nil { - for key, val := range d.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DynamicMetricCriteria. -func (d *DynamicMetricCriteria) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "alertSensitivity": - err = unpopulate(val, "AlertSensitivity", &d.AlertSensitivity) - delete(rawMsg, key) - case "criterionType": - err = unpopulate(val, "CriterionType", &d.CriterionType) - delete(rawMsg, key) - case "dimensions": - err = unpopulate(val, "Dimensions", &d.Dimensions) - delete(rawMsg, key) - case "failingPeriods": - err = unpopulate(val, "FailingPeriods", &d.FailingPeriods) - delete(rawMsg, key) - case "ignoreDataBefore": - err = unpopulateDateTimeRFC3339(val, "IgnoreDataBefore", &d.IgnoreDataBefore) - delete(rawMsg, key) - case "metricName": - err = unpopulate(val, "MetricName", &d.MetricName) - delete(rawMsg, key) - case "metricNamespace": - err = unpopulate(val, "MetricNamespace", &d.MetricNamespace) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "operator": - err = unpopulate(val, "Operator", &d.Operator) - delete(rawMsg, key) - case "skipMetricValidation": - err = unpopulate(val, "SkipMetricValidation", &d.SkipMetricValidation) - delete(rawMsg, key) - case "timeAggregation": - err = unpopulate(val, "TimeAggregation", &d.TimeAggregation) - delete(rawMsg, key) - default: - if d.AdditionalProperties == nil { - d.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - d.AdditionalProperties[key] = aux - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DynamicThresholdFailingPeriods. -func (d DynamicThresholdFailingPeriods) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "minFailingPeriodsToAlert", d.MinFailingPeriodsToAlert) - populate(objectMap, "numberOfEvaluationPeriods", d.NumberOfEvaluationPeriods) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DynamicThresholdFailingPeriods. -func (d *DynamicThresholdFailingPeriods) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "minFailingPeriodsToAlert": - err = unpopulate(val, "MinFailingPeriodsToAlert", &d.MinFailingPeriodsToAlert) - delete(rawMsg, key) - case "numberOfEvaluationPeriods": - err = unpopulate(val, "NumberOfEvaluationPeriods", &d.NumberOfEvaluationPeriods) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EmailNotification. -func (e EmailNotification) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "customEmails", e.CustomEmails) - populate(objectMap, "sendToSubscriptionAdministrator", e.SendToSubscriptionAdministrator) - populate(objectMap, "sendToSubscriptionCoAdministrators", e.SendToSubscriptionCoAdministrators) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EmailNotification. -func (e *EmailNotification) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "customEmails": - err = unpopulate(val, "CustomEmails", &e.CustomEmails) - delete(rawMsg, key) - case "sendToSubscriptionAdministrator": - err = unpopulate(val, "SendToSubscriptionAdministrator", &e.SendToSubscriptionAdministrator) - delete(rawMsg, key) - case "sendToSubscriptionCoAdministrators": - err = unpopulate(val, "SendToSubscriptionCoAdministrators", &e.SendToSubscriptionCoAdministrators) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EmailReceiver. -func (e EmailReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "emailAddress", e.EmailAddress) - populate(objectMap, "name", e.Name) - populate(objectMap, "status", e.Status) - populate(objectMap, "useCommonAlertSchema", e.UseCommonAlertSchema) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EmailReceiver. -func (e *EmailReceiver) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "emailAddress": - err = unpopulate(val, "EmailAddress", &e.EmailAddress) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &e.Status) - delete(rawMsg, key) - case "useCommonAlertSchema": - err = unpopulate(val, "UseCommonAlertSchema", &e.UseCommonAlertSchema) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EmailReceiverAutoGenerated. -func (e EmailReceiverAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "emailAddress", e.EmailAddress) - populate(objectMap, "name", e.Name) - populate(objectMap, "status", e.Status) - populate(objectMap, "useCommonAlertSchema", e.UseCommonAlertSchema) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EmailReceiverAutoGenerated. -func (e *EmailReceiverAutoGenerated) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "emailAddress": - err = unpopulate(val, "EmailAddress", &e.EmailAddress) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &e.Status) - delete(rawMsg, key) - case "useCommonAlertSchema": - err = unpopulate(val, "UseCommonAlertSchema", &e.UseCommonAlertSchema) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EnableRequest. -func (e EnableRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "receiverName", e.ReceiverName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EnableRequest. -func (e *EnableRequest) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "receiverName": - err = unpopulate(val, "ReceiverName", &e.ReceiverName) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Error. -func (e Error) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "code", e.Code) - populate(objectMap, "message", e.Message) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Error. -func (e *Error) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "code": - err = unpopulate(val, "Code", &e.Code) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. -func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateAny(objectMap, "info", e.Info) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. -func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "info": - err = unpopulate(val, "Info", &e.Info) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorContract. -func (e ErrorContract) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorContract. -func (e *ErrorContract) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorContractAutoGenerated. -func (e ErrorContractAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorContractAutoGenerated. -func (e *ErrorContractAutoGenerated) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. -func (e ErrorDetail) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "additionalInfo", e.AdditionalInfo) - populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) - populate(objectMap, "message", e.Message) - populate(objectMap, "target", e.Target) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. -func (e *ErrorDetail) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "additionalInfo": - err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) - delete(rawMsg, key) - case "code": - err = unpopulate(val, "Code", &e.Code) - delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &e.Details) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &e.Target) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorDetailAutoGenerated. -func (e ErrorDetailAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "additionalInfo", e.AdditionalInfo) - populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) - populate(objectMap, "message", e.Message) - populate(objectMap, "target", e.Target) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetailAutoGenerated. -func (e *ErrorDetailAutoGenerated) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "additionalInfo": - err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) - delete(rawMsg, key) - case "code": - err = unpopulate(val, "Code", &e.Code) - delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &e.Details) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &e.Target) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. -func (e ErrorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "code", e.Code) - populate(objectMap, "message", e.Message) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. -func (e *ErrorResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "code": - err = unpopulate(val, "Code", &e.Code) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorResponseAdditionalInfo. -func (e ErrorResponseAdditionalInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateAny(objectMap, "info", e.Info) - populate(objectMap, "type", e.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAdditionalInfo. -func (e *ErrorResponseAdditionalInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "info": - err = unpopulate(val, "Info", &e.Info) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &e.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorResponseAutoGenerated. -func (e ErrorResponseAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "code", e.Code) - populate(objectMap, "message", e.Message) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAutoGenerated. -func (e *ErrorResponseAutoGenerated) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "code": - err = unpopulate(val, "Code", &e.Code) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorResponseAutoGenerated2. -func (e ErrorResponseAutoGenerated2) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAutoGenerated2. -func (e *ErrorResponseAutoGenerated2) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorResponseCommonV2. -func (e ErrorResponseCommonV2) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseCommonV2. -func (e *ErrorResponseCommonV2) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ErrorResponseDetails. -func (e ErrorResponseDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "additionalInfo", e.AdditionalInfo) - populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) - populate(objectMap, "message", e.Message) - populate(objectMap, "target", e.Target) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseDetails. -func (e *ErrorResponseDetails) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "additionalInfo": - err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) - delete(rawMsg, key) - case "code": - err = unpopulate(val, "Code", &e.Code) - delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &e.Details) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &e.Target) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EventCategoryCollection. -func (e EventCategoryCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", e.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventCategoryCollection. -func (e *EventCategoryCollection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &e.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EventData. -func (e EventData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "authorization", e.Authorization) - populate(objectMap, "caller", e.Caller) - populate(objectMap, "category", e.Category) - populate(objectMap, "claims", e.Claims) - populate(objectMap, "correlationId", e.CorrelationID) - populate(objectMap, "description", e.Description) - populate(objectMap, "eventDataId", e.EventDataID) - populate(objectMap, "eventName", e.EventName) - populateDateTimeRFC3339(objectMap, "eventTimestamp", e.EventTimestamp) - populate(objectMap, "httpRequest", e.HTTPRequest) - populate(objectMap, "id", e.ID) - populate(objectMap, "level", e.Level) - populate(objectMap, "operationId", e.OperationID) - populate(objectMap, "operationName", e.OperationName) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "resourceGroupName", e.ResourceGroupName) - populate(objectMap, "resourceId", e.ResourceID) - populate(objectMap, "resourceProviderName", e.ResourceProviderName) - populate(objectMap, "resourceType", e.ResourceType) - populate(objectMap, "status", e.Status) - populate(objectMap, "subStatus", e.SubStatus) - populateDateTimeRFC3339(objectMap, "submissionTimestamp", e.SubmissionTimestamp) - populate(objectMap, "subscriptionId", e.SubscriptionID) - populate(objectMap, "tenantId", e.TenantID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventData. -func (e *EventData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "authorization": - err = unpopulate(val, "Authorization", &e.Authorization) - delete(rawMsg, key) - case "caller": - err = unpopulate(val, "Caller", &e.Caller) - delete(rawMsg, key) - case "category": - err = unpopulate(val, "Category", &e.Category) - delete(rawMsg, key) - case "claims": - err = unpopulate(val, "Claims", &e.Claims) - delete(rawMsg, key) - case "correlationId": - err = unpopulate(val, "CorrelationID", &e.CorrelationID) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &e.Description) - delete(rawMsg, key) - case "eventDataId": - err = unpopulate(val, "EventDataID", &e.EventDataID) - delete(rawMsg, key) - case "eventName": - err = unpopulate(val, "EventName", &e.EventName) - delete(rawMsg, key) - case "eventTimestamp": - err = unpopulateDateTimeRFC3339(val, "EventTimestamp", &e.EventTimestamp) - delete(rawMsg, key) - case "httpRequest": - err = unpopulate(val, "HTTPRequest", &e.HTTPRequest) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &e.ID) - delete(rawMsg, key) - case "level": - err = unpopulate(val, "Level", &e.Level) - delete(rawMsg, key) - case "operationId": - err = unpopulate(val, "OperationID", &e.OperationID) - delete(rawMsg, key) - case "operationName": - err = unpopulate(val, "OperationName", &e.OperationName) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &e.Properties) - delete(rawMsg, key) - case "resourceGroupName": - err = unpopulate(val, "ResourceGroupName", &e.ResourceGroupName) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &e.ResourceID) - delete(rawMsg, key) - case "resourceProviderName": - err = unpopulate(val, "ResourceProviderName", &e.ResourceProviderName) - delete(rawMsg, key) - case "resourceType": - err = unpopulate(val, "ResourceType", &e.ResourceType) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &e.Status) - delete(rawMsg, key) - case "subStatus": - err = unpopulate(val, "SubStatus", &e.SubStatus) - delete(rawMsg, key) - case "submissionTimestamp": - err = unpopulateDateTimeRFC3339(val, "SubmissionTimestamp", &e.SubmissionTimestamp) - delete(rawMsg, key) - case "subscriptionId": - err = unpopulate(val, "SubscriptionID", &e.SubscriptionID) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &e.TenantID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EventDataCollection. -func (e EventDataCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", e.NextLink) - populate(objectMap, "value", e.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventDataCollection. -func (e *EventDataCollection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &e.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &e.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EventHubDataSource. -func (e EventHubDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "consumerGroup", e.ConsumerGroup) - populate(objectMap, "name", e.Name) - populate(objectMap, "stream", e.Stream) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubDataSource. -func (e *EventHubDataSource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "consumerGroup": - err = unpopulate(val, "ConsumerGroup", &e.ConsumerGroup) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "stream": - err = unpopulate(val, "Stream", &e.Stream) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EventHubDestination. -func (e EventHubDestination) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "eventHubResourceId", e.EventHubResourceID) - populate(objectMap, "name", e.Name) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubDestination. -func (e *EventHubDestination) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "eventHubResourceId": - err = unpopulate(val, "EventHubResourceID", &e.EventHubResourceID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EventHubDirectDestination. -func (e EventHubDirectDestination) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "eventHubResourceId", e.EventHubResourceID) - populate(objectMap, "name", e.Name) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubDirectDestination. -func (e *EventHubDirectDestination) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "eventHubResourceId": - err = unpopulate(val, "EventHubResourceID", &e.EventHubResourceID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type EventHubReceiver. -func (e EventHubReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "eventHubName", e.EventHubName) - populate(objectMap, "eventHubNameSpace", e.EventHubNameSpace) - populate(objectMap, "name", e.Name) - populate(objectMap, "subscriptionId", e.SubscriptionID) - populate(objectMap, "tenantId", e.TenantID) - populate(objectMap, "useCommonAlertSchema", e.UseCommonAlertSchema) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventHubReceiver. -func (e *EventHubReceiver) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "eventHubName": - err = unpopulate(val, "EventHubName", &e.EventHubName) - delete(rawMsg, key) - case "eventHubNameSpace": - err = unpopulate(val, "EventHubNameSpace", &e.EventHubNameSpace) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "subscriptionId": - err = unpopulate(val, "SubscriptionID", &e.SubscriptionID) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &e.TenantID) - delete(rawMsg, key) - case "useCommonAlertSchema": - err = unpopulate(val, "UseCommonAlertSchema", &e.UseCommonAlertSchema) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ExtensionDataSource. -func (e ExtensionDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "extensionName", e.ExtensionName) - populateAny(objectMap, "extensionSettings", e.ExtensionSettings) - populate(objectMap, "inputDataSources", e.InputDataSources) - populate(objectMap, "name", e.Name) - populate(objectMap, "streams", e.Streams) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ExtensionDataSource. -func (e *ExtensionDataSource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "extensionName": - err = unpopulate(val, "ExtensionName", &e.ExtensionName) - delete(rawMsg, key) - case "extensionSettings": - err = unpopulate(val, "ExtensionSettings", &e.ExtensionSettings) - delete(rawMsg, key) - case "inputDataSources": - err = unpopulate(val, "InputDataSources", &e.InputDataSources) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &e.Name) - delete(rawMsg, key) - case "streams": - err = unpopulate(val, "Streams", &e.Streams) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type FailoverConfigurationSpec. -func (f FailoverConfigurationSpec) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "activeLocation", f.ActiveLocation) - populate(objectMap, "locations", f.Locations) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FailoverConfigurationSpec. -func (f *FailoverConfigurationSpec) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "activeLocation": - err = unpopulate(val, "ActiveLocation", &f.ActiveLocation) - delete(rawMsg, key) - case "locations": - err = unpopulate(val, "Locations", &f.Locations) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type HTTPRequestInfo. -func (h HTTPRequestInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "clientIpAddress", h.ClientIPAddress) - populate(objectMap, "clientRequestId", h.ClientRequestID) - populate(objectMap, "method", h.Method) - populate(objectMap, "uri", h.URI) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPRequestInfo. -func (h *HTTPRequestInfo) 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", h, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "clientIpAddress": - err = unpopulate(val, "ClientIPAddress", &h.ClientIPAddress) - delete(rawMsg, key) - case "clientRequestId": - err = unpopulate(val, "ClientRequestID", &h.ClientRequestID) - delete(rawMsg, key) - case "method": - err = unpopulate(val, "Method", &h.Method) - delete(rawMsg, key) - case "uri": - err = unpopulate(val, "URI", &h.URI) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Identity. -func (i Identity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "principalId", i.PrincipalID) - populate(objectMap, "tenantId", i.TenantID) - populate(objectMap, "type", i.Type) - populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Identity. -func (i *Identity) 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", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &i.PrincipalID) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &i.TenantID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &i.Type) - delete(rawMsg, key) - case "userAssignedIdentities": - err = unpopulate(val, "UserAssignedIdentities", &i.UserAssignedIdentities) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IisLogsDataSource. -func (i IisLogsDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "logDirectories", i.LogDirectories) - populate(objectMap, "name", i.Name) - populate(objectMap, "streams", i.Streams) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IisLogsDataSource. -func (i *IisLogsDataSource) 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", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "logDirectories": - err = unpopulate(val, "LogDirectories", &i.LogDirectories) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &i.Name) - delete(rawMsg, key) - case "streams": - err = unpopulate(val, "Streams", &i.Streams) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Incident. -func (i Incident) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "activatedTime", i.ActivatedTime) - populate(objectMap, "isActive", i.IsActive) - populate(objectMap, "name", i.Name) - populateDateTimeRFC3339(objectMap, "resolvedTime", i.ResolvedTime) - populate(objectMap, "ruleName", i.RuleName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Incident. -func (i *Incident) 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", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "activatedTime": - err = unpopulateDateTimeRFC3339(val, "ActivatedTime", &i.ActivatedTime) - delete(rawMsg, key) - case "isActive": - err = unpopulate(val, "IsActive", &i.IsActive) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &i.Name) - delete(rawMsg, key) - case "resolvedTime": - err = unpopulateDateTimeRFC3339(val, "ResolvedTime", &i.ResolvedTime) - delete(rawMsg, key) - case "ruleName": - err = unpopulate(val, "RuleName", &i.RuleName) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IncidentListResult. -func (i IncidentListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", i.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IncidentListResult. -func (i *IncidentListResult) 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", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &i.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IngestionSettings. -func (i IngestionSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataCollectionEndpointResourceId", i.DataCollectionEndpointResourceID) - populate(objectMap, "dataCollectionRuleResourceId", i.DataCollectionRuleResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IngestionSettings. -func (i *IngestionSettings) 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", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataCollectionEndpointResourceId": - err = unpopulate(val, "DataCollectionEndpointResourceID", &i.DataCollectionEndpointResourceID) - delete(rawMsg, key) - case "dataCollectionRuleResourceId": - err = unpopulate(val, "DataCollectionRuleResourceID", &i.DataCollectionRuleResourceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ItsmReceiver. -func (i ItsmReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "connectionId", i.ConnectionID) - populate(objectMap, "name", i.Name) - populate(objectMap, "region", i.Region) - populate(objectMap, "ticketConfiguration", i.TicketConfiguration) - populate(objectMap, "workspaceId", i.WorkspaceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ItsmReceiver. -func (i *ItsmReceiver) 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", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "connectionId": - err = unpopulate(val, "ConnectionID", &i.ConnectionID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &i.Name) - delete(rawMsg, key) - case "region": - err = unpopulate(val, "Region", &i.Region) - delete(rawMsg, key) - case "ticketConfiguration": - err = unpopulate(val, "TicketConfiguration", &i.TicketConfiguration) - delete(rawMsg, key) - case "workspaceId": - err = unpopulate(val, "WorkspaceID", &i.WorkspaceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LocalizableString. -func (l LocalizableString) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "localizedValue", l.LocalizedValue) - populate(objectMap, "value", l.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LocalizableString. -func (l *LocalizableString) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "localizedValue": - err = unpopulate(val, "LocalizedValue", &l.LocalizedValue) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &l.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LocationSpec. -func (l LocationSpec) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "location", l.Location) - populate(objectMap, "provisioningStatus", l.ProvisioningStatus) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LocationSpec. -func (l *LocationSpec) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "location": - err = unpopulate(val, "Location", &l.Location) - delete(rawMsg, key) - case "provisioningStatus": - err = unpopulate(val, "ProvisioningStatus", &l.ProvisioningStatus) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LocationThresholdRuleCondition. -func (l LocationThresholdRuleCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataSource", l.DataSource) - populate(objectMap, "failedLocationCount", l.FailedLocationCount) - objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition" - populate(objectMap, "windowSize", l.WindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LocationThresholdRuleCondition. -func (l *LocationThresholdRuleCondition) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataSource": - l.DataSource, err = unmarshalRuleDataSourceClassification(val) - delete(rawMsg, key) - case "failedLocationCount": - err = unpopulate(val, "FailedLocationCount", &l.FailedLocationCount) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &l.ODataType) - delete(rawMsg, key) - case "windowSize": - err = unpopulate(val, "WindowSize", &l.WindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LogAnalyticsDestination. -func (l LogAnalyticsDestination) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", l.Name) - populate(objectMap, "workspaceId", l.WorkspaceID) - populate(objectMap, "workspaceResourceId", l.WorkspaceResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogAnalyticsDestination. -func (l *LogAnalyticsDestination) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &l.Name) - delete(rawMsg, key) - case "workspaceId": - err = unpopulate(val, "WorkspaceID", &l.WorkspaceID) - delete(rawMsg, key) - case "workspaceResourceId": - err = unpopulate(val, "WorkspaceResourceID", &l.WorkspaceResourceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LogFileSettings. -func (l LogFileSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "text", l.Text) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogFileSettings. -func (l *LogFileSettings) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "text": - err = unpopulate(val, "Text", &l.Text) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LogFileSettingsText. -func (l LogFileSettingsText) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "recordStartTimestampFormat", l.RecordStartTimestampFormat) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogFileSettingsText. -func (l *LogFileSettingsText) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "recordStartTimestampFormat": - err = unpopulate(val, "RecordStartTimestampFormat", &l.RecordStartTimestampFormat) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LogFileTextSettings. -func (l LogFileTextSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "recordStartTimestampFormat", l.RecordStartTimestampFormat) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogFileTextSettings. -func (l *LogFileTextSettings) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "recordStartTimestampFormat": - err = unpopulate(val, "RecordStartTimestampFormat", &l.RecordStartTimestampFormat) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LogFilesDataSource. -func (l LogFilesDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "filePatterns", l.FilePatterns) - populate(objectMap, "format", l.Format) - populate(objectMap, "name", l.Name) - populate(objectMap, "settings", l.Settings) - populate(objectMap, "streams", l.Streams) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogFilesDataSource. -func (l *LogFilesDataSource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "filePatterns": - err = unpopulate(val, "FilePatterns", &l.FilePatterns) - delete(rawMsg, key) - case "format": - err = unpopulate(val, "Format", &l.Format) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &l.Name) - delete(rawMsg, key) - case "settings": - err = unpopulate(val, "Settings", &l.Settings) - delete(rawMsg, key) - case "streams": - err = unpopulate(val, "Streams", &l.Streams) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LogFilesDataSourceSettings. -func (l LogFilesDataSourceSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "text", l.Text) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogFilesDataSourceSettings. -func (l *LogFilesDataSourceSettings) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "text": - err = unpopulate(val, "Text", &l.Text) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LogProfileCollection. -func (l LogProfileCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", l.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogProfileCollection. -func (l *LogProfileCollection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &l.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LogProfileProperties. -func (l LogProfileProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "categories", l.Categories) - populate(objectMap, "locations", l.Locations) - populate(objectMap, "retentionPolicy", l.RetentionPolicy) - populate(objectMap, "serviceBusRuleId", l.ServiceBusRuleID) - populate(objectMap, "storageAccountId", l.StorageAccountID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogProfileProperties. -func (l *LogProfileProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "categories": - err = unpopulate(val, "Categories", &l.Categories) - delete(rawMsg, key) - case "locations": - err = unpopulate(val, "Locations", &l.Locations) - delete(rawMsg, key) - case "retentionPolicy": - err = unpopulate(val, "RetentionPolicy", &l.RetentionPolicy) - delete(rawMsg, key) - case "serviceBusRuleId": - err = unpopulate(val, "ServiceBusRuleID", &l.ServiceBusRuleID) - delete(rawMsg, key) - case "storageAccountId": - err = unpopulate(val, "StorageAccountID", &l.StorageAccountID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LogProfileResource. -func (l LogProfileResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", l.ID) - populate(objectMap, "location", l.Location) - populate(objectMap, "name", l.Name) - populate(objectMap, "properties", l.Properties) - populate(objectMap, "tags", l.Tags) - populate(objectMap, "type", l.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogProfileResource. -func (l *LogProfileResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &l.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &l.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &l.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &l.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &l.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &l.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LogProfileResourcePatch. -func (l LogProfileResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "properties", l.Properties) - populate(objectMap, "tags", l.Tags) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogProfileResourcePatch. -func (l *LogProfileResourcePatch) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "properties": - err = unpopulate(val, "Properties", &l.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &l.Tags) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LogSettings. -func (l LogSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "category", l.Category) - populate(objectMap, "categoryGroup", l.CategoryGroup) - populate(objectMap, "enabled", l.Enabled) - populate(objectMap, "retentionPolicy", l.RetentionPolicy) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogSettings. -func (l *LogSettings) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "category": - err = unpopulate(val, "Category", &l.Category) - delete(rawMsg, key) - case "categoryGroup": - err = unpopulate(val, "CategoryGroup", &l.CategoryGroup) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &l.Enabled) - delete(rawMsg, key) - case "retentionPolicy": - err = unpopulate(val, "RetentionPolicy", &l.RetentionPolicy) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LogicAppReceiver. -func (l LogicAppReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "callbackUrl", l.CallbackURL) - populate(objectMap, "name", l.Name) - populate(objectMap, "resourceId", l.ResourceID) - populate(objectMap, "useCommonAlertSchema", l.UseCommonAlertSchema) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogicAppReceiver. -func (l *LogicAppReceiver) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "callbackUrl": - err = unpopulate(val, "CallbackURL", &l.CallbackURL) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &l.Name) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &l.ResourceID) - delete(rawMsg, key) - case "useCommonAlertSchema": - err = unpopulate(val, "UseCommonAlertSchema", &l.UseCommonAlertSchema) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LogsIngestionEndpointSpec. -func (l LogsIngestionEndpointSpec) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "endpoint", l.Endpoint) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogsIngestionEndpointSpec. -func (l *LogsIngestionEndpointSpec) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endpoint": - err = unpopulate(val, "Endpoint", &l.Endpoint) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. -func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "principalId", m.PrincipalID) - populate(objectMap, "tenantId", m.TenantID) - populate(objectMap, "type", m.Type) - populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServiceIdentity. -func (m *ManagedServiceIdentity) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &m.PrincipalID) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &m.TenantID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) - delete(rawMsg, key) - case "userAssignedIdentities": - err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ManagementEventAggregationCondition. -func (m ManagementEventAggregationCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "operator", m.Operator) - populate(objectMap, "threshold", m.Threshold) - populate(objectMap, "windowSize", m.WindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementEventAggregationCondition. -func (m *ManagementEventAggregationCondition) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "operator": - err = unpopulate(val, "Operator", &m.Operator) - delete(rawMsg, key) - case "threshold": - err = unpopulate(val, "Threshold", &m.Threshold) - delete(rawMsg, key) - case "windowSize": - err = unpopulate(val, "WindowSize", &m.WindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ManagementEventRuleCondition. -func (m ManagementEventRuleCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "aggregation", m.Aggregation) - populate(objectMap, "dataSource", m.DataSource) - objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ManagementEventRuleCondition. -func (m *ManagementEventRuleCondition) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "aggregation": - err = unpopulate(val, "Aggregation", &m.Aggregation) - delete(rawMsg, key) - case "dataSource": - m.DataSource, err = unmarshalRuleDataSourceClassification(val) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &m.ODataType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Metadata. -func (m Metadata) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "provisionedBy", m.ProvisionedBy) - populate(objectMap, "provisionedByResourceId", m.ProvisionedByResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Metadata. -func (m *Metadata) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "provisionedBy": - err = unpopulate(val, "ProvisionedBy", &m.ProvisionedBy) - delete(rawMsg, key) - case "provisionedByResourceId": - err = unpopulate(val, "ProvisionedByResourceID", &m.ProvisionedByResourceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetadataValue. -func (m MetadataValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", m.Name) - populate(objectMap, "value", m.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetadataValue. -func (m *MetadataValue) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &m.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Metric. -func (m Metric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "displayDescription", m.DisplayDescription) - populate(objectMap, "errorCode", m.ErrorCode) - populate(objectMap, "errorMessage", m.ErrorMessage) - populate(objectMap, "id", m.ID) - populate(objectMap, "name", m.Name) - populate(objectMap, "timeseries", m.Timeseries) - populate(objectMap, "type", m.Type) - populate(objectMap, "unit", m.Unit) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Metric. -func (m *Metric) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "displayDescription": - err = unpopulate(val, "DisplayDescription", &m.DisplayDescription) - delete(rawMsg, key) - case "errorCode": - err = unpopulate(val, "ErrorCode", &m.ErrorCode) - delete(rawMsg, key) - case "errorMessage": - err = unpopulate(val, "ErrorMessage", &m.ErrorMessage) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &m.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "timeseries": - err = unpopulate(val, "Timeseries", &m.Timeseries) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) - delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &m.Unit) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertAction. -func (m MetricAlertAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actionGroupId", m.ActionGroupID) - populate(objectMap, "webHookProperties", m.WebHookProperties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertAction. -func (m *MetricAlertAction) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actionGroupId": - err = unpopulate(val, "ActionGroupID", &m.ActionGroupID) - delete(rawMsg, key) - case "webHookProperties": - err = unpopulate(val, "WebHookProperties", &m.WebHookProperties) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertCriteria. -func (m MetricAlertCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["odata.type"] = m.ODataType - if m.AdditionalProperties != nil { - for key, val := range m.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertCriteria. -func (m *MetricAlertCriteria) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "odata.type": - err = unpopulate(val, "ODataType", &m.ODataType) - delete(rawMsg, key) - default: - if m.AdditionalProperties == nil { - m.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - m.AdditionalProperties[key] = aux - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertMultipleResourceMultipleMetricCriteria. -func (m MetricAlertMultipleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "allOf", m.AllOf) - objectMap["odata.type"] = OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria - if m.AdditionalProperties != nil { - for key, val := range m.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertMultipleResourceMultipleMetricCriteria. -func (m *MetricAlertMultipleResourceMultipleMetricCriteria) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "allOf": - m.AllOf, err = unmarshalMultiMetricCriteriaClassificationArray(val) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &m.ODataType) - delete(rawMsg, key) - default: - if m.AdditionalProperties == nil { - m.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - m.AdditionalProperties[key] = aux - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertProperties. -func (m MetricAlertProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actions", m.Actions) - populate(objectMap, "autoMitigate", m.AutoMitigate) - populate(objectMap, "criteria", m.Criteria) - populate(objectMap, "description", m.Description) - populate(objectMap, "enabled", m.Enabled) - populate(objectMap, "evaluationFrequency", m.EvaluationFrequency) - populate(objectMap, "isMigrated", m.IsMigrated) - populateDateTimeRFC3339(objectMap, "lastUpdatedTime", m.LastUpdatedTime) - populate(objectMap, "scopes", m.Scopes) - populate(objectMap, "severity", m.Severity) - populate(objectMap, "targetResourceRegion", m.TargetResourceRegion) - populate(objectMap, "targetResourceType", m.TargetResourceType) - populate(objectMap, "windowSize", m.WindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertProperties. -func (m *MetricAlertProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actions": - err = unpopulate(val, "Actions", &m.Actions) - delete(rawMsg, key) - case "autoMitigate": - err = unpopulate(val, "AutoMitigate", &m.AutoMitigate) - delete(rawMsg, key) - case "criteria": - m.Criteria, err = unmarshalMetricAlertCriteriaClassification(val) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &m.Description) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &m.Enabled) - delete(rawMsg, key) - case "evaluationFrequency": - err = unpopulate(val, "EvaluationFrequency", &m.EvaluationFrequency) - delete(rawMsg, key) - case "isMigrated": - err = unpopulate(val, "IsMigrated", &m.IsMigrated) - delete(rawMsg, key) - case "lastUpdatedTime": - err = unpopulateDateTimeRFC3339(val, "LastUpdatedTime", &m.LastUpdatedTime) - delete(rawMsg, key) - case "scopes": - err = unpopulate(val, "Scopes", &m.Scopes) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &m.Severity) - delete(rawMsg, key) - case "targetResourceRegion": - err = unpopulate(val, "TargetResourceRegion", &m.TargetResourceRegion) - delete(rawMsg, key) - case "targetResourceType": - err = unpopulate(val, "TargetResourceType", &m.TargetResourceType) - delete(rawMsg, key) - case "windowSize": - err = unpopulate(val, "WindowSize", &m.WindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertPropertiesPatch. -func (m MetricAlertPropertiesPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actions", m.Actions) - populate(objectMap, "autoMitigate", m.AutoMitigate) - populate(objectMap, "criteria", m.Criteria) - populate(objectMap, "description", m.Description) - populate(objectMap, "enabled", m.Enabled) - populate(objectMap, "evaluationFrequency", m.EvaluationFrequency) - populate(objectMap, "isMigrated", m.IsMigrated) - populateDateTimeRFC3339(objectMap, "lastUpdatedTime", m.LastUpdatedTime) - populate(objectMap, "scopes", m.Scopes) - populate(objectMap, "severity", m.Severity) - populate(objectMap, "targetResourceRegion", m.TargetResourceRegion) - populate(objectMap, "targetResourceType", m.TargetResourceType) - populate(objectMap, "windowSize", m.WindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertPropertiesPatch. -func (m *MetricAlertPropertiesPatch) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actions": - err = unpopulate(val, "Actions", &m.Actions) - delete(rawMsg, key) - case "autoMitigate": - err = unpopulate(val, "AutoMitigate", &m.AutoMitigate) - delete(rawMsg, key) - case "criteria": - m.Criteria, err = unmarshalMetricAlertCriteriaClassification(val) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &m.Description) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &m.Enabled) - delete(rawMsg, key) - case "evaluationFrequency": - err = unpopulate(val, "EvaluationFrequency", &m.EvaluationFrequency) - delete(rawMsg, key) - case "isMigrated": - err = unpopulate(val, "IsMigrated", &m.IsMigrated) - delete(rawMsg, key) - case "lastUpdatedTime": - err = unpopulateDateTimeRFC3339(val, "LastUpdatedTime", &m.LastUpdatedTime) - delete(rawMsg, key) - case "scopes": - err = unpopulate(val, "Scopes", &m.Scopes) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &m.Severity) - delete(rawMsg, key) - case "targetResourceRegion": - err = unpopulate(val, "TargetResourceRegion", &m.TargetResourceRegion) - delete(rawMsg, key) - case "targetResourceType": - err = unpopulate(val, "TargetResourceType", &m.TargetResourceType) - delete(rawMsg, key) - case "windowSize": - err = unpopulate(val, "WindowSize", &m.WindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertResource. -func (m MetricAlertResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", m.ID) - populate(objectMap, "location", m.Location) - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "tags", m.Tags) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertResource. -func (m *MetricAlertResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &m.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &m.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &m.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &m.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertResourceCollection. -func (m MetricAlertResourceCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", m.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertResourceCollection. -func (m *MetricAlertResourceCollection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &m.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertResourcePatch. -func (m MetricAlertResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "tags", m.Tags) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertResourcePatch. -func (m *MetricAlertResourcePatch) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "properties": - err = unpopulate(val, "Properties", &m.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &m.Tags) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertSingleResourceMultipleMetricCriteria. -func (m MetricAlertSingleResourceMultipleMetricCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "allOf", m.AllOf) - objectMap["odata.type"] = OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria - if m.AdditionalProperties != nil { - for key, val := range m.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertSingleResourceMultipleMetricCriteria. -func (m *MetricAlertSingleResourceMultipleMetricCriteria) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "allOf": - err = unpopulate(val, "AllOf", &m.AllOf) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &m.ODataType) - delete(rawMsg, key) - default: - if m.AdditionalProperties == nil { - m.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - m.AdditionalProperties[key] = aux - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertStatus. -func (m MetricAlertStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", m.ID) - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertStatus. -func (m *MetricAlertStatus) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &m.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &m.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertStatusCollection. -func (m MetricAlertStatusCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", m.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertStatusCollection. -func (m *MetricAlertStatusCollection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &m.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAlertStatusProperties. -func (m MetricAlertStatusProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dimensions", m.Dimensions) - populate(objectMap, "status", m.Status) - populateDateTimeRFC3339(objectMap, "timestamp", m.Timestamp) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAlertStatusProperties. -func (m *MetricAlertStatusProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dimensions": - err = unpopulate(val, "Dimensions", &m.Dimensions) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &m.Status) - delete(rawMsg, key) - case "timestamp": - err = unpopulateDateTimeRFC3339(val, "Timestamp", &m.Timestamp) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricAvailability. -func (m MetricAvailability) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "retention", m.Retention) - populate(objectMap, "timeGrain", m.TimeGrain) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricAvailability. -func (m *MetricAvailability) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "retention": - err = unpopulate(val, "Retention", &m.Retention) - delete(rawMsg, key) - case "timeGrain": - err = unpopulate(val, "TimeGrain", &m.TimeGrain) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricBaselinesProperties. -func (m MetricBaselinesProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "baselines", m.Baselines) - populate(objectMap, "interval", m.Interval) - populate(objectMap, "namespace", m.Namespace) - populate(objectMap, "timespan", m.Timespan) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricBaselinesProperties. -func (m *MetricBaselinesProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "baselines": - err = unpopulate(val, "Baselines", &m.Baselines) - delete(rawMsg, key) - case "interval": - err = unpopulate(val, "Interval", &m.Interval) - delete(rawMsg, key) - case "namespace": - err = unpopulate(val, "Namespace", &m.Namespace) - delete(rawMsg, key) - case "timespan": - err = unpopulate(val, "Timespan", &m.Timespan) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricBaselinesResponse. -func (m MetricBaselinesResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", m.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricBaselinesResponse. -func (m *MetricBaselinesResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &m.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricCriteria. -func (m MetricCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["criterionType"] = CriterionTypeStaticThresholdCriterion - populate(objectMap, "dimensions", m.Dimensions) - populate(objectMap, "metricName", m.MetricName) - populate(objectMap, "metricNamespace", m.MetricNamespace) - populate(objectMap, "name", m.Name) - populate(objectMap, "operator", m.Operator) - populate(objectMap, "skipMetricValidation", m.SkipMetricValidation) - populate(objectMap, "threshold", m.Threshold) - populate(objectMap, "timeAggregation", m.TimeAggregation) - if m.AdditionalProperties != nil { - for key, val := range m.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricCriteria. -func (m *MetricCriteria) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "criterionType": - err = unpopulate(val, "CriterionType", &m.CriterionType) - delete(rawMsg, key) - case "dimensions": - err = unpopulate(val, "Dimensions", &m.Dimensions) - delete(rawMsg, key) - case "metricName": - err = unpopulate(val, "MetricName", &m.MetricName) - delete(rawMsg, key) - case "metricNamespace": - err = unpopulate(val, "MetricNamespace", &m.MetricNamespace) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "operator": - err = unpopulate(val, "Operator", &m.Operator) - delete(rawMsg, key) - case "skipMetricValidation": - err = unpopulate(val, "SkipMetricValidation", &m.SkipMetricValidation) - delete(rawMsg, key) - case "threshold": - err = unpopulate(val, "Threshold", &m.Threshold) - delete(rawMsg, key) - case "timeAggregation": - err = unpopulate(val, "TimeAggregation", &m.TimeAggregation) - delete(rawMsg, key) - default: - if m.AdditionalProperties == nil { - m.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - m.AdditionalProperties[key] = aux - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricDefinition. -func (m MetricDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "category", m.Category) - populate(objectMap, "dimensions", m.Dimensions) - populate(objectMap, "displayDescription", m.DisplayDescription) - populate(objectMap, "id", m.ID) - populate(objectMap, "isDimensionRequired", m.IsDimensionRequired) - populate(objectMap, "metricAvailabilities", m.MetricAvailabilities) - populate(objectMap, "metricClass", m.MetricClass) - populate(objectMap, "name", m.Name) - populate(objectMap, "namespace", m.Namespace) - populate(objectMap, "primaryAggregationType", m.PrimaryAggregationType) - populate(objectMap, "resourceId", m.ResourceID) - populate(objectMap, "supportedAggregationTypes", m.SupportedAggregationTypes) - populate(objectMap, "unit", m.Unit) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricDefinition. -func (m *MetricDefinition) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "category": - err = unpopulate(val, "Category", &m.Category) - delete(rawMsg, key) - case "dimensions": - err = unpopulate(val, "Dimensions", &m.Dimensions) - delete(rawMsg, key) - case "displayDescription": - err = unpopulate(val, "DisplayDescription", &m.DisplayDescription) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &m.ID) - delete(rawMsg, key) - case "isDimensionRequired": - err = unpopulate(val, "IsDimensionRequired", &m.IsDimensionRequired) - delete(rawMsg, key) - case "metricAvailabilities": - err = unpopulate(val, "MetricAvailabilities", &m.MetricAvailabilities) - delete(rawMsg, key) - case "metricClass": - err = unpopulate(val, "MetricClass", &m.MetricClass) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "namespace": - err = unpopulate(val, "Namespace", &m.Namespace) - delete(rawMsg, key) - case "primaryAggregationType": - err = unpopulate(val, "PrimaryAggregationType", &m.PrimaryAggregationType) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &m.ResourceID) - delete(rawMsg, key) - case "supportedAggregationTypes": - err = unpopulate(val, "SupportedAggregationTypes", &m.SupportedAggregationTypes) - delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &m.Unit) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricDefinitionCollection. -func (m MetricDefinitionCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", m.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricDefinitionCollection. -func (m *MetricDefinitionCollection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &m.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricDimension. -func (m MetricDimension) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", m.Name) - populate(objectMap, "operator", m.Operator) - populate(objectMap, "values", m.Values) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricDimension. -func (m *MetricDimension) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "operator": - err = unpopulate(val, "Operator", &m.Operator) - delete(rawMsg, key) - case "values": - err = unpopulate(val, "Values", &m.Values) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricNamespace. -func (m MetricNamespace) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "classification", m.Classification) - populate(objectMap, "id", m.ID) - populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "type", m.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricNamespace. -func (m *MetricNamespace) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "classification": - err = unpopulate(val, "Classification", &m.Classification) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &m.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &m.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricNamespaceCollection. -func (m MetricNamespaceCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", m.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricNamespaceCollection. -func (m *MetricNamespaceCollection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &m.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricNamespaceName. -func (m MetricNamespaceName) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "metricNamespaceName", m.MetricNamespaceName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricNamespaceName. -func (m *MetricNamespaceName) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "metricNamespaceName": - err = unpopulate(val, "MetricNamespaceName", &m.MetricNamespaceName) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricSettings. -func (m MetricSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "category", m.Category) - populate(objectMap, "enabled", m.Enabled) - populate(objectMap, "retentionPolicy", m.RetentionPolicy) - populate(objectMap, "timeGrain", m.TimeGrain) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricSettings. -func (m *MetricSettings) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "category": - err = unpopulate(val, "Category", &m.Category) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &m.Enabled) - delete(rawMsg, key) - case "retentionPolicy": - err = unpopulate(val, "RetentionPolicy", &m.RetentionPolicy) - delete(rawMsg, key) - case "timeGrain": - err = unpopulate(val, "TimeGrain", &m.TimeGrain) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricSingleDimension. -func (m MetricSingleDimension) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", m.Name) - populate(objectMap, "value", m.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricSingleDimension. -func (m *MetricSingleDimension) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &m.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricTrigger. -func (m MetricTrigger) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dimensions", m.Dimensions) - populate(objectMap, "dividePerInstance", m.DividePerInstance) - populate(objectMap, "metricName", m.MetricName) - populate(objectMap, "metricNamespace", m.MetricNamespace) - populate(objectMap, "metricResourceLocation", m.MetricResourceLocation) - populate(objectMap, "metricResourceUri", m.MetricResourceURI) - populate(objectMap, "operator", m.Operator) - populate(objectMap, "statistic", m.Statistic) - populate(objectMap, "threshold", m.Threshold) - populate(objectMap, "timeAggregation", m.TimeAggregation) - populate(objectMap, "timeGrain", m.TimeGrain) - populate(objectMap, "timeWindow", m.TimeWindow) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricTrigger. -func (m *MetricTrigger) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dimensions": - err = unpopulate(val, "Dimensions", &m.Dimensions) - delete(rawMsg, key) - case "dividePerInstance": - err = unpopulate(val, "DividePerInstance", &m.DividePerInstance) - delete(rawMsg, key) - case "metricName": - err = unpopulate(val, "MetricName", &m.MetricName) - delete(rawMsg, key) - case "metricNamespace": - err = unpopulate(val, "MetricNamespace", &m.MetricNamespace) - delete(rawMsg, key) - case "metricResourceLocation": - err = unpopulate(val, "MetricResourceLocation", &m.MetricResourceLocation) - delete(rawMsg, key) - case "metricResourceUri": - err = unpopulate(val, "MetricResourceURI", &m.MetricResourceURI) - delete(rawMsg, key) - case "operator": - err = unpopulate(val, "Operator", &m.Operator) - delete(rawMsg, key) - case "statistic": - err = unpopulate(val, "Statistic", &m.Statistic) - delete(rawMsg, key) - case "threshold": - err = unpopulate(val, "Threshold", &m.Threshold) - delete(rawMsg, key) - case "timeAggregation": - err = unpopulate(val, "TimeAggregation", &m.TimeAggregation) - delete(rawMsg, key) - case "timeGrain": - err = unpopulate(val, "TimeGrain", &m.TimeGrain) - delete(rawMsg, key) - case "timeWindow": - err = unpopulate(val, "TimeWindow", &m.TimeWindow) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricValue. -func (m MetricValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "average", m.Average) - populate(objectMap, "count", m.Count) - populate(objectMap, "maximum", m.Maximum) - populate(objectMap, "minimum", m.Minimum) - populateDateTimeRFC3339(objectMap, "timeStamp", m.TimeStamp) - populate(objectMap, "total", m.Total) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricValue. -func (m *MetricValue) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "average": - err = unpopulate(val, "Average", &m.Average) - delete(rawMsg, key) - case "count": - err = unpopulate(val, "Count", &m.Count) - delete(rawMsg, key) - case "maximum": - err = unpopulate(val, "Maximum", &m.Maximum) - delete(rawMsg, key) - case "minimum": - err = unpopulate(val, "Minimum", &m.Minimum) - delete(rawMsg, key) - case "timeStamp": - err = unpopulateDateTimeRFC3339(val, "TimeStamp", &m.TimeStamp) - delete(rawMsg, key) - case "total": - err = unpopulate(val, "Total", &m.Total) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Metrics. -func (m Metrics) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "internalId", m.InternalID) - populate(objectMap, "prometheusQueryEndpoint", m.PrometheusQueryEndpoint) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Metrics. -func (m *Metrics) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "internalId": - err = unpopulate(val, "InternalID", &m.InternalID) - delete(rawMsg, key) - case "prometheusQueryEndpoint": - err = unpopulate(val, "PrometheusQueryEndpoint", &m.PrometheusQueryEndpoint) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MetricsIngestionEndpointSpec. -func (m MetricsIngestionEndpointSpec) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "endpoint", m.Endpoint) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MetricsIngestionEndpointSpec. -func (m *MetricsIngestionEndpointSpec) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endpoint": - err = unpopulate(val, "Endpoint", &m.Endpoint) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MonitoringAccountDestination. -func (m MonitoringAccountDestination) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "accountId", m.AccountID) - populate(objectMap, "accountResourceId", m.AccountResourceID) - populate(objectMap, "name", m.Name) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MonitoringAccountDestination. -func (m *MonitoringAccountDestination) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "accountId": - err = unpopulate(val, "AccountID", &m.AccountID) - delete(rawMsg, key) - case "accountResourceId": - err = unpopulate(val, "AccountResourceID", &m.AccountResourceID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MultiMetricCriteria. -func (m MultiMetricCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["criterionType"] = m.CriterionType - populate(objectMap, "dimensions", m.Dimensions) - populate(objectMap, "metricName", m.MetricName) - populate(objectMap, "metricNamespace", m.MetricNamespace) - populate(objectMap, "name", m.Name) - populate(objectMap, "skipMetricValidation", m.SkipMetricValidation) - populate(objectMap, "timeAggregation", m.TimeAggregation) - if m.AdditionalProperties != nil { - for key, val := range m.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MultiMetricCriteria. -func (m *MultiMetricCriteria) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "criterionType": - err = unpopulate(val, "CriterionType", &m.CriterionType) - delete(rawMsg, key) - case "dimensions": - err = unpopulate(val, "Dimensions", &m.Dimensions) - delete(rawMsg, key) - case "metricName": - err = unpopulate(val, "MetricName", &m.MetricName) - delete(rawMsg, key) - case "metricNamespace": - err = unpopulate(val, "MetricNamespace", &m.MetricNamespace) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &m.Name) - delete(rawMsg, key) - case "skipMetricValidation": - err = unpopulate(val, "SkipMetricValidation", &m.SkipMetricValidation) - delete(rawMsg, key) - case "timeAggregation": - err = unpopulate(val, "TimeAggregation", &m.TimeAggregation) - delete(rawMsg, key) - default: - if m.AdditionalProperties == nil { - m.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - m.AdditionalProperties[key] = aux - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", m, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NetworkRuleSet. -func (n NetworkRuleSet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "publicNetworkAccess", n.PublicNetworkAccess) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NetworkRuleSet. -func (n *NetworkRuleSet) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "publicNetworkAccess": - err = unpopulate(val, "PublicNetworkAccess", &n.PublicNetworkAccess) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type NotificationRequestBody. -func (n NotificationRequestBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "alertType", n.AlertType) - populate(objectMap, "armRoleReceivers", n.ArmRoleReceivers) - populate(objectMap, "automationRunbookReceivers", n.AutomationRunbookReceivers) - populate(objectMap, "azureAppPushReceivers", n.AzureAppPushReceivers) - populate(objectMap, "azureFunctionReceivers", n.AzureFunctionReceivers) - populate(objectMap, "emailReceivers", n.EmailReceivers) - populate(objectMap, "eventHubReceivers", n.EventHubReceivers) - populate(objectMap, "itsmReceivers", n.ItsmReceivers) - populate(objectMap, "logicAppReceivers", n.LogicAppReceivers) - populate(objectMap, "smsReceivers", n.SmsReceivers) - populate(objectMap, "voiceReceivers", n.VoiceReceivers) - populate(objectMap, "webhookReceivers", n.WebhookReceivers) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NotificationRequestBody. -func (n *NotificationRequestBody) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "alertType": - err = unpopulate(val, "AlertType", &n.AlertType) - delete(rawMsg, key) - case "armRoleReceivers": - err = unpopulate(val, "ArmRoleReceivers", &n.ArmRoleReceivers) - delete(rawMsg, key) - case "automationRunbookReceivers": - err = unpopulate(val, "AutomationRunbookReceivers", &n.AutomationRunbookReceivers) - delete(rawMsg, key) - case "azureAppPushReceivers": - err = unpopulate(val, "AzureAppPushReceivers", &n.AzureAppPushReceivers) - delete(rawMsg, key) - case "azureFunctionReceivers": - err = unpopulate(val, "AzureFunctionReceivers", &n.AzureFunctionReceivers) - delete(rawMsg, key) - case "emailReceivers": - err = unpopulate(val, "EmailReceivers", &n.EmailReceivers) - delete(rawMsg, key) - case "eventHubReceivers": - err = unpopulate(val, "EventHubReceivers", &n.EventHubReceivers) - delete(rawMsg, key) - case "itsmReceivers": - err = unpopulate(val, "ItsmReceivers", &n.ItsmReceivers) - delete(rawMsg, key) - case "logicAppReceivers": - err = unpopulate(val, "LogicAppReceivers", &n.LogicAppReceivers) - delete(rawMsg, key) - case "smsReceivers": - err = unpopulate(val, "SmsReceivers", &n.SmsReceivers) - delete(rawMsg, key) - case "voiceReceivers": - err = unpopulate(val, "VoiceReceivers", &n.VoiceReceivers) - delete(rawMsg, key) - case "webhookReceivers": - err = unpopulate(val, "WebhookReceivers", &n.WebhookReceivers) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", n, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Operation. -func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "display", o.Display) - populate(objectMap, "name", o.Name) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. -func (o *Operation) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "display": - err = unpopulate(val, "Display", &o.Display) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationAutoGenerated. -func (o OperationAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actionType", o.ActionType) - populate(objectMap, "display", o.Display) - populate(objectMap, "isDataAction", o.IsDataAction) - populate(objectMap, "name", o.Name) - populate(objectMap, "origin", o.Origin) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationAutoGenerated. -func (o *OperationAutoGenerated) 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) - } - for key, val := range rawMsg { - var err error - switch key { - case "actionType": - err = unpopulate(val, "ActionType", &o.ActionType) - delete(rawMsg, key) - case "display": - err = unpopulate(val, "Display", &o.Display) - delete(rawMsg, key) - case "isDataAction": - err = unpopulate(val, "IsDataAction", &o.IsDataAction) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "origin": - err = unpopulate(val, "Origin", &o.Origin) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. -func (o OperationDisplay) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "operation", o.Operation) - populate(objectMap, "provider", o.Provider) - populate(objectMap, "resource", o.Resource) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. -func (o *OperationDisplay) 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) - } - for key, val := range rawMsg { - var err error - switch key { - case "operation": - err = unpopulate(val, "Operation", &o.Operation) - delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &o.Provider) - delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &o.Resource) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationDisplayAutoGenerated. -func (o OperationDisplayAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "description", o.Description) - populate(objectMap, "operation", o.Operation) - populate(objectMap, "provider", o.Provider) - populate(objectMap, "resource", o.Resource) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplayAutoGenerated. -func (o *OperationDisplayAutoGenerated) 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) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &o.Description) - delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &o.Operation) - delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &o.Provider) - delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &o.Resource) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationListResult. -func (o OperationListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. -func (o *OperationListResult) 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) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &o.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &o.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationListResultAutoGenerated. -func (o OperationListResultAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResultAutoGenerated. -func (o *OperationListResultAutoGenerated) 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) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &o.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &o.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OperationStatus. -func (o OperationStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "endTime", o.EndTime) - populate(objectMap, "error", o.Error) - populate(objectMap, "id", o.ID) - populate(objectMap, "name", o.Name) - populateDateTimeRFC3339(objectMap, "startTime", o.StartTime) - populate(objectMap, "status", o.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatus. -func (o *OperationStatus) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &o.EndTime) - delete(rawMsg, key) - case "error": - err = unpopulate(val, "Error", &o.Error) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &o.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &o.Name) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &o.StartTime) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &o.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PerfCounterDataSource. -func (p PerfCounterDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "counterSpecifiers", p.CounterSpecifiers) - populate(objectMap, "name", p.Name) - populate(objectMap, "samplingFrequencyInSeconds", p.SamplingFrequencyInSeconds) - populate(objectMap, "streams", p.Streams) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PerfCounterDataSource. -func (p *PerfCounterDataSource) 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", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "counterSpecifiers": - err = unpopulate(val, "CounterSpecifiers", &p.CounterSpecifiers) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "samplingFrequencyInSeconds": - err = unpopulate(val, "SamplingFrequencyInSeconds", &p.SamplingFrequencyInSeconds) - delete(rawMsg, key) - case "streams": - err = unpopulate(val, "Streams", &p.Streams) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PlatformTelemetryDataSource. -func (p PlatformTelemetryDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", p.Name) - populate(objectMap, "streams", p.Streams) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PlatformTelemetryDataSource. -func (p *PlatformTelemetryDataSource) 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", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "streams": - err = unpopulate(val, "Streams", &p.Streams) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PredictiveAutoscalePolicy. -func (p PredictiveAutoscalePolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "scaleLookAheadTime", p.ScaleLookAheadTime) - populate(objectMap, "scaleMode", p.ScaleMode) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PredictiveAutoscalePolicy. -func (p *PredictiveAutoscalePolicy) 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", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "scaleLookAheadTime": - err = unpopulate(val, "ScaleLookAheadTime", &p.ScaleLookAheadTime) - delete(rawMsg, key) - case "scaleMode": - err = unpopulate(val, "ScaleMode", &p.ScaleMode) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PredictiveResponse. -func (p PredictiveResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "data", p.Data) - populate(objectMap, "interval", p.Interval) - populate(objectMap, "metricName", p.MetricName) - populate(objectMap, "targetResourceId", p.TargetResourceID) - populate(objectMap, "timespan", p.Timespan) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PredictiveResponse. -func (p *PredictiveResponse) 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", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "data": - err = unpopulate(val, "Data", &p.Data) - delete(rawMsg, key) - case "interval": - err = unpopulate(val, "Interval", &p.Interval) - delete(rawMsg, key) - case "metricName": - err = unpopulate(val, "MetricName", &p.MetricName) - delete(rawMsg, key) - case "targetResourceId": - err = unpopulate(val, "TargetResourceID", &p.TargetResourceID) - delete(rawMsg, key) - case "timespan": - err = unpopulate(val, "Timespan", &p.Timespan) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PredictiveValue. -func (p PredictiveValue) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "timeStamp", p.TimeStamp) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PredictiveValue. -func (p *PredictiveValue) 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", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "timeStamp": - err = unpopulateDateTimeRFC3339(val, "TimeStamp", &p.TimeStamp) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpoint. -func (p PrivateEndpoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpoint. -func (p *PrivateEndpoint) 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", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. -func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. -func (p *PrivateEndpointConnection) 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", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. -func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult. -func (p *PrivateEndpointConnectionListResult) 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", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &p.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. -func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "privateEndpoint", p.PrivateEndpoint) - populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) - populate(objectMap, "provisioningState", p.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. -func (p *PrivateEndpointConnectionProperties) 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", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "privateEndpoint": - err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) - delete(rawMsg, key) - case "privateLinkServiceConnectionState": - err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. -func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. -func (p *PrivateLinkResource) 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", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. -func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceListResult. -func (p *PrivateLinkResourceListResult) 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", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &p.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. -func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "groupId", p.GroupID) - populate(objectMap, "requiredMembers", p.RequiredMembers) - populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. -func (p *PrivateLinkResourceProperties) 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", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "groupId": - err = unpopulate(val, "GroupID", &p.GroupID) - delete(rawMsg, key) - case "requiredMembers": - err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) - delete(rawMsg, key) - case "requiredZoneNames": - err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkScopedResource. -func (p PrivateLinkScopedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "resourceId", p.ResourceID) - populate(objectMap, "scopeId", p.ScopeID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkScopedResource. -func (p *PrivateLinkScopedResource) 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", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "resourceId": - err = unpopulate(val, "ResourceID", &p.ResourceID) - delete(rawMsg, key) - case "scopeId": - err = unpopulate(val, "ScopeID", &p.ScopeID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState. -func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actionsRequired", p.ActionsRequired) - populate(objectMap, "description", p.Description) - populate(objectMap, "status", p.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState. -func (p *PrivateLinkServiceConnectionState) 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", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actionsRequired": - err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &p.Description) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &p.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type PrometheusForwarderDataSource. -func (p PrometheusForwarderDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "labelIncludeFilter", p.LabelIncludeFilter) - populate(objectMap, "name", p.Name) - populate(objectMap, "streams", p.Streams) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PrometheusForwarderDataSource. -func (p *PrometheusForwarderDataSource) 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", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "labelIncludeFilter": - err = unpopulate(val, "LabelIncludeFilter", &p.LabelIncludeFilter) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "streams": - err = unpopulate(val, "Streams", &p.Streams) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ProxyResource. -func (p ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. -func (p *ProxyResource) 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", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ProxyResourceAutoGenerated. -func (p ProxyResourceAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "type", p.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResourceAutoGenerated. -func (p *ProxyResourceAutoGenerated) 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", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Recurrence. -func (r Recurrence) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "frequency", r.Frequency) - populate(objectMap, "schedule", r.Schedule) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Recurrence. -func (r *Recurrence) 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", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "frequency": - err = unpopulate(val, "Frequency", &r.Frequency) - delete(rawMsg, key) - case "schedule": - err = unpopulate(val, "Schedule", &r.Schedule) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RecurrentSchedule. -func (r RecurrentSchedule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "days", r.Days) - populate(objectMap, "hours", r.Hours) - populate(objectMap, "minutes", r.Minutes) - populate(objectMap, "timeZone", r.TimeZone) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RecurrentSchedule. -func (r *RecurrentSchedule) 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", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "days": - err = unpopulate(val, "Days", &r.Days) - delete(rawMsg, key) - case "hours": - err = unpopulate(val, "Hours", &r.Hours) - delete(rawMsg, key) - case "minutes": - err = unpopulate(val, "Minutes", &r.Minutes) - delete(rawMsg, key) - case "timeZone": - err = unpopulate(val, "TimeZone", &r.TimeZone) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "systemData", r.SystemData) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. -func (r *Resource) 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", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &r.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated. -func (r ResourceAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated. -func (r *ResourceAutoGenerated) 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", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated2. -func (r ResourceAutoGenerated2) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated2. -func (r *ResourceAutoGenerated2) 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", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated3. -func (r ResourceAutoGenerated3) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated3. -func (r *ResourceAutoGenerated3) 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", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated4. -func (r ResourceAutoGenerated4) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "location", r.Location) - populate(objectMap, "name", r.Name) - populate(objectMap, "tags", r.Tags) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated4. -func (r *ResourceAutoGenerated4) 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", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &r.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ResourceAutoGenerated5. -func (r ResourceAutoGenerated5) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "systemData", r.SystemData) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated5. -func (r *ResourceAutoGenerated5) 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", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &r.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ResourceForUpdate. -func (r ResourceForUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "identity", r.Identity) - populate(objectMap, "tags", r.Tags) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceForUpdate. -func (r *ResourceForUpdate) 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", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "identity": - err = unpopulate(val, "Identity", &r.Identity) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &r.Tags) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ResourceForUpdateIdentity. -func (r ResourceForUpdateIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "tenantId", r.TenantID) - populate(objectMap, "type", r.Type) - populate(objectMap, "userAssignedIdentities", r.UserAssignedIdentities) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceForUpdateIdentity. -func (r *ResourceForUpdateIdentity) 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", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &r.TenantID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - case "userAssignedIdentities": - err = unpopulate(val, "UserAssignedIdentities", &r.UserAssignedIdentities) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Response. -func (r Response) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "cost", r.Cost) - populate(objectMap, "interval", r.Interval) - populate(objectMap, "namespace", r.Namespace) - populate(objectMap, "resourceregion", r.Resourceregion) - populate(objectMap, "timespan", r.Timespan) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Response. -func (r *Response) 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", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "cost": - err = unpopulate(val, "Cost", &r.Cost) - delete(rawMsg, key) - case "interval": - err = unpopulate(val, "Interval", &r.Interval) - delete(rawMsg, key) - case "namespace": - err = unpopulate(val, "Namespace", &r.Namespace) - delete(rawMsg, key) - case "resourceregion": - err = unpopulate(val, "Resourceregion", &r.Resourceregion) - delete(rawMsg, key) - case "timespan": - err = unpopulate(val, "Timespan", &r.Timespan) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ResponseWithError. -func (r ResponseWithError) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "error", r.Error) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResponseWithError. -func (r *ResponseWithError) 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", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "error": - err = unpopulate(val, "Error", &r.Error) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RetentionPolicy. -func (r RetentionPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "days", r.Days) - populate(objectMap, "enabled", r.Enabled) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RetentionPolicy. -func (r *RetentionPolicy) 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", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "days": - err = unpopulate(val, "Days", &r.Days) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &r.Enabled) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RuleAction. -func (r RuleAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["odata.type"] = r.ODataType - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleAction. -func (r *RuleAction) 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", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "odata.type": - err = unpopulate(val, "ODataType", &r.ODataType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RuleCondition. -func (r RuleCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataSource", r.DataSource) - objectMap["odata.type"] = r.ODataType - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleCondition. -func (r *RuleCondition) 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", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataSource": - r.DataSource, err = unmarshalRuleDataSourceClassification(val) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &r.ODataType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RuleDataSource. -func (r RuleDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "legacyResourceId", r.LegacyResourceID) - populate(objectMap, "metricNamespace", r.MetricNamespace) - objectMap["odata.type"] = r.ODataType - populate(objectMap, "resourceLocation", r.ResourceLocation) - populate(objectMap, "resourceUri", r.ResourceURI) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleDataSource. -func (r *RuleDataSource) 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", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "legacyResourceId": - err = unpopulate(val, "LegacyResourceID", &r.LegacyResourceID) - delete(rawMsg, key) - case "metricNamespace": - err = unpopulate(val, "MetricNamespace", &r.MetricNamespace) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &r.ODataType) - delete(rawMsg, key) - case "resourceLocation": - err = unpopulate(val, "ResourceLocation", &r.ResourceLocation) - delete(rawMsg, key) - case "resourceUri": - err = unpopulate(val, "ResourceURI", &r.ResourceURI) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RuleEmailAction. -func (r RuleEmailAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "customEmails", r.CustomEmails) - objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.RuleEmailAction" - populate(objectMap, "sendToServiceOwners", r.SendToServiceOwners) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleEmailAction. -func (r *RuleEmailAction) 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", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "customEmails": - err = unpopulate(val, "CustomEmails", &r.CustomEmails) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &r.ODataType) - delete(rawMsg, key) - case "sendToServiceOwners": - err = unpopulate(val, "SendToServiceOwners", &r.SendToServiceOwners) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RuleManagementEventClaimsDataSource. -func (r RuleManagementEventClaimsDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "emailAddress", r.EmailAddress) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleManagementEventClaimsDataSource. -func (r *RuleManagementEventClaimsDataSource) 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", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "emailAddress": - err = unpopulate(val, "EmailAddress", &r.EmailAddress) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RuleManagementEventDataSource. -func (r RuleManagementEventDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "claims", r.Claims) - populate(objectMap, "eventName", r.EventName) - populate(objectMap, "eventSource", r.EventSource) - populate(objectMap, "legacyResourceId", r.LegacyResourceID) - populate(objectMap, "level", r.Level) - populate(objectMap, "metricNamespace", r.MetricNamespace) - objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource" - populate(objectMap, "operationName", r.OperationName) - populate(objectMap, "resourceGroupName", r.ResourceGroupName) - populate(objectMap, "resourceLocation", r.ResourceLocation) - populate(objectMap, "resourceProviderName", r.ResourceProviderName) - populate(objectMap, "resourceUri", r.ResourceURI) - populate(objectMap, "status", r.Status) - populate(objectMap, "subStatus", r.SubStatus) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleManagementEventDataSource. -func (r *RuleManagementEventDataSource) 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", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "claims": - err = unpopulate(val, "Claims", &r.Claims) - delete(rawMsg, key) - case "eventName": - err = unpopulate(val, "EventName", &r.EventName) - delete(rawMsg, key) - case "eventSource": - err = unpopulate(val, "EventSource", &r.EventSource) - delete(rawMsg, key) - case "legacyResourceId": - err = unpopulate(val, "LegacyResourceID", &r.LegacyResourceID) - delete(rawMsg, key) - case "level": - err = unpopulate(val, "Level", &r.Level) - delete(rawMsg, key) - case "metricNamespace": - err = unpopulate(val, "MetricNamespace", &r.MetricNamespace) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &r.ODataType) - delete(rawMsg, key) - case "operationName": - err = unpopulate(val, "OperationName", &r.OperationName) - delete(rawMsg, key) - case "resourceGroupName": - err = unpopulate(val, "ResourceGroupName", &r.ResourceGroupName) - delete(rawMsg, key) - case "resourceLocation": - err = unpopulate(val, "ResourceLocation", &r.ResourceLocation) - delete(rawMsg, key) - case "resourceProviderName": - err = unpopulate(val, "ResourceProviderName", &r.ResourceProviderName) - delete(rawMsg, key) - case "resourceUri": - err = unpopulate(val, "ResourceURI", &r.ResourceURI) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &r.Status) - delete(rawMsg, key) - case "subStatus": - err = unpopulate(val, "SubStatus", &r.SubStatus) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RuleMetricDataSource. -func (r RuleMetricDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "legacyResourceId", r.LegacyResourceID) - populate(objectMap, "metricName", r.MetricName) - populate(objectMap, "metricNamespace", r.MetricNamespace) - objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource" - populate(objectMap, "resourceLocation", r.ResourceLocation) - populate(objectMap, "resourceUri", r.ResourceURI) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleMetricDataSource. -func (r *RuleMetricDataSource) 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", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "legacyResourceId": - err = unpopulate(val, "LegacyResourceID", &r.LegacyResourceID) - delete(rawMsg, key) - case "metricName": - err = unpopulate(val, "MetricName", &r.MetricName) - delete(rawMsg, key) - case "metricNamespace": - err = unpopulate(val, "MetricNamespace", &r.MetricNamespace) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &r.ODataType) - delete(rawMsg, key) - case "resourceLocation": - err = unpopulate(val, "ResourceLocation", &r.ResourceLocation) - delete(rawMsg, key) - case "resourceUri": - err = unpopulate(val, "ResourceURI", &r.ResourceURI) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RuleResolveConfiguration. -func (r RuleResolveConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "autoResolved", r.AutoResolved) - populate(objectMap, "timeToResolve", r.TimeToResolve) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleResolveConfiguration. -func (r *RuleResolveConfiguration) 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", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "autoResolved": - err = unpopulate(val, "AutoResolved", &r.AutoResolved) - delete(rawMsg, key) - case "timeToResolve": - err = unpopulate(val, "TimeToResolve", &r.TimeToResolve) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type RuleWebhookAction. -func (r RuleWebhookAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction" - populate(objectMap, "properties", r.Properties) - populate(objectMap, "serviceUri", r.ServiceURI) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RuleWebhookAction. -func (r *RuleWebhookAction) 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", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "odata.type": - err = unpopulate(val, "ODataType", &r.ODataType) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &r.Properties) - delete(rawMsg, key) - case "serviceUri": - err = unpopulate(val, "ServiceURI", &r.ServiceURI) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScaleAction. -func (s ScaleAction) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "cooldown", s.Cooldown) - populate(objectMap, "direction", s.Direction) - populate(objectMap, "type", s.Type) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScaleAction. -func (s *ScaleAction) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "cooldown": - err = unpopulate(val, "Cooldown", &s.Cooldown) - delete(rawMsg, key) - case "direction": - err = unpopulate(val, "Direction", &s.Direction) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScaleCapacity. -func (s ScaleCapacity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "default", s.Default) - populate(objectMap, "maximum", s.Maximum) - populate(objectMap, "minimum", s.Minimum) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScaleCapacity. -func (s *ScaleCapacity) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "default": - err = unpopulate(val, "Default", &s.Default) - delete(rawMsg, key) - case "maximum": - err = unpopulate(val, "Maximum", &s.Maximum) - delete(rawMsg, key) - case "minimum": - err = unpopulate(val, "Minimum", &s.Minimum) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScaleRule. -func (s ScaleRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "metricTrigger", s.MetricTrigger) - populate(objectMap, "scaleAction", s.ScaleAction) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScaleRule. -func (s *ScaleRule) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "metricTrigger": - err = unpopulate(val, "MetricTrigger", &s.MetricTrigger) - delete(rawMsg, key) - case "scaleAction": - err = unpopulate(val, "ScaleAction", &s.ScaleAction) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScaleRuleMetricDimension. -func (s ScaleRuleMetricDimension) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "DimensionName", s.DimensionName) - populate(objectMap, "Operator", s.Operator) - populate(objectMap, "Values", s.Values) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScaleRuleMetricDimension. -func (s *ScaleRuleMetricDimension) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "DimensionName": - err = unpopulate(val, "DimensionName", &s.DimensionName) - delete(rawMsg, key) - case "Operator": - err = unpopulate(val, "Operator", &s.Operator) - delete(rawMsg, key) - case "Values": - err = unpopulate(val, "Values", &s.Values) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScheduledQueryRuleCriteria. -func (s ScheduledQueryRuleCriteria) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "allOf", s.AllOf) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledQueryRuleCriteria. -func (s *ScheduledQueryRuleCriteria) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "allOf": - err = unpopulate(val, "AllOf", &s.AllOf) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScheduledQueryRuleProperties. -func (s ScheduledQueryRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actions", s.Actions) - populate(objectMap, "autoMitigate", s.AutoMitigate) - populate(objectMap, "checkWorkspaceAlertsStorageConfigured", s.CheckWorkspaceAlertsStorageConfigured) - populate(objectMap, "createdWithApiVersion", s.CreatedWithAPIVersion) - populate(objectMap, "criteria", s.Criteria) - populate(objectMap, "description", s.Description) - populate(objectMap, "displayName", s.DisplayName) - populate(objectMap, "enabled", s.Enabled) - populate(objectMap, "evaluationFrequency", s.EvaluationFrequency) - populate(objectMap, "isLegacyLogAnalyticsRule", s.IsLegacyLogAnalyticsRule) - populate(objectMap, "isWorkspaceAlertsStorageConfigured", s.IsWorkspaceAlertsStorageConfigured) - populate(objectMap, "muteActionsDuration", s.MuteActionsDuration) - populate(objectMap, "overrideQueryTimeRange", s.OverrideQueryTimeRange) - populate(objectMap, "publicNetworkAccess", s.PublicNetworkAccess) - populate(objectMap, "ruleResolveConfiguration", s.RuleResolveConfiguration) - populate(objectMap, "scopes", s.Scopes) - populate(objectMap, "severity", s.Severity) - populate(objectMap, "skipQueryValidation", s.SkipQueryValidation) - populate(objectMap, "targetResourceTypes", s.TargetResourceTypes) - populate(objectMap, "windowSize", s.WindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledQueryRuleProperties. -func (s *ScheduledQueryRuleProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actions": - err = unpopulate(val, "Actions", &s.Actions) - delete(rawMsg, key) - case "autoMitigate": - err = unpopulate(val, "AutoMitigate", &s.AutoMitigate) - delete(rawMsg, key) - case "checkWorkspaceAlertsStorageConfigured": - err = unpopulate(val, "CheckWorkspaceAlertsStorageConfigured", &s.CheckWorkspaceAlertsStorageConfigured) - delete(rawMsg, key) - case "createdWithApiVersion": - err = unpopulate(val, "CreatedWithAPIVersion", &s.CreatedWithAPIVersion) - delete(rawMsg, key) - case "criteria": - err = unpopulate(val, "Criteria", &s.Criteria) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &s.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &s.DisplayName) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &s.Enabled) - delete(rawMsg, key) - case "evaluationFrequency": - err = unpopulate(val, "EvaluationFrequency", &s.EvaluationFrequency) - delete(rawMsg, key) - case "isLegacyLogAnalyticsRule": - err = unpopulate(val, "IsLegacyLogAnalyticsRule", &s.IsLegacyLogAnalyticsRule) - delete(rawMsg, key) - case "isWorkspaceAlertsStorageConfigured": - err = unpopulate(val, "IsWorkspaceAlertsStorageConfigured", &s.IsWorkspaceAlertsStorageConfigured) - delete(rawMsg, key) - case "muteActionsDuration": - err = unpopulate(val, "MuteActionsDuration", &s.MuteActionsDuration) - delete(rawMsg, key) - case "overrideQueryTimeRange": - err = unpopulate(val, "OverrideQueryTimeRange", &s.OverrideQueryTimeRange) - delete(rawMsg, key) - case "publicNetworkAccess": - err = unpopulate(val, "PublicNetworkAccess", &s.PublicNetworkAccess) - delete(rawMsg, key) - case "ruleResolveConfiguration": - err = unpopulate(val, "RuleResolveConfiguration", &s.RuleResolveConfiguration) - delete(rawMsg, key) - case "scopes": - err = unpopulate(val, "Scopes", &s.Scopes) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &s.Severity) - delete(rawMsg, key) - case "skipQueryValidation": - err = unpopulate(val, "SkipQueryValidation", &s.SkipQueryValidation) - delete(rawMsg, key) - case "targetResourceTypes": - err = unpopulate(val, "TargetResourceTypes", &s.TargetResourceTypes) - delete(rawMsg, key) - case "windowSize": - err = unpopulate(val, "WindowSize", &s.WindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScheduledQueryRuleResource. -func (s ScheduledQueryRuleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "etag", s.Etag) - populate(objectMap, "id", s.ID) - populate(objectMap, "identity", s.Identity) - populate(objectMap, "kind", s.Kind) - populate(objectMap, "location", s.Location) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "systemData", s.SystemData) - populate(objectMap, "tags", s.Tags) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledQueryRuleResource. -func (s *ScheduledQueryRuleResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "etag": - err = unpopulate(val, "Etag", &s.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "identity": - err = unpopulate(val, "Identity", &s.Identity) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &s.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &s.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &s.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &s.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScheduledQueryRuleResourceCollection. -func (s ScheduledQueryRuleResourceCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledQueryRuleResourceCollection. -func (s *ScheduledQueryRuleResourceCollection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScheduledQueryRuleResourcePatch. -func (s ScheduledQueryRuleResourcePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "identity", s.Identity) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "tags", s.Tags) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledQueryRuleResourcePatch. -func (s *ScheduledQueryRuleResourcePatch) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "identity": - err = unpopulate(val, "Identity", &s.Identity) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &s.Tags) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScopedResource. -func (s ScopedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "systemData", s.SystemData) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScopedResource. -func (s *ScopedResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &s.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScopedResourceListResult. -func (s ScopedResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScopedResourceListResult. -func (s *ScopedResourceListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ScopedResourceProperties. -func (s ScopedResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "linkedResourceId", s.LinkedResourceID) - populate(objectMap, "provisioningState", s.ProvisioningState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScopedResourceProperties. -func (s *ScopedResourceProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "linkedResourceId": - err = unpopulate(val, "LinkedResourceID", &s.LinkedResourceID) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SenderAuthorization. -func (s SenderAuthorization) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "action", s.Action) - populate(objectMap, "role", s.Role) - populate(objectMap, "scope", s.Scope) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SenderAuthorization. -func (s *SenderAuthorization) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "action": - err = unpopulate(val, "Action", &s.Action) - delete(rawMsg, key) - case "role": - err = unpopulate(val, "Role", &s.Role) - delete(rawMsg, key) - case "scope": - err = unpopulate(val, "Scope", &s.Scope) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SingleBaseline. -func (s SingleBaseline) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "highThresholds", s.HighThresholds) - populate(objectMap, "lowThresholds", s.LowThresholds) - populate(objectMap, "sensitivity", s.Sensitivity) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SingleBaseline. -func (s *SingleBaseline) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "highThresholds": - err = unpopulate(val, "HighThresholds", &s.HighThresholds) - delete(rawMsg, key) - case "lowThresholds": - err = unpopulate(val, "LowThresholds", &s.LowThresholds) - delete(rawMsg, key) - case "sensitivity": - err = unpopulate(val, "Sensitivity", &s.Sensitivity) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SingleMetricBaseline. -func (s SingleMetricBaseline) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) - populate(objectMap, "name", s.Name) - populate(objectMap, "properties", s.Properties) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SingleMetricBaseline. -func (s *SingleMetricBaseline) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &s.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SmsReceiver. -func (s SmsReceiver) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "countryCode", s.CountryCode) - populate(objectMap, "name", s.Name) - populate(objectMap, "phoneNumber", s.PhoneNumber) - populate(objectMap, "status", s.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SmsReceiver. -func (s *SmsReceiver) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "countryCode": - err = unpopulate(val, "CountryCode", &s.CountryCode) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "phoneNumber": - err = unpopulate(val, "PhoneNumber", &s.PhoneNumber) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &s.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SmsReceiverAutoGenerated. -func (s SmsReceiverAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "countryCode", s.CountryCode) - populate(objectMap, "name", s.Name) - populate(objectMap, "phoneNumber", s.PhoneNumber) - populate(objectMap, "status", s.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SmsReceiverAutoGenerated. -func (s *SmsReceiverAutoGenerated) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "countryCode": - err = unpopulate(val, "CountryCode", &s.CountryCode) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "phoneNumber": - err = unpopulate(val, "PhoneNumber", &s.PhoneNumber) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &s.Status) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type StorageBlobDestination. -func (s StorageBlobDestination) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "containerName", s.ContainerName) - populate(objectMap, "name", s.Name) - populate(objectMap, "storageAccountResourceId", s.StorageAccountResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageBlobDestination. -func (s *StorageBlobDestination) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "containerName": - err = unpopulate(val, "ContainerName", &s.ContainerName) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "storageAccountResourceId": - err = unpopulate(val, "StorageAccountResourceID", &s.StorageAccountResourceID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type StorageTableDestination. -func (s StorageTableDestination) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "name", s.Name) - populate(objectMap, "storageAccountResourceId", s.StorageAccountResourceID) - populate(objectMap, "tableName", s.TableName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageTableDestination. -func (s *StorageTableDestination) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "storageAccountResourceId": - err = unpopulate(val, "StorageAccountResourceID", &s.StorageAccountResourceID) - delete(rawMsg, key) - case "tableName": - err = unpopulate(val, "TableName", &s.TableName) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type StreamDeclaration. -func (s StreamDeclaration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "columns", s.Columns) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StreamDeclaration. -func (s *StreamDeclaration) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "columns": - err = unpopulate(val, "Columns", &s.Columns) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SubscriptionScopeMetric. -func (s SubscriptionScopeMetric) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "displayDescription", s.DisplayDescription) - populate(objectMap, "errorCode", s.ErrorCode) - populate(objectMap, "errorMessage", s.ErrorMessage) - populate(objectMap, "id", s.ID) - populate(objectMap, "name", s.Name) - populate(objectMap, "timeseries", s.Timeseries) - populate(objectMap, "type", s.Type) - populate(objectMap, "unit", s.Unit) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionScopeMetric. -func (s *SubscriptionScopeMetric) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "displayDescription": - err = unpopulate(val, "DisplayDescription", &s.DisplayDescription) - delete(rawMsg, key) - case "errorCode": - err = unpopulate(val, "ErrorCode", &s.ErrorCode) - delete(rawMsg, key) - case "errorMessage": - err = unpopulate(val, "ErrorMessage", &s.ErrorMessage) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "timeseries": - err = unpopulate(val, "Timeseries", &s.Timeseries) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &s.Unit) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SubscriptionScopeMetricDefinition. -func (s SubscriptionScopeMetricDefinition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "category", s.Category) - populate(objectMap, "dimensions", s.Dimensions) - populate(objectMap, "displayDescription", s.DisplayDescription) - populate(objectMap, "id", s.ID) - populate(objectMap, "isDimensionRequired", s.IsDimensionRequired) - populate(objectMap, "metricAvailabilities", s.MetricAvailabilities) - populate(objectMap, "metricClass", s.MetricClass) - populate(objectMap, "name", s.Name) - populate(objectMap, "namespace", s.Namespace) - populate(objectMap, "primaryAggregationType", s.PrimaryAggregationType) - populate(objectMap, "resourceId", s.ResourceID) - populate(objectMap, "supportedAggregationTypes", s.SupportedAggregationTypes) - populate(objectMap, "unit", s.Unit) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionScopeMetricDefinition. -func (s *SubscriptionScopeMetricDefinition) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "category": - err = unpopulate(val, "Category", &s.Category) - delete(rawMsg, key) - case "dimensions": - err = unpopulate(val, "Dimensions", &s.Dimensions) - delete(rawMsg, key) - case "displayDescription": - err = unpopulate(val, "DisplayDescription", &s.DisplayDescription) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "isDimensionRequired": - err = unpopulate(val, "IsDimensionRequired", &s.IsDimensionRequired) - delete(rawMsg, key) - case "metricAvailabilities": - err = unpopulate(val, "MetricAvailabilities", &s.MetricAvailabilities) - delete(rawMsg, key) - case "metricClass": - err = unpopulate(val, "MetricClass", &s.MetricClass) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "namespace": - err = unpopulate(val, "Namespace", &s.Namespace) - delete(rawMsg, key) - case "primaryAggregationType": - err = unpopulate(val, "PrimaryAggregationType", &s.PrimaryAggregationType) - delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &s.ResourceID) - delete(rawMsg, key) - case "supportedAggregationTypes": - err = unpopulate(val, "SupportedAggregationTypes", &s.SupportedAggregationTypes) - delete(rawMsg, key) - case "unit": - err = unpopulate(val, "Unit", &s.Unit) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SubscriptionScopeMetricDefinitionCollection. -func (s SubscriptionScopeMetricDefinitionCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionScopeMetricDefinitionCollection. -func (s *SubscriptionScopeMetricDefinitionCollection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "value": - err = unpopulate(val, "Value", &s.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SubscriptionScopeMetricResponse. -func (s SubscriptionScopeMetricResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "cost", s.Cost) - populate(objectMap, "interval", s.Interval) - populate(objectMap, "namespace", s.Namespace) - populate(objectMap, "resourceregion", s.Resourceregion) - populate(objectMap, "timespan", s.Timespan) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionScopeMetricResponse. -func (s *SubscriptionScopeMetricResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "cost": - err = unpopulate(val, "Cost", &s.Cost) - delete(rawMsg, key) - case "interval": - err = unpopulate(val, "Interval", &s.Interval) - delete(rawMsg, key) - case "namespace": - err = unpopulate(val, "Namespace", &s.Namespace) - delete(rawMsg, key) - case "resourceregion": - err = unpopulate(val, "Resourceregion", &s.Resourceregion) - delete(rawMsg, key) - case "timespan": - err = unpopulate(val, "Timespan", &s.Timespan) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SubscriptionScopeMetricsRequestBodyParameters. -func (s SubscriptionScopeMetricsRequestBodyParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "aggregation", s.Aggregation) - populate(objectMap, "autoAdjustTimegrain", s.AutoAdjustTimegrain) - populate(objectMap, "filter", s.Filter) - populate(objectMap, "interval", s.Interval) - populate(objectMap, "metricNames", s.MetricNames) - populate(objectMap, "metricNamespace", s.MetricNamespace) - populate(objectMap, "orderBy", s.OrderBy) - populate(objectMap, "resultType", s.ResultType) - populate(objectMap, "rollUpBy", s.RollUpBy) - populateTimeRFC3339(objectMap, "timespan", s.Timespan) - populate(objectMap, "top", s.Top) - populate(objectMap, "validateDimensions", s.ValidateDimensions) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SubscriptionScopeMetricsRequestBodyParameters. -func (s *SubscriptionScopeMetricsRequestBodyParameters) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "aggregation": - err = unpopulate(val, "Aggregation", &s.Aggregation) - delete(rawMsg, key) - case "autoAdjustTimegrain": - err = unpopulate(val, "AutoAdjustTimegrain", &s.AutoAdjustTimegrain) - delete(rawMsg, key) - case "filter": - err = unpopulate(val, "Filter", &s.Filter) - delete(rawMsg, key) - case "interval": - err = unpopulate(val, "Interval", &s.Interval) - delete(rawMsg, key) - case "metricNames": - err = unpopulate(val, "MetricNames", &s.MetricNames) - delete(rawMsg, key) - case "metricNamespace": - err = unpopulate(val, "MetricNamespace", &s.MetricNamespace) - delete(rawMsg, key) - case "orderBy": - err = unpopulate(val, "OrderBy", &s.OrderBy) - delete(rawMsg, key) - case "resultType": - err = unpopulate(val, "ResultType", &s.ResultType) - delete(rawMsg, key) - case "rollUpBy": - err = unpopulate(val, "RollUpBy", &s.RollUpBy) - delete(rawMsg, key) - case "timespan": - err = unpopulateTimeRFC3339(val, "Timespan", &s.Timespan) - delete(rawMsg, key) - case "top": - err = unpopulate(val, "Top", &s.Top) - delete(rawMsg, key) - case "validateDimensions": - err = unpopulate(val, "ValidateDimensions", &s.ValidateDimensions) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SyslogDataSource. -func (s SyslogDataSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "facilityNames", s.FacilityNames) - populate(objectMap, "logLevels", s.LogLevels) - populate(objectMap, "name", s.Name) - populate(objectMap, "streams", s.Streams) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SyslogDataSource. -func (s *SyslogDataSource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "facilityNames": - err = unpopulate(val, "FacilityNames", &s.FacilityNames) - delete(rawMsg, key) - case "logLevels": - err = unpopulate(val, "LogLevels", &s.LogLevels) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) - delete(rawMsg, key) - case "streams": - err = unpopulate(val, "Streams", &s.Streams) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TagsResource. -func (t TagsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "tags", t.Tags) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TagsResource. -func (t *TagsResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "tags": - err = unpopulate(val, "Tags", &t.Tags) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TenantActionGroup. -func (t TenantActionGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "azureAppPushReceivers", t.AzureAppPushReceivers) - populate(objectMap, "emailReceivers", t.EmailReceivers) - populate(objectMap, "enabled", t.Enabled) - populate(objectMap, "groupShortName", t.GroupShortName) - populate(objectMap, "smsReceivers", t.SmsReceivers) - populate(objectMap, "voiceReceivers", t.VoiceReceivers) - populate(objectMap, "webhookReceivers", t.WebhookReceivers) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TenantActionGroup. -func (t *TenantActionGroup) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "azureAppPushReceivers": - err = unpopulate(val, "AzureAppPushReceivers", &t.AzureAppPushReceivers) - delete(rawMsg, key) - case "emailReceivers": - err = unpopulate(val, "EmailReceivers", &t.EmailReceivers) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &t.Enabled) - delete(rawMsg, key) - case "groupShortName": - err = unpopulate(val, "GroupShortName", &t.GroupShortName) - delete(rawMsg, key) - case "smsReceivers": - err = unpopulate(val, "SmsReceivers", &t.SmsReceivers) - delete(rawMsg, key) - case "voiceReceivers": - err = unpopulate(val, "VoiceReceivers", &t.VoiceReceivers) - delete(rawMsg, key) - case "webhookReceivers": - err = unpopulate(val, "WebhookReceivers", &t.WebhookReceivers) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TenantActionGroupList. -func (t TenantActionGroupList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", t.NextLink) - populate(objectMap, "value", t.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TenantActionGroupList. -func (t *TenantActionGroupList) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &t.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &t.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TenantActionGroupResource. -func (t TenantActionGroupResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "properties", t.Properties) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TenantActionGroupResource. -func (t *TenantActionGroupResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &t.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &t.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &t.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &t.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TestNotificationDetailsResponse. -func (t TestNotificationDetailsResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "actionDetails", t.ActionDetails) - populate(objectMap, "completedTime", t.CompletedTime) - populate(objectMap, "context", t.Context) - populate(objectMap, "createdTime", t.CreatedTime) - populate(objectMap, "state", t.State) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TestNotificationDetailsResponse. -func (t *TestNotificationDetailsResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "actionDetails": - err = unpopulate(val, "ActionDetails", &t.ActionDetails) - delete(rawMsg, key) - case "completedTime": - err = unpopulate(val, "CompletedTime", &t.CompletedTime) - delete(rawMsg, key) - case "context": - err = unpopulate(val, "Context", &t.Context) - delete(rawMsg, key) - case "createdTime": - err = unpopulate(val, "CreatedTime", &t.CreatedTime) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &t.State) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ThresholdRuleCondition. -func (t ThresholdRuleCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dataSource", t.DataSource) - objectMap["odata.type"] = "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition" - populate(objectMap, "operator", t.Operator) - populate(objectMap, "threshold", t.Threshold) - populate(objectMap, "timeAggregation", t.TimeAggregation) - populate(objectMap, "windowSize", t.WindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ThresholdRuleCondition. -func (t *ThresholdRuleCondition) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "dataSource": - t.DataSource, err = unmarshalRuleDataSourceClassification(val) - delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &t.ODataType) - delete(rawMsg, key) - case "operator": - err = unpopulate(val, "Operator", &t.Operator) - delete(rawMsg, key) - case "threshold": - err = unpopulate(val, "Threshold", &t.Threshold) - delete(rawMsg, key) - case "timeAggregation": - err = unpopulate(val, "TimeAggregation", &t.TimeAggregation) - delete(rawMsg, key) - case "windowSize": - err = unpopulate(val, "WindowSize", &t.WindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TimeSeriesBaseline. -func (t TimeSeriesBaseline) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "aggregation", t.Aggregation) - populate(objectMap, "data", t.Data) - populate(objectMap, "dimensions", t.Dimensions) - populate(objectMap, "metadataValues", t.MetadataValues) - aux := make([]*dateTimeRFC3339, len(t.Timestamps), len(t.Timestamps)) - for i := 0; i < len(t.Timestamps); i++ { - aux[i] = (*dateTimeRFC3339)(t.Timestamps[i]) - } - populate(objectMap, "timestamps", aux) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TimeSeriesBaseline. -func (t *TimeSeriesBaseline) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "aggregation": - err = unpopulate(val, "Aggregation", &t.Aggregation) - delete(rawMsg, key) - case "data": - err = unpopulate(val, "Data", &t.Data) - delete(rawMsg, key) - case "dimensions": - err = unpopulate(val, "Dimensions", &t.Dimensions) - delete(rawMsg, key) - case "metadataValues": - err = unpopulate(val, "MetadataValues", &t.MetadataValues) - delete(rawMsg, key) - case "timestamps": - var aux []*dateTimeRFC3339 - err = unpopulate(val, "Timestamps", &aux) - for _, au := range aux { - t.Timestamps = append(t.Timestamps, (*time.Time)(au)) - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TimeSeriesElement. -func (t TimeSeriesElement) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "data", t.Data) - populate(objectMap, "metadatavalues", t.Metadatavalues) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TimeSeriesElement. -func (t *TimeSeriesElement) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "data": - err = unpopulate(val, "Data", &t.Data) - delete(rawMsg, key) - case "metadatavalues": - err = unpopulate(val, "Metadatavalues", &t.Metadatavalues) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TimeWindow. -func (t TimeWindow) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "end", t.End) - populateDateTimeRFC3339(objectMap, "start", t.Start) - populate(objectMap, "timeZone", t.TimeZone) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TimeWindow. -func (t *TimeWindow) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "end": - err = unpopulateDateTimeRFC3339(val, "End", &t.End) - delete(rawMsg, key) - case "start": - err = unpopulateDateTimeRFC3339(val, "Start", &t.Start) - delete(rawMsg, key) - case "timeZone": - err = unpopulate(val, "TimeZone", &t.TimeZone) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. -func (t *TrackedResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &t.ID) + case "automationRunbookReceivers": + err = unpopulate(val, "AutomationRunbookReceivers", &n.AutomationRunbookReceivers) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &t.Location) + case "azureAppPushReceivers": + err = unpopulate(val, "AzureAppPushReceivers", &n.AzureAppPushReceivers) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) + case "azureFunctionReceivers": + err = unpopulate(val, "AzureFunctionReceivers", &n.AzureFunctionReceivers) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &t.Tags) + case "emailReceivers": + err = unpopulate(val, "EmailReceivers", &n.EmailReceivers) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) + case "eventHubReceivers": + err = unpopulate(val, "EventHubReceivers", &n.EventHubReceivers) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type TrackedResourceAutoGenerated. -func (t TrackedResourceAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "systemData", t.SystemData) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResourceAutoGenerated. -func (t *TrackedResourceAutoGenerated) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &t.ID) + case "incidentReceivers": + err = unpopulate(val, "IncidentReceivers", &n.IncidentReceivers) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &t.Location) + case "itsmReceivers": + err = unpopulate(val, "ItsmReceivers", &n.ItsmReceivers) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) + case "logicAppReceivers": + err = unpopulate(val, "LogicAppReceivers", &n.LogicAppReceivers) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &t.SystemData) + case "smsReceivers": + err = unpopulate(val, "SmsReceivers", &n.SmsReceivers) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &t.Tags) + case "voiceReceivers": + err = unpopulate(val, "VoiceReceivers", &n.VoiceReceivers) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) + case "webhookReceivers": + err = unpopulate(val, "WebhookReceivers", &n.WebhookReceivers) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) + return fmt.Errorf("unmarshalling type %T: %v", n, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentity. -func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RuleResolveConfiguration. +func (r RuleResolveConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "clientId", u.ClientID) - populate(objectMap, "principalId", u.PrincipalID) + populate(objectMap, "autoResolved", r.AutoResolved) + populate(objectMap, "timeToResolve", r.TimeToResolve) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity. -func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RuleResolveConfiguration. +func (r *RuleResolveConfiguration) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "clientId": - err = unpopulate(val, "ClientID", &u.ClientID) + case "autoResolved": + err = unpopulate(val, "AutoResolved", &r.AutoResolved) delete(rawMsg, key) - case "principalId": - err = unpopulate(val, "PrincipalID", &u.PrincipalID) + case "timeToResolve": + err = unpopulate(val, "TimeToResolve", &r.TimeToResolve) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type UserIdentityProperties. -func (u UserIdentityProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ScheduledQueryRuleCriteria. +func (s ScheduledQueryRuleCriteria) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "clientId", u.ClientID) - populate(objectMap, "principalId", u.PrincipalID) + populate(objectMap, "allOf", s.AllOf) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type UserIdentityProperties. -func (u *UserIdentityProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledQueryRuleCriteria. +func (s *ScheduledQueryRuleCriteria) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "clientId": - err = unpopulate(val, "ClientID", &u.ClientID) - delete(rawMsg, key) - case "principalId": - err = unpopulate(val, "PrincipalID", &u.PrincipalID) + case "allOf": + err = unpopulate(val, "AllOf", &s.AllOf) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type VMInsightsOnboardingStatus. -func (v VMInsightsOnboardingStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ScheduledQueryRuleProperties. +func (s ScheduledQueryRuleProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", v.ID) - populate(objectMap, "name", v.Name) - populate(objectMap, "properties", v.Properties) - populate(objectMap, "type", v.Type) + populate(objectMap, "actions", s.Actions) + populate(objectMap, "autoMitigate", s.AutoMitigate) + populate(objectMap, "checkWorkspaceAlertsStorageConfigured", s.CheckWorkspaceAlertsStorageConfigured) + populate(objectMap, "createdWithApiVersion", s.CreatedWithAPIVersion) + populate(objectMap, "criteria", s.Criteria) + populate(objectMap, "description", s.Description) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "enabled", s.Enabled) + populate(objectMap, "evaluationFrequency", s.EvaluationFrequency) + populate(objectMap, "isLegacyLogAnalyticsRule", s.IsLegacyLogAnalyticsRule) + populate(objectMap, "isWorkspaceAlertsStorageConfigured", s.IsWorkspaceAlertsStorageConfigured) + populate(objectMap, "muteActionsDuration", s.MuteActionsDuration) + populate(objectMap, "overrideQueryTimeRange", s.OverrideQueryTimeRange) + populate(objectMap, "resolveConfiguration", s.ResolveConfiguration) + populate(objectMap, "scopes", s.Scopes) + populate(objectMap, "severity", s.Severity) + populate(objectMap, "skipQueryValidation", s.SkipQueryValidation) + populate(objectMap, "targetResourceTypes", s.TargetResourceTypes) + populate(objectMap, "windowSize", s.WindowSize) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VMInsightsOnboardingStatus. -func (v *VMInsightsOnboardingStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledQueryRuleProperties. +func (s *ScheduledQueryRuleProperties) 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", v, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &v.ID) + case "actions": + err = unpopulate(val, "Actions", &s.Actions) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &v.Name) + case "autoMitigate": + err = unpopulate(val, "AutoMitigate", &s.AutoMitigate) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &v.Properties) + case "checkWorkspaceAlertsStorageConfigured": + err = unpopulate(val, "CheckWorkspaceAlertsStorageConfigured", &s.CheckWorkspaceAlertsStorageConfigured) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &v.Type) + case "createdWithApiVersion": + err = unpopulate(val, "CreatedWithAPIVersion", &s.CreatedWithAPIVersion) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type VMInsightsOnboardingStatusProperties. -func (v VMInsightsOnboardingStatusProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "data", v.Data) - populate(objectMap, "dataStatus", v.DataStatus) - populate(objectMap, "onboardingStatus", v.OnboardingStatus) - populate(objectMap, "resourceId", v.ResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VMInsightsOnboardingStatusProperties. -func (v *VMInsightsOnboardingStatusProperties) 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", v, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "data": - err = unpopulate(val, "Data", &v.Data) + case "criteria": + err = unpopulate(val, "Criteria", &s.Criteria) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &s.Description) delete(rawMsg, key) - case "dataStatus": - err = unpopulate(val, "DataStatus", &v.DataStatus) + case "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) delete(rawMsg, key) - case "onboardingStatus": - err = unpopulate(val, "OnboardingStatus", &v.OnboardingStatus) + case "enabled": + err = unpopulate(val, "Enabled", &s.Enabled) delete(rawMsg, key) - case "resourceId": - err = unpopulate(val, "ResourceID", &v.ResourceID) + case "evaluationFrequency": + err = unpopulate(val, "EvaluationFrequency", &s.EvaluationFrequency) + delete(rawMsg, key) + case "isLegacyLogAnalyticsRule": + err = unpopulate(val, "IsLegacyLogAnalyticsRule", &s.IsLegacyLogAnalyticsRule) + delete(rawMsg, key) + case "isWorkspaceAlertsStorageConfigured": + err = unpopulate(val, "IsWorkspaceAlertsStorageConfigured", &s.IsWorkspaceAlertsStorageConfigured) + delete(rawMsg, key) + case "muteActionsDuration": + err = unpopulate(val, "MuteActionsDuration", &s.MuteActionsDuration) + delete(rawMsg, key) + case "overrideQueryTimeRange": + err = unpopulate(val, "OverrideQueryTimeRange", &s.OverrideQueryTimeRange) + delete(rawMsg, key) + case "resolveConfiguration": + err = unpopulate(val, "ResolveConfiguration", &s.ResolveConfiguration) + delete(rawMsg, key) + case "scopes": + err = unpopulate(val, "Scopes", &s.Scopes) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &s.Severity) + delete(rawMsg, key) + case "skipQueryValidation": + err = unpopulate(val, "SkipQueryValidation", &s.SkipQueryValidation) + delete(rawMsg, key) + case "targetResourceTypes": + err = unpopulate(val, "TargetResourceTypes", &s.TargetResourceTypes) + delete(rawMsg, key) + case "windowSize": + err = unpopulate(val, "WindowSize", &s.WindowSize) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type VoiceReceiver. -func (v VoiceReceiver) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ScheduledQueryRuleResource. +func (s ScheduledQueryRuleResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "countryCode", v.CountryCode) - populate(objectMap, "name", v.Name) - populate(objectMap, "phoneNumber", v.PhoneNumber) + populate(objectMap, "etag", s.Etag) + populate(objectMap, "id", s.ID) + populate(objectMap, "identity", s.Identity) + populate(objectMap, "kind", s.Kind) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VoiceReceiver. -func (v *VoiceReceiver) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledQueryRuleResource. +func (s *ScheduledQueryRuleResource) 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", v, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "countryCode": - err = unpopulate(val, "CountryCode", &v.CountryCode) + case "etag": + err = unpopulate(val, "Etag", &s.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &s.Identity) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &s.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &v.Name) + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) delete(rawMsg, key) - case "phoneNumber": - err = unpopulate(val, "PhoneNumber", &v.PhoneNumber) + case "type": + err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type VoiceReceiverAutoGenerated. -func (v VoiceReceiverAutoGenerated) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ScheduledQueryRuleResourceCollection. +func (s ScheduledQueryRuleResourceCollection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "countryCode", v.CountryCode) - populate(objectMap, "name", v.Name) - populate(objectMap, "phoneNumber", v.PhoneNumber) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VoiceReceiverAutoGenerated. -func (v *VoiceReceiverAutoGenerated) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledQueryRuleResourceCollection. +func (s *ScheduledQueryRuleResourceCollection) 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", v, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "countryCode": - err = unpopulate(val, "CountryCode", &v.CountryCode) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &v.Name) + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) delete(rawMsg, key) - case "phoneNumber": - err = unpopulate(val, "PhoneNumber", &v.PhoneNumber) + case "value": + err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WebhookNotification. -func (w WebhookNotification) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ScheduledQueryRuleResourcePatch. +func (s ScheduledQueryRuleResourcePatch) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", w.Properties) - populate(objectMap, "serviceUri", w.ServiceURI) + populate(objectMap, "identity", s.Identity) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "tags", s.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WebhookNotification. -func (w *WebhookNotification) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledQueryRuleResourcePatch. +func (s *ScheduledQueryRuleResourcePatch) 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", w, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { + case "identity": + err = unpopulate(val, "Identity", &s.Identity) + delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &w.Properties) + err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) - case "serviceUri": - err = unpopulate(val, "ServiceURI", &w.ServiceURI) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WebhookReceiver. -func (w WebhookReceiver) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SmsReceiver. +func (s SmsReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "identifierUri", w.IdentifierURI) - populate(objectMap, "name", w.Name) - populate(objectMap, "objectId", w.ObjectID) - populate(objectMap, "serviceUri", w.ServiceURI) - populate(objectMap, "tenantId", w.TenantID) - populate(objectMap, "useAadAuth", w.UseAADAuth) - populate(objectMap, "useCommonAlertSchema", w.UseCommonAlertSchema) + populate(objectMap, "countryCode", s.CountryCode) + populate(objectMap, "name", s.Name) + populate(objectMap, "phoneNumber", s.PhoneNumber) + populate(objectMap, "status", s.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WebhookReceiver. -func (w *WebhookReceiver) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SmsReceiver. +func (s *SmsReceiver) 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", w, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "identifierUri": - err = unpopulate(val, "IdentifierURI", &w.IdentifierURI) + case "countryCode": + err = unpopulate(val, "CountryCode", &s.CountryCode) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &w.Name) - delete(rawMsg, key) - case "objectId": - err = unpopulate(val, "ObjectID", &w.ObjectID) - delete(rawMsg, key) - case "serviceUri": - err = unpopulate(val, "ServiceURI", &w.ServiceURI) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &w.TenantID) + err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) - case "useAadAuth": - err = unpopulate(val, "UseAADAuth", &w.UseAADAuth) + case "phoneNumber": + err = unpopulate(val, "PhoneNumber", &s.PhoneNumber) delete(rawMsg, key) - case "useCommonAlertSchema": - err = unpopulate(val, "UseCommonAlertSchema", &w.UseCommonAlertSchema) + case "status": + err = unpopulate(val, "Status", &s.Status) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WebhookReceiverAutoGenerated. -func (w WebhookReceiverAutoGenerated) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "identifierUri", w.IdentifierURI) - populate(objectMap, "name", w.Name) - populate(objectMap, "objectId", w.ObjectID) - populate(objectMap, "serviceUri", w.ServiceURI) - populate(objectMap, "tenantId", w.TenantID) - populate(objectMap, "useAadAuth", w.UseAADAuth) - populate(objectMap, "useCommonAlertSchema", w.UseCommonAlertSchema) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WebhookReceiverAutoGenerated. -func (w *WebhookReceiverAutoGenerated) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "identifierUri": - err = unpopulate(val, "IdentifierURI", &w.IdentifierURI) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &w.Name) + case "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) - case "objectId": - err = unpopulate(val, "ObjectID", &w.ObjectID) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) delete(rawMsg, key) - case "serviceUri": - err = unpopulate(val, "ServiceURI", &w.ServiceURI) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &w.TenantID) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) delete(rawMsg, key) - case "useAadAuth": - err = unpopulate(val, "UseAADAuth", &w.UseAADAuth) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) delete(rawMsg, key) - case "useCommonAlertSchema": - err = unpopulate(val, "UseCommonAlertSchema", &w.UseCommonAlertSchema) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WebtestLocationAvailabilityCriteria. -func (w WebtestLocationAvailabilityCriteria) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TestNotificationDetailsResponse. +func (t TestNotificationDetailsResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "componentId", w.ComponentID) - populate(objectMap, "failedLocationCount", w.FailedLocationCount) - objectMap["odata.type"] = OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria - populate(objectMap, "webTestId", w.WebTestID) - if w.AdditionalProperties != nil { - for key, val := range w.AdditionalProperties { - objectMap[key] = val - } - } + populate(objectMap, "actionDetails", t.ActionDetails) + populate(objectMap, "completedTime", t.CompletedTime) + populate(objectMap, "context", t.Context) + populate(objectMap, "createdTime", t.CreatedTime) + populate(objectMap, "state", t.State) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WebtestLocationAvailabilityCriteria. -func (w *WebtestLocationAvailabilityCriteria) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TestNotificationDetailsResponse. +func (t *TestNotificationDetailsResponse) 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", w, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } for key, val := range rawMsg { var err error switch key { - case "componentId": - err = unpopulate(val, "ComponentID", &w.ComponentID) + case "actionDetails": + err = unpopulate(val, "ActionDetails", &t.ActionDetails) delete(rawMsg, key) - case "failedLocationCount": - err = unpopulate(val, "FailedLocationCount", &w.FailedLocationCount) + case "completedTime": + err = unpopulate(val, "CompletedTime", &t.CompletedTime) delete(rawMsg, key) - case "odata.type": - err = unpopulate(val, "ODataType", &w.ODataType) + case "context": + err = unpopulate(val, "Context", &t.Context) delete(rawMsg, key) - case "webTestId": - err = unpopulate(val, "WebTestID", &w.WebTestID) + case "createdTime": + err = unpopulate(val, "CreatedTime", &t.CreatedTime) delete(rawMsg, key) - default: - if w.AdditionalProperties == nil { - w.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - w.AdditionalProperties[key] = aux - } + case "state": + err = unpopulate(val, "State", &t.State) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", t, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WindowsEventLogDataSource. -func (w WindowsEventLogDataSource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentity. +func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", w.Name) - populate(objectMap, "streams", w.Streams) - populate(objectMap, "xPathQueries", w.XPathQueries) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WindowsEventLogDataSource. -func (w *WindowsEventLogDataSource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity. +func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &w.Name) - delete(rawMsg, key) - case "streams": - err = unpopulate(val, "Streams", &w.Streams) + case "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) delete(rawMsg, key) - case "xPathQueries": - err = unpopulate(val, "XPathQueries", &w.XPathQueries) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WindowsFirewallLogsDataSource. -func (w WindowsFirewallLogsDataSource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UserIdentityProperties. +func (u UserIdentityProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", w.Name) - populate(objectMap, "streams", w.Streams) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WindowsFirewallLogsDataSource. -func (w *WindowsFirewallLogsDataSource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type UserIdentityProperties. +func (u *UserIdentityProperties) 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", w, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &w.Name) + case "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) delete(rawMsg, key) - case "streams": - err = unpopulate(val, "Streams", &w.Streams) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", u, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WorkspaceInfo. -func (w WorkspaceInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VoiceReceiver. +func (v VoiceReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", w.ID) - populate(objectMap, "location", w.Location) - populate(objectMap, "properties", w.Properties) + populate(objectMap, "countryCode", v.CountryCode) + populate(objectMap, "name", v.Name) + populate(objectMap, "phoneNumber", v.PhoneNumber) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkspaceInfo. -func (w *WorkspaceInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VoiceReceiver. +func (v *VoiceReceiver) 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", w, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &w.ID) + case "countryCode": + err = unpopulate(val, "CountryCode", &v.CountryCode) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &w.Location) + case "name": + err = unpopulate(val, "Name", &v.Name) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &w.Properties) + case "phoneNumber": + err = unpopulate(val, "PhoneNumber", &v.PhoneNumber) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) + return fmt.Errorf("unmarshalling type %T: %v", v, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type WorkspaceInfoProperties. -func (w WorkspaceInfoProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type WebhookReceiver. +func (w WebhookReceiver) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "customerId", w.CustomerID) + populate(objectMap, "identifierUri", w.IdentifierURI) + populate(objectMap, "managedIdentity", w.ManagedIdentity) + populate(objectMap, "name", w.Name) + populate(objectMap, "objectId", w.ObjectID) + populate(objectMap, "serviceUri", w.ServiceURI) + populate(objectMap, "tenantId", w.TenantID) + populate(objectMap, "useAadAuth", w.UseAADAuth) + populate(objectMap, "useCommonAlertSchema", w.UseCommonAlertSchema) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkspaceInfoProperties. -func (w *WorkspaceInfoProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type WebhookReceiver. +func (w *WebhookReceiver) 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", w, err) @@ -11120,8 +1797,29 @@ func (w *WorkspaceInfoProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "customerId": - err = unpopulate(val, "CustomerID", &w.CustomerID) + case "identifierUri": + err = unpopulate(val, "IdentifierURI", &w.IdentifierURI) + delete(rawMsg, key) + case "managedIdentity": + err = unpopulate(val, "ManagedIdentity", &w.ManagedIdentity) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "objectId": + err = unpopulate(val, "ObjectID", &w.ObjectID) + delete(rawMsg, key) + case "serviceUri": + err = unpopulate(val, "ServiceURI", &w.ServiceURI) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &w.TenantID) + delete(rawMsg, key) + case "useAadAuth": + err = unpopulate(val, "UseAADAuth", &w.UseAADAuth) + delete(rawMsg, key) + case "useCommonAlertSchema": + err = unpopulate(val, "UseCommonAlertSchema", &w.UseCommonAlertSchema) delete(rawMsg, key) } if err != nil { @@ -11152,7 +1850,7 @@ func populateAny(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/monitor/armmonitor/operations_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/operations_client_example_test.go deleted file mode 100644 index 355e0f5525d9..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/operations_client_example_test.go +++ /dev/null @@ -1,433 +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 armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/OperationList.json -func ExampleOperationsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewOperationsClient().List(ctx, 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.OperationListResult = armmonitor.OperationListResult{ - // Value: []*armmonitor.Operation{ - // { - // Name: to.Ptr("Microsoft.Insights/Operations/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Operations read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Operations"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/MetricDefinitions/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Metric definitions read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Metric Definitions"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Metrics/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Metrics read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Metrics"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AlertRules/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Alert Rule write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Alert Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AlertRules/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Alert Rule delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Alert Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AlertRules/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Alert Rule read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Alert Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/MetricAlerts/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Metric alert write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Metric alerts"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/MetricAlerts/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Metric alert delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Metric alerts"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/MetricAlerts/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Metric alert read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Metric alerts"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AutoscaleSettings/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Autoscale Setting write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Autoscale"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AutoscaleSettings/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Autoscale Setting delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Autoscale"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AutoscaleSettings/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Autoscale Setting read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Autoscale"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AlertRules/Incidents/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Alert Rule Incidents read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Alert Rule Incident resource"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AutoscaleSettings/providers/Microsoft.Insights/MetricDefinitions/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Metric definitions read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Metric Definitions"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ActionGroups/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Action group write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Action groups"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ActionGroups/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Action group delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Action groups"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ActionGroups/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Action group read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Action groups"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ActivityLogAlerts/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Activity log alert read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Activity log alert"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ActivityLogAlerts/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Activity log alert delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Activity log alert"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ActivityLogAlerts/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Activity log alert read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Activity log alert"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ActivityLogAlerts/Activated/Action"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Activity Log Alert Activated"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Activity Log Alert"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/EventCategories/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Event category read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Event category"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/eventtypes/values/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Event types management values read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Events"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/eventtypes/digestevents/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Event types management digest read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Digest events"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/DiagnosticSettings/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Diagnostic settings write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Diagnostic settings"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/DiagnosticSettings/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Diagnostic settings delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Diagnostic settings"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/DiagnosticSettings/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Diagnostic settings read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Diagnostic settings"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ExtendedDiagnosticSettings/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Extended Diagnostic settings write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Extended Diagnostic settings"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ExtendedDiagnosticSettings/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Extended Diagnostic settings delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Extended Diagnostic settings"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/ExtendedDiagnosticSettings/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Extended Diagnostic settings read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Extended Diagnostic settings"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/LogProfiles/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Log profile write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Log Profiles"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/LogProfiles/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Log profile delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Log Profiles"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/LogProfiles/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Log profile read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Log Profiles"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/LogDefinitions/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Log Definitions read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Log Definitions"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AutoscaleSettings/Scaleup/Action"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Autoscale scale up operation"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Autoscale"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AutoscaleSettings/Scaledown/Action"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Autoscale scale down operation"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Autoscale"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AlertRules/Activated/Action"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Alert Rule activated"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Alert Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AlertRules/Resolved/Action"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Alert Rule resolved"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Alert Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/AlertRules/Throttled/Action"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Alert Rule throttled"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Alert Rules"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Register/Action"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Register Microsoft.Insights"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Microsoft.Insights"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Components/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Application insights component write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Application insights components"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Components/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Application insights component delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Application insights components"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Components/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Application insights component read"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Application insights components"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Webtests/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Webtest write"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Web tests"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Webtests/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Webtest delete"), - // Provider: to.Ptr("Microsoft Monitoring Insights"), - // Resource: to.Ptr("Web tests"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Workbooks/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Workbooks read"), - // Provider: to.Ptr("Microsoft Application Insights"), - // Resource: to.Ptr("Workbooks"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Workbooks/Write"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Workbooks write"), - // Provider: to.Ptr("Microsoft Application Insights"), - // Resource: to.Ptr("Workbooks"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Workbooks/Delete"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Workbooks delete"), - // Provider: to.Ptr("Microsoft Application Insights"), - // Resource: to.Ptr("Workbooks"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.Insights/Workbooks/Read"), - // Display: &armmonitor.OperationDisplay{ - // Operation: to.Ptr("Workbooks read"), - // Provider: to.Ptr("Microsoft Application Insights"), - // Resource: to.Ptr("Workbooks"), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client.go b/sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client.go deleted file mode 100644 index 1f4659654f7e..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client.go +++ /dev/null @@ -1,89 +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 armmonitor - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" -) - -// OperationsForMonitorClient contains the methods for the OperationsForMonitor group. -// Don't use this type directly, use NewOperationsForMonitorClient() instead. -type OperationsForMonitorClient struct { - internal *arm.Client -} - -// NewOperationsForMonitorClient creates a new instance of OperationsForMonitorClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewOperationsForMonitorClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsForMonitorClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &OperationsForMonitorClient{ - internal: cl, - } - return client, nil -} - -// NewListPager - Lists available Operations for this Resource Provider -// -// Generated from API version 2021-06-03-preview -// - options - OperationsForMonitorClientListOptions contains the optional parameters for the OperationsForMonitorClient.NewListPager -// method. -func (client *OperationsForMonitorClient) NewListPager(options *OperationsForMonitorClientListOptions) *runtime.Pager[OperationsForMonitorClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[OperationsForMonitorClientListResponse]{ - More: func(page OperationsForMonitorClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *OperationsForMonitorClientListResponse) (OperationsForMonitorClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsForMonitorClient.NewListPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, options) - }, nil) - if err != nil { - return OperationsForMonitorClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *OperationsForMonitorClient) listCreateRequest(ctx context.Context, options *OperationsForMonitorClientListOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Monitor/operations" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-03-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *OperationsForMonitorClient) listHandleResponse(resp *http.Response) (OperationsForMonitorClientListResponse, error) { - result := OperationsForMonitorClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResultAutoGenerated); err != nil { - return OperationsForMonitorClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client_example_test.go deleted file mode 100644 index 19685e884442..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/operationsformonitor_client_example_test.go +++ /dev/null @@ -1,101 +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 armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/OperationsGet.json -func ExampleOperationsForMonitorClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsForMonitorClient().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.OperationListResultAutoGenerated = armmonitor.OperationListResultAutoGenerated{ - // Value: []*armmonitor.OperationAutoGenerated{ - // { - // Name: to.Ptr("microsoft.monitor/accounts/read"), - // Display: &armmonitor.OperationDisplayAutoGenerated{ - // Description: to.Ptr("Read any Azure Monitor Workspace"), - // Operation: to.Ptr("Read Azure Monitor Workspaces"), - // Provider: to.Ptr("Microsoft Monitoring"), - // Resource: to.Ptr("Azure Monitor Workspaces"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armmonitor.Origin("user, system")), - // }, - // { - // Name: to.Ptr("microsoft.monitor/accounts/write"), - // Display: &armmonitor.OperationDisplayAutoGenerated{ - // Description: to.Ptr("Create or Update any Azure Monitor Workspace"), - // Operation: to.Ptr("Create or Update Azure Monitor Workspaces"), - // Provider: to.Ptr("Microsoft Monitoring"), - // Resource: to.Ptr("Azure Monitor Workspaces"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armmonitor.Origin("user, system")), - // }, - // { - // Name: to.Ptr("microsoft.monitor/accounts/delete"), - // Display: &armmonitor.OperationDisplayAutoGenerated{ - // Description: to.Ptr("Delete any Azure Monitor Workspace"), - // Operation: to.Ptr("Delete Azure Monitor Workspaces"), - // Provider: to.Ptr("Microsoft Monitoring"), - // Resource: to.Ptr("Azure Monitor Workspaces"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armmonitor.Origin("user, system")), - // }, - // { - // Name: to.Ptr("microsoft.monitor/accounts/metrics/read"), - // Display: &armmonitor.OperationDisplayAutoGenerated{ - // Description: to.Ptr("Read Azure Monitor Workspace metrics"), - // Operation: to.Ptr("Read Azure Monitor Workspace metrics"), - // Provider: to.Ptr("Microsoft Monitoring"), - // Resource: to.Ptr("Azure Monitor Workspaces"), - // }, - // IsDataAction: to.Ptr(false), - // Origin: to.Ptr(armmonitor.Origin("user, system")), - // }, - // { - // Name: to.Ptr("microsoft.monitor/accounts/data/metrics/read"), - // Display: &armmonitor.OperationDisplayAutoGenerated{ - // Description: to.Ptr("Read metrics data in any Azure Monitor Workspace"), - // Operation: to.Ptr("Read Metrics Data"), - // Provider: to.Ptr("Microsoft Monitoring"), - // Resource: to.Ptr("Azure Monitor Workspaces"), - // }, - // IsDataAction: to.Ptr(true), - // Origin: to.Ptr(armmonitor.Origin("user, system")), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/options.go b/sdk/resourcemanager/monitor/armmonitor/options.go index b737f70d4922..bbdac48822ca 100644 --- a/sdk/resourcemanager/monitor/armmonitor/options.go +++ b/sdk/resourcemanager/monitor/armmonitor/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,7 +8,7 @@ package armmonitor // ActionGroupsClientBeginCreateNotificationsAtActionGroupResourceLevelOptions contains the optional parameters for the ActionGroupsClient.BeginCreateNotificationsAtActionGroupResourceLevel // method. type ActionGroupsClientBeginCreateNotificationsAtActionGroupResourceLevelOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -58,708 +55,6 @@ type ActionGroupsClientUpdateOptions struct { // placeholder for future optional parameters } -// ActivityLogAlertsClientCreateOrUpdateOptions contains the optional parameters for the ActivityLogAlertsClient.CreateOrUpdate -// method. -type ActivityLogAlertsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// ActivityLogAlertsClientDeleteOptions contains the optional parameters for the ActivityLogAlertsClient.Delete method. -type ActivityLogAlertsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ActivityLogAlertsClientGetOptions contains the optional parameters for the ActivityLogAlertsClient.Get method. -type ActivityLogAlertsClientGetOptions struct { - // placeholder for future optional parameters -} - -// ActivityLogAlertsClientListByResourceGroupOptions contains the optional parameters for the ActivityLogAlertsClient.NewListByResourceGroupPager -// method. -type ActivityLogAlertsClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// ActivityLogAlertsClientListBySubscriptionIDOptions contains the optional parameters for the ActivityLogAlertsClient.NewListBySubscriptionIDPager -// method. -type ActivityLogAlertsClientListBySubscriptionIDOptions struct { - // placeholder for future optional parameters -} - -// ActivityLogAlertsClientUpdateOptions contains the optional parameters for the ActivityLogAlertsClient.Update method. -type ActivityLogAlertsClientUpdateOptions struct { - // placeholder for future optional parameters -} - -// ActivityLogsClientListOptions contains the optional parameters for the ActivityLogsClient.NewListPager method. -type ActivityLogsClientListOptions struct { - // Used to fetch events with only the given properties. - // The $select argument is a comma separated list of property names to be returned. Possible values are: authorization, claims, - // correlationId, description, eventDataId, eventName, eventTimestamp, - // httpRequest, level, operationId, operationName, properties, resourceGroupName, resourceProviderName, resourceId, status, - // submissionTimestamp, subStatus, subscriptionId - Select *string -} - -// AlertRuleIncidentsClientGetOptions contains the optional parameters for the AlertRuleIncidentsClient.Get method. -type AlertRuleIncidentsClientGetOptions struct { - // placeholder for future optional parameters -} - -// AlertRuleIncidentsClientListByAlertRuleOptions contains the optional parameters for the AlertRuleIncidentsClient.NewListByAlertRulePager -// method. -type AlertRuleIncidentsClientListByAlertRuleOptions struct { - // placeholder for future optional parameters -} - -// AlertRulesClientCreateOrUpdateOptions contains the optional parameters for the AlertRulesClient.CreateOrUpdate method. -type AlertRulesClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// AlertRulesClientDeleteOptions contains the optional parameters for the AlertRulesClient.Delete method. -type AlertRulesClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// AlertRulesClientGetOptions contains the optional parameters for the AlertRulesClient.Get method. -type AlertRulesClientGetOptions struct { - // placeholder for future optional parameters -} - -// AlertRulesClientListByResourceGroupOptions contains the optional parameters for the AlertRulesClient.NewListByResourceGroupPager -// method. -type AlertRulesClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// AlertRulesClientListBySubscriptionOptions contains the optional parameters for the AlertRulesClient.NewListBySubscriptionPager -// method. -type AlertRulesClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// AlertRulesClientUpdateOptions contains the optional parameters for the AlertRulesClient.Update method. -type AlertRulesClientUpdateOptions struct { - // placeholder for future optional parameters -} - -// AutoscaleSettingsClientCreateOrUpdateOptions contains the optional parameters for the AutoscaleSettingsClient.CreateOrUpdate -// method. -type AutoscaleSettingsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// AutoscaleSettingsClientDeleteOptions contains the optional parameters for the AutoscaleSettingsClient.Delete method. -type AutoscaleSettingsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// AutoscaleSettingsClientGetOptions contains the optional parameters for the AutoscaleSettingsClient.Get method. -type AutoscaleSettingsClientGetOptions struct { - // placeholder for future optional parameters -} - -// AutoscaleSettingsClientListByResourceGroupOptions contains the optional parameters for the AutoscaleSettingsClient.NewListByResourceGroupPager -// method. -type AutoscaleSettingsClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// AutoscaleSettingsClientListBySubscriptionOptions contains the optional parameters for the AutoscaleSettingsClient.NewListBySubscriptionPager -// method. -type AutoscaleSettingsClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// AutoscaleSettingsClientUpdateOptions contains the optional parameters for the AutoscaleSettingsClient.Update method. -type AutoscaleSettingsClientUpdateOptions struct { - // placeholder for future optional parameters -} - -// AzureMonitorWorkspacesClientCreateOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Create -// method. -type AzureMonitorWorkspacesClientCreateOptions struct { - // placeholder for future optional parameters -} - -// AzureMonitorWorkspacesClientDeleteOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Delete -// method. -type AzureMonitorWorkspacesClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// AzureMonitorWorkspacesClientGetOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Get method. -type AzureMonitorWorkspacesClientGetOptions struct { - // placeholder for future optional parameters -} - -// AzureMonitorWorkspacesClientListByResourceGroupOptions contains the optional parameters for the AzureMonitorWorkspacesClient.NewListByResourceGroupPager -// method. -type AzureMonitorWorkspacesClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// AzureMonitorWorkspacesClientListBySubscriptionOptions contains the optional parameters for the AzureMonitorWorkspacesClient.NewListBySubscriptionPager -// method. -type AzureMonitorWorkspacesClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// AzureMonitorWorkspacesClientUpdateOptions contains the optional parameters for the AzureMonitorWorkspacesClient.Update -// method. -type AzureMonitorWorkspacesClientUpdateOptions struct { - // The payload - AzureMonitorWorkspaceProperties *AzureMonitorWorkspaceResourceForUpdate -} - -// BaselinesClientListOptions contains the optional parameters for the BaselinesClient.NewListPager method. -type BaselinesClientListOptions struct { - // The list of aggregation types (comma separated) to retrieve. - Aggregation *string - - // The $filter is used to reduce the set of metric data returned. Example: Metric contains metadata A, B and C. - Return all - // time series of C where A = a1 and B = b1 or b2 $filter=A eq 'a1' and B eq 'b1' - // or B eq 'b2' and C eq '' - Invalid variant: $filter=A eq 'a1' and B eq 'b1' and C eq '' or B = 'b2' This is invalid because - // the logical or operator cannot separate two different metadata names. - - // Return all time series where A = a1, B = b1 and C = c1: $filter=A eq 'a1' and B eq 'b1' and C eq 'c1' - Return all time - // series where A = a1 $filter=A eq 'a1' and B eq '' and C eq ''. Special case: - // When dimension name or dimension value uses round brackets. Eg: When dimension name is dim (test) 1 Instead of using $filter= - // "dim (test) 1 eq '' " use $filter= "dim %2528test%2529 1 eq '' " When - // dimension name is dim (test) 3 and dimension value is dim3 (test) val Instead of using $filter= "dim (test) 3 eq 'dim3 - // (test) val' " use $filter= "dim %2528test%2529 3 eq 'dim3 %2528test%2529 val' " - Filter *string - - // The interval (i.e. timegrain) of the query. - Interval *string - - // The names of the metrics (comma separated) to retrieve. Special case: If a metricname itself has a comma in it then use - // %2 to indicate it. Eg: 'Metric,Name1' should be 'Metric%2Name1' - Metricnames *string - - // Metric namespace to query metric definitions for. - Metricnamespace *string - - // Allows retrieving only metadata of the baseline. On data request all information is retrieved. - ResultType *ResultType - - // The list of sensitivities (comma separated) to retrieve. - Sensitivities *string - - // The timespan of the query. It is a string with the following format 'startDateTimeISO/endDateTimeISO'. - Timespan *string -} - -// DataCollectionEndpointsClientCreateOptions contains the optional parameters for the DataCollectionEndpointsClient.Create -// method. -type DataCollectionEndpointsClientCreateOptions struct { - // The payload - Body *DataCollectionEndpointResource -} - -// DataCollectionEndpointsClientDeleteOptions contains the optional parameters for the DataCollectionEndpointsClient.Delete -// method. -type DataCollectionEndpointsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// DataCollectionEndpointsClientGetOptions contains the optional parameters for the DataCollectionEndpointsClient.Get method. -type DataCollectionEndpointsClientGetOptions struct { - // placeholder for future optional parameters -} - -// DataCollectionEndpointsClientListByResourceGroupOptions contains the optional parameters for the DataCollectionEndpointsClient.NewListByResourceGroupPager -// method. -type DataCollectionEndpointsClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// DataCollectionEndpointsClientListBySubscriptionOptions contains the optional parameters for the DataCollectionEndpointsClient.NewListBySubscriptionPager -// method. -type DataCollectionEndpointsClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// DataCollectionEndpointsClientUpdateOptions contains the optional parameters for the DataCollectionEndpointsClient.Update -// method. -type DataCollectionEndpointsClientUpdateOptions struct { - // The payload - Body *ResourceForUpdate -} - -// DataCollectionRuleAssociationsClientCreateOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.Create -// method. -type DataCollectionRuleAssociationsClientCreateOptions struct { - // The payload - Body *DataCollectionRuleAssociationProxyOnlyResource -} - -// DataCollectionRuleAssociationsClientDeleteOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.Delete -// method. -type DataCollectionRuleAssociationsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// DataCollectionRuleAssociationsClientGetOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.Get -// method. -type DataCollectionRuleAssociationsClientGetOptions struct { - // placeholder for future optional parameters -} - -// DataCollectionRuleAssociationsClientListByDataCollectionEndpointOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.NewListByDataCollectionEndpointPager -// method. -type DataCollectionRuleAssociationsClientListByDataCollectionEndpointOptions struct { - // placeholder for future optional parameters -} - -// DataCollectionRuleAssociationsClientListByResourceOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.NewListByResourcePager -// method. -type DataCollectionRuleAssociationsClientListByResourceOptions struct { - // placeholder for future optional parameters -} - -// DataCollectionRuleAssociationsClientListByRuleOptions contains the optional parameters for the DataCollectionRuleAssociationsClient.NewListByRulePager -// method. -type DataCollectionRuleAssociationsClientListByRuleOptions struct { - // placeholder for future optional parameters -} - -// DataCollectionRulesClientCreateOptions contains the optional parameters for the DataCollectionRulesClient.Create method. -type DataCollectionRulesClientCreateOptions struct { - // The payload - Body *DataCollectionRuleResource -} - -// DataCollectionRulesClientDeleteOptions contains the optional parameters for the DataCollectionRulesClient.Delete method. -type DataCollectionRulesClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// DataCollectionRulesClientGetOptions contains the optional parameters for the DataCollectionRulesClient.Get method. -type DataCollectionRulesClientGetOptions struct { - // placeholder for future optional parameters -} - -// DataCollectionRulesClientListByResourceGroupOptions contains the optional parameters for the DataCollectionRulesClient.NewListByResourceGroupPager -// method. -type DataCollectionRulesClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// DataCollectionRulesClientListBySubscriptionOptions contains the optional parameters for the DataCollectionRulesClient.NewListBySubscriptionPager -// method. -type DataCollectionRulesClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// DataCollectionRulesClientUpdateOptions contains the optional parameters for the DataCollectionRulesClient.Update method. -type DataCollectionRulesClientUpdateOptions struct { - // The payload - Body *ResourceForUpdate -} - -// DiagnosticSettingsCategoryClientGetOptions contains the optional parameters for the DiagnosticSettingsCategoryClient.Get -// method. -type DiagnosticSettingsCategoryClientGetOptions struct { - // placeholder for future optional parameters -} - -// DiagnosticSettingsCategoryClientListOptions contains the optional parameters for the DiagnosticSettingsCategoryClient.NewListPager -// method. -type DiagnosticSettingsCategoryClientListOptions struct { - // placeholder for future optional parameters -} - -// DiagnosticSettingsClientCreateOrUpdateOptions contains the optional parameters for the DiagnosticSettingsClient.CreateOrUpdate -// method. -type DiagnosticSettingsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// DiagnosticSettingsClientDeleteOptions contains the optional parameters for the DiagnosticSettingsClient.Delete method. -type DiagnosticSettingsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// DiagnosticSettingsClientGetOptions contains the optional parameters for the DiagnosticSettingsClient.Get method. -type DiagnosticSettingsClientGetOptions struct { - // placeholder for future optional parameters -} - -// DiagnosticSettingsClientListOptions contains the optional parameters for the DiagnosticSettingsClient.NewListPager method. -type DiagnosticSettingsClientListOptions struct { - // placeholder for future optional parameters -} - -// EventCategoriesClientListOptions contains the optional parameters for the EventCategoriesClient.NewListPager method. -type EventCategoriesClientListOptions struct { - // placeholder for future optional parameters -} - -// LogProfilesClientCreateOrUpdateOptions contains the optional parameters for the LogProfilesClient.CreateOrUpdate method. -type LogProfilesClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// LogProfilesClientDeleteOptions contains the optional parameters for the LogProfilesClient.Delete method. -type LogProfilesClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// LogProfilesClientGetOptions contains the optional parameters for the LogProfilesClient.Get method. -type LogProfilesClientGetOptions struct { - // placeholder for future optional parameters -} - -// LogProfilesClientListOptions contains the optional parameters for the LogProfilesClient.NewListPager method. -type LogProfilesClientListOptions struct { - // placeholder for future optional parameters -} - -// LogProfilesClientUpdateOptions contains the optional parameters for the LogProfilesClient.Update method. -type LogProfilesClientUpdateOptions struct { - // placeholder for future optional parameters -} - -// MetricAlertsClientCreateOrUpdateOptions contains the optional parameters for the MetricAlertsClient.CreateOrUpdate method. -type MetricAlertsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// MetricAlertsClientDeleteOptions contains the optional parameters for the MetricAlertsClient.Delete method. -type MetricAlertsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// MetricAlertsClientGetOptions contains the optional parameters for the MetricAlertsClient.Get method. -type MetricAlertsClientGetOptions struct { - // placeholder for future optional parameters -} - -// MetricAlertsClientListByResourceGroupOptions contains the optional parameters for the MetricAlertsClient.NewListByResourceGroupPager -// method. -type MetricAlertsClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// MetricAlertsClientListBySubscriptionOptions contains the optional parameters for the MetricAlertsClient.NewListBySubscriptionPager -// method. -type MetricAlertsClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// MetricAlertsClientUpdateOptions contains the optional parameters for the MetricAlertsClient.Update method. -type MetricAlertsClientUpdateOptions struct { - // placeholder for future optional parameters -} - -// MetricAlertsStatusClientListByNameOptions contains the optional parameters for the MetricAlertsStatusClient.ListByName -// method. -type MetricAlertsStatusClientListByNameOptions struct { - // placeholder for future optional parameters -} - -// MetricAlertsStatusClientListOptions contains the optional parameters for the MetricAlertsStatusClient.List method. -type MetricAlertsStatusClientListOptions struct { - // placeholder for future optional parameters -} - -// MetricDefinitionsClientListAtSubscriptionScopeOptions contains the optional parameters for the MetricDefinitionsClient.NewListAtSubscriptionScopePager -// method. -type MetricDefinitionsClientListAtSubscriptionScopeOptions struct { - // Metric namespace where the metrics you want reside. - Metricnamespace *string -} - -// MetricDefinitionsClientListOptions contains the optional parameters for the MetricDefinitionsClient.NewListPager method. -type MetricDefinitionsClientListOptions struct { - // Metric namespace where the metrics you want reside. - Metricnamespace *string -} - -// MetricNamespacesClientListOptions contains the optional parameters for the MetricNamespacesClient.NewListPager method. -type MetricNamespacesClientListOptions struct { - // The ISO 8601 conform Date start time from which to query for metric namespaces. - StartTime *string -} - -// MetricsClientListAtSubscriptionScopeOptions contains the optional parameters for the MetricsClient.ListAtSubscriptionScope -// method. -type MetricsClientListAtSubscriptionScopeOptions struct { - // The list of aggregation types (comma separated) to retrieve. - Aggregation *string - - // When set to true, if the timespan passed in is not supported by this metric, the API will return the result using the closest - // supported timespan. When set to false, an error is returned for invalid - // timespan parameters. Defaults to false. - AutoAdjustTimegrain *bool - - // The $filter is used to reduce the set of metric data returned. - // Example: - // Metric contains metadata A, B and C. - // - Return all time series of C where A = a1 and B = b1 or b2 - // $filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘’ - // - Invalid variant: - // $filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘’ or B = ‘b2’ - // This is invalid because the logical or operator cannot separate two different metadata names. - // - Return all time series where A = a1, B = b1 and C = c1: - // $filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’ - // - Return all time series where A = a1 - // $filter=A eq ‘a1’ and B eq ‘’ and C eq ‘’. - Filter *string - - // The interval (i.e. timegrain) of the query. - Interval *string - - // The names of the metrics (comma separated) to retrieve. - Metricnames *string - - // Metric namespace where the metrics you want reside. - Metricnamespace *string - - // The aggregation to use for sorting results and the direction of the sort. Only one order can be specified. Examples: sum - // asc. - Orderby *string - - // Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details. - ResultType *MetricResultType - - // The timespan of the query. It is a string with the following format 'startDateTimeISO/endDateTimeISO'. - Timespan *string - - // The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10. - Top *int32 - - // When set to false, invalid filter parameter values will be ignored. When set to true, an error is returned for invalid - // filter parameters. Defaults to true. - ValidateDimensions *bool -} - -// MetricsClientListAtSubscriptionScopePostOptions contains the optional parameters for the MetricsClient.ListAtSubscriptionScopePost -// method. -type MetricsClientListAtSubscriptionScopePostOptions struct { - // The list of aggregation types (comma separated) to retrieve. - Aggregation *string - - // When set to true, if the timespan passed in is not supported by this metric, the API will return the result using the closest - // supported timespan. When set to false, an error is returned for invalid - // timespan parameters. Defaults to false. - AutoAdjustTimegrain *bool - - // Parameters serialized in the body - Body *SubscriptionScopeMetricsRequestBodyParameters - - // The $filter is used to reduce the set of metric data returned. - // Example: - // Metric contains metadata A, B and C. - // - Return all time series of C where A = a1 and B = b1 or b2 - // $filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘’ - // - Invalid variant: - // $filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘’ or B = ‘b2’ - // This is invalid because the logical or operator cannot separate two different metadata names. - // - Return all time series where A = a1, B = b1 and C = c1: - // $filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’ - // - Return all time series where A = a1 - // $filter=A eq ‘a1’ and B eq ‘’ and C eq ‘’. - Filter *string - - // The interval (i.e. timegrain) of the query. - Interval *string - - // The names of the metrics (comma separated) to retrieve. - Metricnames *string - - // Metric namespace where the metrics you want reside. - Metricnamespace *string - - // The aggregation to use for sorting results and the direction of the sort. Only one order can be specified. Examples: sum - // asc. - Orderby *string - - // Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details. - ResultType *MetricResultType - - // The timespan of the query. It is a string with the following format 'startDateTimeISO/endDateTimeISO'. - Timespan *string - - // The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10. - Top *int32 - - // When set to false, invalid filter parameter values will be ignored. When set to true, an error is returned for invalid - // filter parameters. Defaults to true. - ValidateDimensions *bool -} - -// MetricsClientListOptions contains the optional parameters for the MetricsClient.List method. -type MetricsClientListOptions struct { - // The list of aggregation types (comma separated) to retrieve. - Aggregation *string - - // When set to true, if the timespan passed in is not supported by this metric, the API will return the result using the closest - // supported timespan. When set to false, an error is returned for invalid - // timespan parameters. Defaults to false. - AutoAdjustTimegrain *bool - - // The $filter is used to reduce the set of metric data returned. - // Example: - // Metric contains metadata A, B and C. - // - Return all time series of C where A = a1 and B = b1 or b2 - // $filter=A eq ‘a1’ and B eq ‘b1’ or B eq ‘b2’ and C eq ‘’ - // - Invalid variant: - // $filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘’ or B = ‘b2’ - // This is invalid because the logical or operator cannot separate two different metadata names. - // - Return all time series where A = a1, B = b1 and C = c1: - // $filter=A eq ‘a1’ and B eq ‘b1’ and C eq ‘c1’ - // - Return all time series where A = a1 - // $filter=A eq ‘a1’ and B eq ‘’ and C eq ‘’. - Filter *string - - // The interval (i.e. timegrain) of the query. - Interval *string - - // The names of the metrics (comma separated) to retrieve. - Metricnames *string - - // Metric namespace where the metrics you want reside. - Metricnamespace *string - - // The aggregation to use for sorting results and the direction of the sort. Only one order can be specified. Examples: sum - // asc. - Orderby *string - - // Reduces the set of data collected. The syntax allowed depends on the operation. See the operation's description for details. - ResultType *ResultType - - // The timespan of the query. It is a string with the following format 'startDateTimeISO/endDateTimeISO'. - Timespan *string - - // The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10. - Top *int32 - - // When set to false, invalid filter parameter values will be ignored. When set to true, an error is returned for invalid - // filter parameters. Defaults to true. - ValidateDimensions *bool -} - -// OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. -type OperationsClientListOptions struct { - // placeholder for future optional parameters -} - -// OperationsForMonitorClientListOptions contains the optional parameters for the OperationsForMonitorClient.NewListPager -// method. -type OperationsForMonitorClientListOptions struct { - // placeholder for future optional parameters -} - -// PredictiveMetricClientGetOptions contains the optional parameters for the PredictiveMetricClient.Get method. -type PredictiveMetricClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate -// method. -type PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete -// method. -type PrivateEndpointConnectionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get -// method. -type PrivateEndpointConnectionsClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateEndpointConnectionsClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateEndpointConnectionsClient.ListByPrivateLinkScope -// method. -type PrivateEndpointConnectionsClientListByPrivateLinkScopeOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get method. -type PrivateLinkResourcesClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkResourcesClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByPrivateLinkScope -// method. -type PrivateLinkResourcesClientListByPrivateLinkScopeOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkScopeOperationStatusClientGetOptions contains the optional parameters for the PrivateLinkScopeOperationStatusClient.Get -// method. -type PrivateLinkScopeOperationStatusClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkScopedResourcesClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateLinkScopedResourcesClient.BeginCreateOrUpdate -// method. -type PrivateLinkScopedResourcesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateLinkScopedResourcesClientBeginDeleteOptions contains the optional parameters for the PrivateLinkScopedResourcesClient.BeginDelete -// method. -type PrivateLinkScopedResourcesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateLinkScopedResourcesClientGetOptions contains the optional parameters for the PrivateLinkScopedResourcesClient.Get -// method. -type PrivateLinkScopedResourcesClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkScopedResourcesClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateLinkScopedResourcesClient.NewListByPrivateLinkScopePager -// method. -type PrivateLinkScopedResourcesClientListByPrivateLinkScopeOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkScopesClientBeginDeleteOptions contains the optional parameters for the PrivateLinkScopesClient.BeginDelete -// method. -type PrivateLinkScopesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// PrivateLinkScopesClientCreateOrUpdateOptions contains the optional parameters for the PrivateLinkScopesClient.CreateOrUpdate -// method. -type PrivateLinkScopesClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkScopesClientGetOptions contains the optional parameters for the PrivateLinkScopesClient.Get method. -type PrivateLinkScopesClientGetOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkScopesClientListByResourceGroupOptions contains the optional parameters for the PrivateLinkScopesClient.NewListByResourceGroupPager -// method. -type PrivateLinkScopesClientListByResourceGroupOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkScopesClientListOptions contains the optional parameters for the PrivateLinkScopesClient.NewListPager method. -type PrivateLinkScopesClientListOptions struct { - // placeholder for future optional parameters -} - -// PrivateLinkScopesClientUpdateTagsOptions contains the optional parameters for the PrivateLinkScopesClient.UpdateTags method. -type PrivateLinkScopesClientUpdateTagsOptions struct { - // placeholder for future optional parameters -} - // ScheduledQueryRulesClientCreateOrUpdateOptions contains the optional parameters for the ScheduledQueryRulesClient.CreateOrUpdate // method. type ScheduledQueryRulesClientCreateOrUpdateOptions struct { @@ -792,61 +87,3 @@ type ScheduledQueryRulesClientListBySubscriptionOptions struct { type ScheduledQueryRulesClientUpdateOptions struct { // placeholder for future optional parameters } - -// TenantActionGroupsClientCreateOrUpdateOptions contains the optional parameters for the TenantActionGroupsClient.CreateOrUpdate -// method. -type TenantActionGroupsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// TenantActionGroupsClientDeleteOptions contains the optional parameters for the TenantActionGroupsClient.Delete method. -type TenantActionGroupsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// TenantActionGroupsClientGetOptions contains the optional parameters for the TenantActionGroupsClient.Get method. -type TenantActionGroupsClientGetOptions struct { - // placeholder for future optional parameters -} - -// TenantActionGroupsClientListByManagementGroupIDOptions contains the optional parameters for the TenantActionGroupsClient.NewListByManagementGroupIDPager -// method. -type TenantActionGroupsClientListByManagementGroupIDOptions struct { - // placeholder for future optional parameters -} - -// TenantActionGroupsClientUpdateOptions contains the optional parameters for the TenantActionGroupsClient.Update method. -type TenantActionGroupsClientUpdateOptions struct { - // placeholder for future optional parameters -} - -// TenantActivityLogsClientListOptions contains the optional parameters for the TenantActivityLogsClient.NewListPager method. -type TenantActivityLogsClientListOptions struct { - // Reduces the set of data collected. - // The $filter is very restricted and allows only the following patterns. - // - List events for a resource group: $filter=eventTimestamp ge '' and eventTimestamp le '' and eventChannels eq 'Admin, - // Operation' and resourceGroupName eq ''. - // - List events for resource: $filter=eventTimestamp ge '' and eventTimestamp le '' and eventChannels eq 'Admin, Operation' - // and resourceUri eq ''. - // - List events for a subscription: $filter=eventTimestamp ge '' and eventTimestamp le '' and eventChannels eq 'Admin, Operation'. - // - List events for a resource provider: $filter=eventTimestamp ge '' and eventTimestamp le '' and eventChannels eq 'Admin, - // Operation' and resourceProvider eq ''. - // - List events for a correlation Id: api-version=2014-04-01&$filter=eventTimestamp ge '2014-07-16T04:36:37.6407898Z' and - // eventTimestamp le '2014-07-20T04:36:37.6407898Z' and eventChannels eq 'Admin, - // Operation' and correlationId eq ''. - // NOTE: No other syntax is allowed. - Filter *string - - // Used to fetch events with only the given properties. - // The $select argument is a comma separated list of property names to be returned. Possible values are: authorization, claims, - // correlationId, description, eventDataId, eventName, eventTimestamp, - // httpRequest, level, operationId, operationName, properties, resourceGroupName, resourceProviderName, resourceId, status, - // submissionTimestamp, subStatus, subscriptionId - Select *string -} - -// VMInsightsClientGetOnboardingStatusOptions contains the optional parameters for the VMInsightsClient.GetOnboardingStatus -// method. -type VMInsightsClientGetOnboardingStatusOptions struct { - // placeholder for future optional parameters -} diff --git a/sdk/resourcemanager/monitor/armmonitor/polymorphic_helpers.go b/sdk/resourcemanager/monitor/armmonitor/polymorphic_helpers.go deleted file mode 100644 index 1f0b3c87ddb2..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/polymorphic_helpers.go +++ /dev/null @@ -1,168 +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 armmonitor - -import "encoding/json" - -func unmarshalMetricAlertCriteriaClassification(rawMsg json.RawMessage) (MetricAlertCriteriaClassification, error) { - if rawMsg == nil { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b MetricAlertCriteriaClassification - switch m["odata.type"] { - case string(OdatatypeMicrosoftAzureMonitorMultipleResourceMultipleMetricCriteria): - b = &MetricAlertMultipleResourceMultipleMetricCriteria{} - case string(OdatatypeMicrosoftAzureMonitorSingleResourceMultipleMetricCriteria): - b = &MetricAlertSingleResourceMultipleMetricCriteria{} - case string(OdatatypeMicrosoftAzureMonitorWebtestLocationAvailabilityCriteria): - b = &WebtestLocationAvailabilityCriteria{} - default: - b = &MetricAlertCriteria{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalMultiMetricCriteriaClassification(rawMsg json.RawMessage) (MultiMetricCriteriaClassification, error) { - if rawMsg == nil { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b MultiMetricCriteriaClassification - switch m["criterionType"] { - case string(CriterionTypeDynamicThresholdCriterion): - b = &DynamicMetricCriteria{} - case string(CriterionTypeStaticThresholdCriterion): - b = &MetricCriteria{} - default: - b = &MultiMetricCriteria{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalMultiMetricCriteriaClassificationArray(rawMsg json.RawMessage) ([]MultiMetricCriteriaClassification, error) { - if rawMsg == nil { - return nil, nil - } - var rawMessages []json.RawMessage - if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { - return nil, err - } - fArray := make([]MultiMetricCriteriaClassification, len(rawMessages)) - for index, rawMessage := range rawMessages { - f, err := unmarshalMultiMetricCriteriaClassification(rawMessage) - if err != nil { - return nil, err - } - fArray[index] = f - } - return fArray, nil -} - -func unmarshalRuleActionClassification(rawMsg json.RawMessage) (RuleActionClassification, error) { - if rawMsg == nil { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b RuleActionClassification - switch m["odata.type"] { - case "Microsoft.Azure.Management.Insights.Models.RuleEmailAction": - b = &RuleEmailAction{} - case "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction": - b = &RuleWebhookAction{} - default: - b = &RuleAction{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalRuleActionClassificationArray(rawMsg json.RawMessage) ([]RuleActionClassification, error) { - if rawMsg == nil { - return nil, nil - } - var rawMessages []json.RawMessage - if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { - return nil, err - } - fArray := make([]RuleActionClassification, len(rawMessages)) - for index, rawMessage := range rawMessages { - f, err := unmarshalRuleActionClassification(rawMessage) - if err != nil { - return nil, err - } - fArray[index] = f - } - return fArray, nil -} - -func unmarshalRuleConditionClassification(rawMsg json.RawMessage) (RuleConditionClassification, error) { - if rawMsg == nil { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b RuleConditionClassification - switch m["odata.type"] { - case "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition": - b = &LocationThresholdRuleCondition{} - case "Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition": - b = &ManagementEventRuleCondition{} - case "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition": - b = &ThresholdRuleCondition{} - default: - b = &RuleCondition{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - -func unmarshalRuleDataSourceClassification(rawMsg json.RawMessage) (RuleDataSourceClassification, error) { - if rawMsg == nil { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b RuleDataSourceClassification - switch m["odata.type"] { - case "Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource": - b = &RuleManagementEventDataSource{} - case "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource": - b = &RuleMetricDataSource{} - default: - b = &RuleDataSource{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client.go b/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client.go deleted file mode 100644 index 698a72d55834..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client.go +++ /dev/null @@ -1,119 +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 armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// PredictiveMetricClient contains the methods for the PredictiveMetric group. -// Don't use this type directly, use NewPredictiveMetricClient() instead. -type PredictiveMetricClient struct { - internal *arm.Client - subscriptionID string -} - -// NewPredictiveMetricClient creates a new instance of PredictiveMetricClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewPredictiveMetricClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PredictiveMetricClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &PredictiveMetricClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - get predictive autoscale metric future data -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2022-10-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - autoscaleSettingName - The autoscale setting name. -// - timespan - The timespan of the query. It is a string with the following format 'startDateTimeISO/endDateTimeISO'. -// - interval - The interval (i.e. timegrain) of the query. -// - metricNamespace - Metric namespace to query metric definitions for. -// - metricName - The names of the metrics (comma separated) to retrieve. Special case: If a metricname itself has a comma in -// it then use %2 to indicate it. Eg: 'Metric,Name1' should be 'Metric%2Name1' -// - aggregation - The list of aggregation types (comma separated) to retrieve. -// - options - PredictiveMetricClientGetOptions contains the optional parameters for the PredictiveMetricClient.Get method. -func (client *PredictiveMetricClient) Get(ctx context.Context, resourceGroupName string, autoscaleSettingName string, timespan string, interval string, metricNamespace string, metricName string, aggregation string, options *PredictiveMetricClientGetOptions) (PredictiveMetricClientGetResponse, error) { - var err error - const operationName = "PredictiveMetricClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, autoscaleSettingName, timespan, interval, metricNamespace, metricName, aggregation, options) - if err != nil { - return PredictiveMetricClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PredictiveMetricClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PredictiveMetricClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *PredictiveMetricClient) getCreateRequest(ctx context.Context, resourceGroupName string, autoscaleSettingName string, timespan string, interval string, metricNamespace string, metricName string, aggregation string, options *PredictiveMetricClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/autoscalesettings/{autoscaleSettingName}/predictiveMetrics" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if autoscaleSettingName == "" { - return nil, errors.New("parameter autoscaleSettingName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{autoscaleSettingName}", url.PathEscape(autoscaleSettingName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("timespan", timespan) - reqQP.Set("interval", interval) - reqQP.Set("metricNamespace", metricNamespace) - reqQP.Set("metricName", metricName) - reqQP.Set("aggregation", aggregation) - reqQP.Set("api-version", "2022-10-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *PredictiveMetricClient) getHandleResponse(resp *http.Response) (PredictiveMetricClientGetResponse, error) { - result := PredictiveMetricClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PredictiveResponse); err != nil { - return PredictiveMetricClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client_example_test.go deleted file mode 100644 index 71d9445a99f2..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/predictivemetric_client_example_test.go +++ /dev/null @@ -1,61 +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 armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/GetPredictiveMetric.json -func ExamplePredictiveMetricClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPredictiveMetricClient().Get(ctx, "myRG", "vmss1-Autoscale-775", "2021-10-14T22:00:00.000Z/2021-10-16T22:00:00.000Z", "PT1H", "Microsoft.Compute/virtualMachineScaleSets", "PercentageCPU", "Total", 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.PredictiveResponse = armmonitor.PredictiveResponse{ - // Data: []*armmonitor.PredictiveValue{ - // { - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-14T22:00:00.000Z"); return t}()), - // Value: to.Ptr[float64](123), - // }, - // { - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-14T22:02:00.000Z"); return t}()), - // Value: to.Ptr[float64](120), - // }, - // { - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-14T22:02:00.000Z"); return t}()), - // Value: to.Ptr[float64](88), - // }, - // { - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-10-14T22:03:00.000Z"); return t}()), - // Value: to.Ptr[float64](100), - // }}, - // Interval: to.Ptr("PT1H"), - // MetricName: to.Ptr("PercentageCPU"), - // TargetResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.Compute/virtualMachineScaleSets/vmss1"), - // Timespan: to.Ptr("2021-10-14T22:00:00.000Z/2021-10-16T22:00:00.000Z"), - // } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client_example_test.go deleted file mode 100644 index beac5fb035f5..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client_example_test.go +++ /dev/null @@ -1,178 +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 armmonitor_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/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateEndpointConnectionGet.json -func ExamplePrivateEndpointConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "MyResourceGroup", "MyPrivateLinkScope", "private-endpoint-connection-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateEndpointConnection = armmonitor.PrivateEndpointConnection{ - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/privateEndpointConnections/private-endpoint-connection-name"), - // Properties: &armmonitor.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmonitor.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armmonitor.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armmonitor.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armmonitor.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateEndpointConnectionUpdate.json -func ExamplePrivateEndpointConnectionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginCreateOrUpdate(ctx, "MyResourceGroup", "MyPrivateLinkScope", "private-endpoint-connection-name", armmonitor.PrivateEndpointConnection{ - Properties: &armmonitor.PrivateEndpointConnectionProperties{ - PrivateLinkServiceConnectionState: &armmonitor.PrivateLinkServiceConnectionState{ - Description: to.Ptr("Approved by johndoe@contoso.com"), - Status: to.Ptr(armmonitor.PrivateEndpointServiceConnectionStatusApproved), - }, - }, - }, 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.PrivateEndpointConnection = armmonitor.PrivateEndpointConnection{ - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/privateEndpointConnections/private-endpoint-connection-name"), - // Properties: &armmonitor.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmonitor.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armmonitor.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Approved by johndoe@contoso.com"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armmonitor.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armmonitor.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateEndpointConnectionDelete.json -func ExamplePrivateEndpointConnectionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "MyResourceGroup", "MyPrivateLinkScope", "private-endpoint-connection-name", 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/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateEndpointConnectionList.json -func ExamplePrivateEndpointConnectionsClient_ListByPrivateLinkScope() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateEndpointConnectionsClient().ListByPrivateLinkScope(ctx, "MyResourceGroup", "MyPrivateLinkScope", 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.PrivateEndpointConnectionListResult = armmonitor.PrivateEndpointConnectionListResult{ - // Value: []*armmonitor.PrivateEndpointConnection{ - // { - // Name: to.Ptr("private-endpoint-connection-name"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/privateEndpointConnections/private-endpoint-connection-name-2"), - // Properties: &armmonitor.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmonitor.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name"), - // }, - // PrivateLinkServiceConnectionState: &armmonitor.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Auto-approved"), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armmonitor.PrivateEndpointServiceConnectionStatusApproved), - // }, - // ProvisioningState: to.Ptr(armmonitor.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("private-endpoint-connection-name-2"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/privateEndpointConnections"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/privateEndpointConnections/private-endpoint-connection-name-2"), - // Properties: &armmonitor.PrivateEndpointConnectionProperties{ - // PrivateEndpoint: &armmonitor.PrivateEndpoint{ - // ID: to.Ptr("/subscriptions/55555555-6666-7777-8888-999999999999/resourceGroups/Default-Network/providers/Microsoft.Network/privateEndpoints/private-endpoint-name-2"), - // }, - // PrivateLinkServiceConnectionState: &armmonitor.PrivateLinkServiceConnectionState{ - // Description: to.Ptr("Please approve my connection."), - // ActionsRequired: to.Ptr("None"), - // Status: to.Ptr(armmonitor.PrivateEndpointServiceConnectionStatusPending), - // }, - // ProvisioningState: to.Ptr(armmonitor.PrivateEndpointConnectionProvisioningStateSucceeded), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client_example_test.go deleted file mode 100644 index 3d2730ab12e0..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client_example_test.go +++ /dev/null @@ -1,105 +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 armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopePrivateLinkResourceListGet.json -func ExamplePrivateLinkResourcesClient_ListByPrivateLinkScope() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkResourcesClient().ListByPrivateLinkScope(ctx, "MyResourceGroup", "MyPrivateLinkScope", 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.PrivateLinkResourceListResult = armmonitor.PrivateLinkResourceListResult{ - // Value: []*armmonitor.PrivateLinkResource{ - // { - // Name: to.Ptr("azuremonitor"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/privateLinkResources"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/privateLinkResources/azuremonitor"), - // Properties: &armmonitor.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("azuremonitor"), - // RequiredMembers: []*string{ - // to.Ptr("api"), - // to.Ptr("global.in.ai"), - // to.Ptr("profiler"), - // to.Ptr("live"), - // to.Ptr("snapshot"), - // to.Ptr("agentsolutionpackstore"), - // to.Ptr("dce-global")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.monitor.azure.com"), - // to.Ptr("privatelink.oms.opinsights.azure.com"), - // to.Ptr("privatelink.ods.opinsights.azure.com"), - // to.Ptr("privatelink.agentsvc.azure-automation.net"), - // to.Ptr("privatelink.blob.core.windows.net")}, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopePrivateLinkResourceGet.json -func ExamplePrivateLinkResourcesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkResourcesClient().Get(ctx, "MyResourceGroup", "MyPrivateLinkScope", "azuremonitor", 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.PrivateLinkResource = armmonitor.PrivateLinkResource{ - // Name: to.Ptr("azuremonitor"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/privateLinkResources"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/privateLinkResources/azuremonitor"), - // Properties: &armmonitor.PrivateLinkResourceProperties{ - // GroupID: to.Ptr("azuremonitor"), - // RequiredMembers: []*string{ - // to.Ptr("api"), - // to.Ptr("global.in.ai"), - // to.Ptr("profiler"), - // to.Ptr("live"), - // to.Ptr("snapshot"), - // to.Ptr("agentsolutionpackstore"), - // to.Ptr("dce-global")}, - // RequiredZoneNames: []*string{ - // to.Ptr("privatelink.monitor.azure.com"), - // to.Ptr("privatelink.oms.opinsights.azure.com"), - // to.Ptr("privatelink.ods.opinsights.azure.com"), - // to.Ptr("privatelink.agentsvc.azure-automation.net"), - // to.Ptr("privatelink.blob.core.windows.net")}, - // }, - // } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client.go deleted file mode 100644 index b95b70511c0b..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client.go +++ /dev/null @@ -1,344 +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 armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// PrivateLinkScopedResourcesClient contains the methods for the PrivateLinkScopedResources group. -// Don't use this type directly, use NewPrivateLinkScopedResourcesClient() instead. -type PrivateLinkScopedResourcesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewPrivateLinkScopedResourcesClient creates a new instance of PrivateLinkScopedResourcesClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewPrivateLinkScopedResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkScopedResourcesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &PrivateLinkScopedResourcesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginCreateOrUpdate - Approve or reject a private endpoint connection with a given name. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// - name - The name of the scoped resource object. -// - options - PrivateLinkScopedResourcesClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateLinkScopedResourcesClient.BeginCreateOrUpdate -// method. -func (client *PrivateLinkScopedResourcesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, name string, parameters ScopedResource, options *PrivateLinkScopedResourcesClientBeginCreateOrUpdateOptions) (*runtime.Poller[PrivateLinkScopedResourcesClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, scopeName, name, parameters, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateLinkScopedResourcesClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateLinkScopedResourcesClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// CreateOrUpdate - Approve or reject a private endpoint connection with a given name. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -func (client *PrivateLinkScopedResourcesClient) createOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, name string, parameters ScopedResource, options *PrivateLinkScopedResourcesClientBeginCreateOrUpdateOptions) (*http.Response, error) { - var err error - const operationName = "PrivateLinkScopedResourcesClient.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, scopeName, name, parameters, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *PrivateLinkScopedResourcesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, name string, parameters ScopedResource, options *PrivateLinkScopedResourcesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if scopeName == "" { - return nil, errors.New("parameter scopeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - if name == "" { - return nil, errors.New("parameter name cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } - return req, nil -} - -// BeginDelete - Deletes a private endpoint connection with a given name. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// - name - The name of the scoped resource object. -// - options - PrivateLinkScopedResourcesClientBeginDeleteOptions contains the optional parameters for the PrivateLinkScopedResourcesClient.BeginDelete -// method. -func (client *PrivateLinkScopedResourcesClient) BeginDelete(ctx context.Context, resourceGroupName string, scopeName string, name string, options *PrivateLinkScopedResourcesClientBeginDeleteOptions) (*runtime.Poller[PrivateLinkScopedResourcesClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, scopeName, name, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateLinkScopedResourcesClientDeleteResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateLinkScopedResourcesClientDeleteResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Delete - Deletes a private endpoint connection with a given name. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -func (client *PrivateLinkScopedResourcesClient) deleteOperation(ctx context.Context, resourceGroupName string, scopeName string, name string, options *PrivateLinkScopedResourcesClientBeginDeleteOptions) (*http.Response, error) { - var err error - const operationName = "PrivateLinkScopedResourcesClient.BeginDelete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, scopeName, name, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *PrivateLinkScopedResourcesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, name string, options *PrivateLinkScopedResourcesClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if scopeName == "" { - return nil, errors.New("parameter scopeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - if name == "" { - return nil, errors.New("parameter name cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets a scoped resource in a private link scope. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// - name - The name of the scoped resource object. -// - options - PrivateLinkScopedResourcesClientGetOptions contains the optional parameters for the PrivateLinkScopedResourcesClient.Get -// method. -func (client *PrivateLinkScopedResourcesClient) Get(ctx context.Context, resourceGroupName string, scopeName string, name string, options *PrivateLinkScopedResourcesClientGetOptions) (PrivateLinkScopedResourcesClientGetResponse, error) { - var err error - const operationName = "PrivateLinkScopedResourcesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, scopeName, name, options) - if err != nil { - return PrivateLinkScopedResourcesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateLinkScopedResourcesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PrivateLinkScopedResourcesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *PrivateLinkScopedResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, name string, options *PrivateLinkScopedResourcesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources/{name}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if scopeName == "" { - return nil, errors.New("parameter scopeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - if name == "" { - return nil, errors.New("parameter name cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{name}", url.PathEscape(name)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *PrivateLinkScopedResourcesClient) getHandleResponse(resp *http.Response) (PrivateLinkScopedResourcesClientGetResponse, error) { - result := PrivateLinkScopedResourcesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ScopedResource); err != nil { - return PrivateLinkScopedResourcesClientGetResponse{}, err - } - return result, nil -} - -// NewListByPrivateLinkScopePager - Gets all private endpoint connections on a private link scope. -// -// Generated from API version 2021-07-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// - options - PrivateLinkScopedResourcesClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateLinkScopedResourcesClient.NewListByPrivateLinkScopePager -// method. -func (client *PrivateLinkScopedResourcesClient) NewListByPrivateLinkScopePager(resourceGroupName string, scopeName string, options *PrivateLinkScopedResourcesClientListByPrivateLinkScopeOptions) *runtime.Pager[PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse] { - return runtime.NewPager(runtime.PagingHandler[PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse]{ - More: func(page PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse) (PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateLinkScopedResourcesClient.NewListByPrivateLinkScopePager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listByPrivateLinkScopeCreateRequest(ctx, resourceGroupName, scopeName, options) - }, nil) - if err != nil { - return PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse{}, err - } - return client.listByPrivateLinkScopeHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByPrivateLinkScopeCreateRequest creates the ListByPrivateLinkScope request. -func (client *PrivateLinkScopedResourcesClient) listByPrivateLinkScopeCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateLinkScopedResourcesClientListByPrivateLinkScopeOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/scopedResources" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if scopeName == "" { - return nil, errors.New("parameter scopeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByPrivateLinkScopeHandleResponse handles the ListByPrivateLinkScope response. -func (client *PrivateLinkScopedResourcesClient) listByPrivateLinkScopeHandleResponse(resp *http.Response) (PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse, error) { - result := PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ScopedResourceListResult); err != nil { - return PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client_example_test.go deleted file mode 100644 index 00798ed9e730..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopedresources_client_example_test.go +++ /dev/null @@ -1,184 +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 armmonitor_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/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopedResourceGet.json -func ExamplePrivateLinkScopedResourcesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkScopedResourcesClient().Get(ctx, "MyResourceGroup", "MyPrivateLinkScope", "scoped-resource-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ScopedResource = armmonitor.ScopedResource{ - // Name: to.Ptr("scoped-resource-name"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/scopedResources"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/scopedResources/scoped-resource-name"), - // Properties: &armmonitor.ScopedResourceProperties{ - // LinkedResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/components/my-component"), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopedResourceUpdate.json -func ExamplePrivateLinkScopedResourcesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateLinkScopedResourcesClient().BeginCreateOrUpdate(ctx, "MyResourceGroup", "MyPrivateLinkScope", "scoped-resource-name", armmonitor.ScopedResource{ - Properties: &armmonitor.ScopedResourceProperties{ - LinkedResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/components/my-component"), - }, - }, 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.ScopedResource = armmonitor.ScopedResource{ - // Name: to.Ptr("scoped-resource-name"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/scopedResources"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/scopedResources/scoped-resource-name"), - // Properties: &armmonitor.ScopedResourceProperties{ - // LinkedResourceID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/components/my-component"), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopedResourceDelete.json -func ExamplePrivateLinkScopedResourcesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateLinkScopedResourcesClient().BeginDelete(ctx, "MyResourceGroup", "MyPrivateLinkScope", "scoped-resource-name", 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/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopedResourceList.json -func ExamplePrivateLinkScopedResourcesClient_NewListByPrivateLinkScopePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateLinkScopedResourcesClient().NewListByPrivateLinkScopePager("MyResourceGroup", "MyPrivateLinkScope", 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.ScopedResourceListResult = armmonitor.ScopedResourceListResult{ - // Value: []*armmonitor.ScopedResource{ - // { - // Name: to.Ptr("scoped-resource-name"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/scopedResources"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/scopedResources/scoped-resource-name"), - // Properties: &armmonitor.ScopedResourceProperties{ - // LinkedResourceID: to.Ptr("/subscriptions/00000000-0000-2222-3333-444444444444/resourceGroups/MyComponentResourceGroup/providers/Microsoft.Insights/components/my-component"), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("other-scoped-resource-name"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes/scopedResources"), - // ID: to.Ptr("/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopes/MyPrivateLinkScope/scopedResources/other-scoped-resource-name"), - // Properties: &armmonitor.ScopedResourceProperties{ - // LinkedResourceID: to.Ptr("/subscriptions/00000000-3333-2222-5555-444444444444/resourceGroups/MyWorkspaceResourceGroup/providers/Microsoft.OperationalInsights/workspaces/my-workspace"), - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client.go deleted file mode 100644 index 9f73ea7a6bca..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client.go +++ /dev/null @@ -1,109 +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 armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// PrivateLinkScopeOperationStatusClient contains the methods for the PrivateLinkScopeOperationStatus group. -// Don't use this type directly, use NewPrivateLinkScopeOperationStatusClient() instead. -type PrivateLinkScopeOperationStatusClient struct { - internal *arm.Client - subscriptionID string -} - -// NewPrivateLinkScopeOperationStatusClient creates a new instance of PrivateLinkScopeOperationStatusClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewPrivateLinkScopeOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkScopeOperationStatusClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &PrivateLinkScopeOperationStatusClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Get the status of an azure asynchronous operation associated with a private link scope operation. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -// - asyncOperationID - The operation Id. -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - options - PrivateLinkScopeOperationStatusClientGetOptions contains the optional parameters for the PrivateLinkScopeOperationStatusClient.Get -// method. -func (client *PrivateLinkScopeOperationStatusClient) Get(ctx context.Context, asyncOperationID string, resourceGroupName string, options *PrivateLinkScopeOperationStatusClientGetOptions) (PrivateLinkScopeOperationStatusClientGetResponse, error) { - var err error - const operationName = "PrivateLinkScopeOperationStatusClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, asyncOperationID, resourceGroupName, options) - if err != nil { - return PrivateLinkScopeOperationStatusClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateLinkScopeOperationStatusClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PrivateLinkScopeOperationStatusClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *PrivateLinkScopeOperationStatusClient) getCreateRequest(ctx context.Context, asyncOperationID string, resourceGroupName string, options *PrivateLinkScopeOperationStatusClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopeOperationStatuses/{asyncOperationId}" - if asyncOperationID == "" { - return nil, errors.New("parameter asyncOperationID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{asyncOperationId}", url.PathEscape(asyncOperationID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *PrivateLinkScopeOperationStatusClient) getHandleResponse(resp *http.Response) (PrivateLinkScopeOperationStatusClientGetResponse, error) { - result := PrivateLinkScopeOperationStatusClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return PrivateLinkScopeOperationStatusClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client_example_test.go deleted file mode 100644 index d8612988e855..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopeoperationstatus_client_example_test.go +++ /dev/null @@ -1,45 +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 armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/privateLinkScopeOperationStatuses.json -func ExamplePrivateLinkScopeOperationStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkScopeOperationStatusClient().Get(ctx, "713192d7-503f-477a-9cfe-4efc3ee2bd11", "MyResourceGroup", 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.OperationStatus = armmonitor.OperationStatus{ - // Name: to.Ptr("713192d7-503f-477a-9cfe-4efc3ee2bd11"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-01-01T16:13:13.933Z"); return t}()), - // ID: to.Ptr("/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/privateLinkScopeOperationStatuses/713192d7-503f-477a-9cfe-4efc3ee2bd11"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2017-01-01T13:13:13.933Z"); return t}()), - // Status: to.Ptr("Succeeded"), - // } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client.go deleted file mode 100644 index 228ac97d775c..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client.go +++ /dev/null @@ -1,438 +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 armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// PrivateLinkScopesClient contains the methods for the PrivateLinkScopes group. -// Don't use this type directly, use NewPrivateLinkScopesClient() instead. -type PrivateLinkScopesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewPrivateLinkScopesClient creates a new instance of PrivateLinkScopesClient with the specified values. -// - subscriptionID - The ID of the target subscription. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewPrivateLinkScopesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkScopesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &PrivateLinkScopesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot specify a different value for -// InstrumentationKey nor AppId in the Put operation. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// - azureMonitorPrivateLinkScopePayload - Properties that need to be specified to create or update a Azure Monitor PrivateLinkScope. -// - options - PrivateLinkScopesClientCreateOrUpdateOptions contains the optional parameters for the PrivateLinkScopesClient.CreateOrUpdate -// method. -func (client *PrivateLinkScopesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, azureMonitorPrivateLinkScopePayload AzureMonitorPrivateLinkScope, options *PrivateLinkScopesClientCreateOrUpdateOptions) (PrivateLinkScopesClientCreateOrUpdateResponse, error) { - var err error - const operationName = "PrivateLinkScopesClient.CreateOrUpdate" - 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, scopeName, azureMonitorPrivateLinkScopePayload, options) - if err != nil { - return PrivateLinkScopesClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateLinkScopesClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return PrivateLinkScopesClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *PrivateLinkScopesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, azureMonitorPrivateLinkScopePayload AzureMonitorPrivateLinkScope, options *PrivateLinkScopesClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if scopeName == "" { - return nil, errors.New("parameter scopeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, azureMonitorPrivateLinkScopePayload); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *PrivateLinkScopesClient) createOrUpdateHandleResponse(resp *http.Response) (PrivateLinkScopesClientCreateOrUpdateResponse, error) { - result := PrivateLinkScopesClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureMonitorPrivateLinkScope); err != nil { - return PrivateLinkScopesClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// BeginDelete - Deletes a Azure Monitor PrivateLinkScope. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// - options - PrivateLinkScopesClientBeginDeleteOptions contains the optional parameters for the PrivateLinkScopesClient.BeginDelete -// method. -func (client *PrivateLinkScopesClient) BeginDelete(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateLinkScopesClientBeginDeleteOptions) (*runtime.Poller[PrivateLinkScopesClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, scopeName, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateLinkScopesClientDeleteResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateLinkScopesClientDeleteResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Delete - Deletes a Azure Monitor PrivateLinkScope. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -func (client *PrivateLinkScopesClient) deleteOperation(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateLinkScopesClientBeginDeleteOptions) (*http.Response, error) { - var err error - const operationName = "PrivateLinkScopesClient.BeginDelete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, scopeName, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *PrivateLinkScopesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateLinkScopesClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if scopeName == "" { - return nil, errors.New("parameter scopeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Returns a Azure Monitor PrivateLinkScope. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// - options - PrivateLinkScopesClientGetOptions contains the optional parameters for the PrivateLinkScopesClient.Get method. -func (client *PrivateLinkScopesClient) Get(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateLinkScopesClientGetOptions) (PrivateLinkScopesClientGetResponse, error) { - var err error - const operationName = "PrivateLinkScopesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, scopeName, options) - if err != nil { - return PrivateLinkScopesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateLinkScopesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PrivateLinkScopesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *PrivateLinkScopesClient) getCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateLinkScopesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if scopeName == "" { - return nil, errors.New("parameter scopeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *PrivateLinkScopesClient) getHandleResponse(resp *http.Response) (PrivateLinkScopesClientGetResponse, error) { - result := PrivateLinkScopesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureMonitorPrivateLinkScope); err != nil { - return PrivateLinkScopesClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. -// -// Generated from API version 2021-07-01-preview -// - options - PrivateLinkScopesClientListOptions contains the optional parameters for the PrivateLinkScopesClient.NewListPager -// method. -func (client *PrivateLinkScopesClient) NewListPager(options *PrivateLinkScopesClientListOptions) *runtime.Pager[PrivateLinkScopesClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[PrivateLinkScopesClientListResponse]{ - More: func(page PrivateLinkScopesClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *PrivateLinkScopesClientListResponse) (PrivateLinkScopesClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateLinkScopesClient.NewListPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, options) - }, nil) - if err != nil { - return PrivateLinkScopesClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *PrivateLinkScopesClient) listCreateRequest(ctx context.Context, options *PrivateLinkScopesClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/microsoft.insights/privateLinkScopes" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *PrivateLinkScopesClient) listHandleResponse(resp *http.Response) (PrivateLinkScopesClientListResponse, error) { - result := PrivateLinkScopesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureMonitorPrivateLinkScopeListResult); err != nil { - return PrivateLinkScopesClientListResponse{}, err - } - return result, nil -} - -// NewListByResourceGroupPager - Gets a list of Azure Monitor PrivateLinkScopes within a resource group. -// -// Generated from API version 2021-07-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - options - PrivateLinkScopesClientListByResourceGroupOptions contains the optional parameters for the PrivateLinkScopesClient.NewListByResourceGroupPager -// method. -func (client *PrivateLinkScopesClient) NewListByResourceGroupPager(resourceGroupName string, options *PrivateLinkScopesClientListByResourceGroupOptions) *runtime.Pager[PrivateLinkScopesClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[PrivateLinkScopesClientListByResourceGroupResponse]{ - More: func(page PrivateLinkScopesClientListByResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *PrivateLinkScopesClientListByResourceGroupResponse) (PrivateLinkScopesClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateLinkScopesClient.NewListByResourceGroupPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - }, nil) - if err != nil { - return PrivateLinkScopesClientListByResourceGroupResponse{}, err - } - return client.listByResourceGroupHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *PrivateLinkScopesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *PrivateLinkScopesClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *PrivateLinkScopesClient) listByResourceGroupHandleResponse(resp *http.Response) (PrivateLinkScopesClientListByResourceGroupResponse, error) { - result := PrivateLinkScopesClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureMonitorPrivateLinkScopeListResult); err != nil { - return PrivateLinkScopesClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// UpdateTags - Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate method. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// - privateLinkScopeTags - Updated tag information to set into the PrivateLinkScope instance. -// - options - PrivateLinkScopesClientUpdateTagsOptions contains the optional parameters for the PrivateLinkScopesClient.UpdateTags -// method. -func (client *PrivateLinkScopesClient) UpdateTags(ctx context.Context, resourceGroupName string, scopeName string, privateLinkScopeTags TagsResource, options *PrivateLinkScopesClientUpdateTagsOptions) (PrivateLinkScopesClientUpdateTagsResponse, error) { - var err error - const operationName = "PrivateLinkScopesClient.UpdateTags" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateTagsCreateRequest(ctx, resourceGroupName, scopeName, privateLinkScopeTags, options) - if err != nil { - return PrivateLinkScopesClientUpdateTagsResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateLinkScopesClientUpdateTagsResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PrivateLinkScopesClientUpdateTagsResponse{}, err - } - resp, err := client.updateTagsHandleResponse(httpResp) - return resp, err -} - -// updateTagsCreateRequest creates the UpdateTags request. -func (client *PrivateLinkScopesClient) updateTagsCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, privateLinkScopeTags TagsResource, options *PrivateLinkScopesClientUpdateTagsOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights/privateLinkScopes/{scopeName}" - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if scopeName == "" { - return nil, errors.New("parameter scopeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, privateLinkScopeTags); err != nil { - return nil, err - } - return req, nil -} - -// updateTagsHandleResponse handles the UpdateTags response. -func (client *PrivateLinkScopesClient) updateTagsHandleResponse(resp *http.Response) (PrivateLinkScopesClientUpdateTagsResponse, error) { - result := PrivateLinkScopesClientUpdateTagsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureMonitorPrivateLinkScope); err != nil { - return PrivateLinkScopesClientUpdateTagsResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client_example_test.go deleted file mode 100644 index d45d301cfd2a..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkscopes_client_example_test.go +++ /dev/null @@ -1,405 +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 armmonitor_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/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesList.json -func ExamplePrivateLinkScopesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateLinkScopesClient().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.AzureMonitorPrivateLinkScopeListResult = armmonitor.AzureMonitorPrivateLinkScopeListResult{ - // Value: []*armmonitor.AzureMonitorPrivateLinkScope{ - // { - // Name: to.Ptr("my-privatelinkscope"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.insights/privateLinkScopes/my-privatelinkscope"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - // AccessModeSettings: &armmonitor.AccessModeSettings{ - // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ - // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("my-other-privatelinkscope"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-other-resource-group/providers/microsoft.insights/privateLinkScopes/my-other-privatelinkscope"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - // AccessModeSettings: &armmonitor.AccessModeSettings{ - // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ - // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesListByResourceGroup.json -func ExamplePrivateLinkScopesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPrivateLinkScopesClient().NewListByResourceGroupPager("my-resource-group", 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.AzureMonitorPrivateLinkScopeListResult = armmonitor.AzureMonitorPrivateLinkScopeListResult{ - // Value: []*armmonitor.AzureMonitorPrivateLinkScope{ - // { - // Name: to.Ptr("my-privatelinkscope"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.insights/privateLinkScopes/my-privatelinkscope"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - // AccessModeSettings: &armmonitor.AccessModeSettings{ - // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ - // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("my-other-privatelinkscope"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.insights/privateLinkScopes/my-other-privatelinkscope"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - // AccessModeSettings: &armmonitor.AccessModeSettings{ - // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ - // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesDelete.json -func ExamplePrivateLinkScopesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPrivateLinkScopesClient().BeginDelete(ctx, "my-resource-group", "my-privatelinkscope", 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/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesGet.json -func ExamplePrivateLinkScopesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkScopesClient().Get(ctx, "my-resource-group", "my-privatelinkscope", 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.AzureMonitorPrivateLinkScope = armmonitor.AzureMonitorPrivateLinkScope{ - // Name: to.Ptr("my-privatelinkscope"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.insights/privateLinkScopes/my-privatelinkscope"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - // AccessModeSettings: &armmonitor.AccessModeSettings{ - // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ - // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesCreate.json -func ExamplePrivateLinkScopesClient_CreateOrUpdate_privateLinkScopeCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkScopesClient().CreateOrUpdate(ctx, "my-resource-group", "my-privatelinkscope", armmonitor.AzureMonitorPrivateLinkScope{ - Location: to.Ptr("Global"), - Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - AccessModeSettings: &armmonitor.AccessModeSettings{ - Exclusions: []*armmonitor.AccessModeSettingsExclusion{}, - IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - }, - }, - }, 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.AzureMonitorPrivateLinkScope = armmonitor.AzureMonitorPrivateLinkScope{ - // Name: to.Ptr("my-privatelinkscope"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.insights/privateLinkScopes/my-privatelinkscope"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - // AccessModeSettings: &armmonitor.AccessModeSettings{ - // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ - // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesUpdate.json -func ExamplePrivateLinkScopesClient_CreateOrUpdate_privateLinkScopeUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkScopesClient().CreateOrUpdate(ctx, "my-resource-group", "my-privatelinkscope", armmonitor.AzureMonitorPrivateLinkScope{ - Location: to.Ptr("Global"), - Tags: map[string]*string{ - "Tag1": to.Ptr("Value1"), - }, - Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - AccessModeSettings: &armmonitor.AccessModeSettings{ - Exclusions: []*armmonitor.AccessModeSettingsExclusion{}, - IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - }, - }, - }, 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.AzureMonitorPrivateLinkScope = armmonitor.AzureMonitorPrivateLinkScope{ - // Name: to.Ptr("my-privatelinkscope"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4919/resourceGroups/my-resource-group/providers/microsoft.insights/privateLinkScopes/my-privatelinkscope"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // "Tag1": to.Ptr("Value1"), - // }, - // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - // AccessModeSettings: &armmonitor.AccessModeSettings{ - // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ - // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesUpdateTagsOnly.json -func ExamplePrivateLinkScopesClient_UpdateTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPrivateLinkScopesClient().UpdateTags(ctx, "my-resource-group", "my-privatelinkscope", armmonitor.TagsResource{ - Tags: map[string]*string{ - "Tag1": to.Ptr("Value1"), - "Tag2": to.Ptr("Value2"), - }, - }, 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.AzureMonitorPrivateLinkScope = armmonitor.AzureMonitorPrivateLinkScope{ - // Name: to.Ptr("my-privatelinkscope"), - // Type: to.Ptr("Microsoft.Insights/privateLinkScopes"), - // ID: to.Ptr("/subscriptions/subid/resourceGroups/my-resource-group/providers/microsoft.insights/privateLinkScopes/my-privatelinkscope"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // "Tag1": to.Ptr("Value1"), - // "Tag2": to.Ptr("Value2"), - // }, - // Properties: &armmonitor.AzureMonitorPrivateLinkScopeProperties{ - // AccessModeSettings: &armmonitor.AccessModeSettings{ - // Exclusions: []*armmonitor.AccessModeSettingsExclusion{ - // }, - // IngestionAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // QueryAccessMode: to.Ptr(armmonitor.AccessModeOpen), - // }, - // ProvisioningState: to.Ptr("Succeeded"), - // }, - // SystemData: &armmonitor.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // CreatedBy: to.Ptr("bobby@contoso.com"), - // CreatedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-06-16T12:59:57.051Z"); return t}()), - // LastModifiedBy: to.Ptr("bobby@contoso.com"), - // LastModifiedByType: to.Ptr(armmonitor.CreatedByTypeUser), - // }, - // } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/response_types.go b/sdk/resourcemanager/monitor/armmonitor/response_types.go deleted file mode 100644 index 812a8e44cf92..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/response_types.go +++ /dev/null @@ -1,678 +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 armmonitor - -// ActionGroupsClientCreateNotificationsAtActionGroupResourceLevelResponse contains the response from method ActionGroupsClient.BeginCreateNotificationsAtActionGroupResourceLevel. -type ActionGroupsClientCreateNotificationsAtActionGroupResourceLevelResponse struct { - // The details of the test notification results. - TestNotificationDetailsResponse -} - -// ActionGroupsClientCreateOrUpdateResponse contains the response from method ActionGroupsClient.CreateOrUpdate. -type ActionGroupsClientCreateOrUpdateResponse struct { - // An action group resource. - ActionGroupResource -} - -// ActionGroupsClientDeleteResponse contains the response from method ActionGroupsClient.Delete. -type ActionGroupsClientDeleteResponse struct { - // placeholder for future response values -} - -// ActionGroupsClientEnableReceiverResponse contains the response from method ActionGroupsClient.EnableReceiver. -type ActionGroupsClientEnableReceiverResponse struct { - // placeholder for future response values -} - -// ActionGroupsClientGetResponse contains the response from method ActionGroupsClient.Get. -type ActionGroupsClientGetResponse struct { - // An action group resource. - ActionGroupResource -} - -// ActionGroupsClientGetTestNotificationsAtActionGroupResourceLevelResponse contains the response from method ActionGroupsClient.GetTestNotificationsAtActionGroupResourceLevel. -type ActionGroupsClientGetTestNotificationsAtActionGroupResourceLevelResponse struct { - // The details of the test notification results. - TestNotificationDetailsResponse -} - -// ActionGroupsClientListByResourceGroupResponse contains the response from method ActionGroupsClient.NewListByResourceGroupPager. -type ActionGroupsClientListByResourceGroupResponse struct { - // A list of action groups. - ActionGroupList -} - -// ActionGroupsClientListBySubscriptionIDResponse contains the response from method ActionGroupsClient.NewListBySubscriptionIDPager. -type ActionGroupsClientListBySubscriptionIDResponse struct { - // A list of action groups. - ActionGroupList -} - -// ActionGroupsClientUpdateResponse contains the response from method ActionGroupsClient.Update. -type ActionGroupsClientUpdateResponse struct { - // An action group resource. - ActionGroupResource -} - -// ActivityLogAlertsClientCreateOrUpdateResponse contains the response from method ActivityLogAlertsClient.CreateOrUpdate. -type ActivityLogAlertsClientCreateOrUpdateResponse struct { - // An Activity Log Alert rule resource. - ActivityLogAlertResource -} - -// ActivityLogAlertsClientDeleteResponse contains the response from method ActivityLogAlertsClient.Delete. -type ActivityLogAlertsClientDeleteResponse struct { - // placeholder for future response values -} - -// ActivityLogAlertsClientGetResponse contains the response from method ActivityLogAlertsClient.Get. -type ActivityLogAlertsClientGetResponse struct { - // An Activity Log Alert rule resource. - ActivityLogAlertResource -} - -// ActivityLogAlertsClientListByResourceGroupResponse contains the response from method ActivityLogAlertsClient.NewListByResourceGroupPager. -type ActivityLogAlertsClientListByResourceGroupResponse struct { - // A list of Activity Log Alert rules. - AlertRuleList -} - -// ActivityLogAlertsClientListBySubscriptionIDResponse contains the response from method ActivityLogAlertsClient.NewListBySubscriptionIDPager. -type ActivityLogAlertsClientListBySubscriptionIDResponse struct { - // A list of Activity Log Alert rules. - AlertRuleList -} - -// ActivityLogAlertsClientUpdateResponse contains the response from method ActivityLogAlertsClient.Update. -type ActivityLogAlertsClientUpdateResponse struct { - // An Activity Log Alert rule resource. - ActivityLogAlertResource -} - -// ActivityLogsClientListResponse contains the response from method ActivityLogsClient.NewListPager. -type ActivityLogsClientListResponse struct { - // Represents collection of events. - EventDataCollection -} - -// AlertRuleIncidentsClientGetResponse contains the response from method AlertRuleIncidentsClient.Get. -type AlertRuleIncidentsClientGetResponse struct { - // An alert incident indicates the activation status of an alert rule. - Incident -} - -// AlertRuleIncidentsClientListByAlertRuleResponse contains the response from method AlertRuleIncidentsClient.NewListByAlertRulePager. -type AlertRuleIncidentsClientListByAlertRuleResponse struct { - // The List incidents operation response. - IncidentListResult -} - -// AlertRulesClientCreateOrUpdateResponse contains the response from method AlertRulesClient.CreateOrUpdate. -type AlertRulesClientCreateOrUpdateResponse struct { - // The alert rule resource. - AlertRuleResource -} - -// AlertRulesClientDeleteResponse contains the response from method AlertRulesClient.Delete. -type AlertRulesClientDeleteResponse struct { - // placeholder for future response values -} - -// AlertRulesClientGetResponse contains the response from method AlertRulesClient.Get. -type AlertRulesClientGetResponse struct { - // The alert rule resource. - AlertRuleResource -} - -// AlertRulesClientListByResourceGroupResponse contains the response from method AlertRulesClient.NewListByResourceGroupPager. -type AlertRulesClientListByResourceGroupResponse struct { - // Represents a collection of alert rule resources. - AlertRuleResourceCollection -} - -// AlertRulesClientListBySubscriptionResponse contains the response from method AlertRulesClient.NewListBySubscriptionPager. -type AlertRulesClientListBySubscriptionResponse struct { - // Represents a collection of alert rule resources. - AlertRuleResourceCollection -} - -// AlertRulesClientUpdateResponse contains the response from method AlertRulesClient.Update. -type AlertRulesClientUpdateResponse struct { - // The alert rule resource. - AlertRuleResource -} - -// AutoscaleSettingsClientCreateOrUpdateResponse contains the response from method AutoscaleSettingsClient.CreateOrUpdate. -type AutoscaleSettingsClientCreateOrUpdateResponse struct { - // The autoscale setting resource. - AutoscaleSettingResource -} - -// AutoscaleSettingsClientDeleteResponse contains the response from method AutoscaleSettingsClient.Delete. -type AutoscaleSettingsClientDeleteResponse struct { - // placeholder for future response values -} - -// AutoscaleSettingsClientGetResponse contains the response from method AutoscaleSettingsClient.Get. -type AutoscaleSettingsClientGetResponse struct { - // The autoscale setting resource. - AutoscaleSettingResource -} - -// AutoscaleSettingsClientListByResourceGroupResponse contains the response from method AutoscaleSettingsClient.NewListByResourceGroupPager. -type AutoscaleSettingsClientListByResourceGroupResponse struct { - // Represents a collection of autoscale setting resources. - AutoscaleSettingResourceCollection -} - -// AutoscaleSettingsClientListBySubscriptionResponse contains the response from method AutoscaleSettingsClient.NewListBySubscriptionPager. -type AutoscaleSettingsClientListBySubscriptionResponse struct { - // Represents a collection of autoscale setting resources. - AutoscaleSettingResourceCollection -} - -// AutoscaleSettingsClientUpdateResponse contains the response from method AutoscaleSettingsClient.Update. -type AutoscaleSettingsClientUpdateResponse struct { - // The autoscale setting resource. - AutoscaleSettingResource -} - -// AzureMonitorWorkspacesClientCreateResponse contains the response from method AzureMonitorWorkspacesClient.Create. -type AzureMonitorWorkspacesClientCreateResponse struct { - // An Azure Monitor Workspace definition - AzureMonitorWorkspaceResource -} - -// AzureMonitorWorkspacesClientDeleteResponse contains the response from method AzureMonitorWorkspacesClient.Delete. -type AzureMonitorWorkspacesClientDeleteResponse struct { - // placeholder for future response values -} - -// AzureMonitorWorkspacesClientGetResponse contains the response from method AzureMonitorWorkspacesClient.Get. -type AzureMonitorWorkspacesClientGetResponse struct { - // An Azure Monitor Workspace definition - AzureMonitorWorkspaceResource -} - -// AzureMonitorWorkspacesClientListByResourceGroupResponse contains the response from method AzureMonitorWorkspacesClient.NewListByResourceGroupPager. -type AzureMonitorWorkspacesClientListByResourceGroupResponse struct { - // A pageable list of resources - AzureMonitorWorkspaceResourceListResult -} - -// AzureMonitorWorkspacesClientListBySubscriptionResponse contains the response from method AzureMonitorWorkspacesClient.NewListBySubscriptionPager. -type AzureMonitorWorkspacesClientListBySubscriptionResponse struct { - // A pageable list of resources - AzureMonitorWorkspaceResourceListResult -} - -// AzureMonitorWorkspacesClientUpdateResponse contains the response from method AzureMonitorWorkspacesClient.Update. -type AzureMonitorWorkspacesClientUpdateResponse struct { - // An Azure Monitor Workspace definition - AzureMonitorWorkspaceResource -} - -// BaselinesClientListResponse contains the response from method BaselinesClient.NewListPager. -type BaselinesClientListResponse struct { - // A list of metric baselines. - MetricBaselinesResponse -} - -// DataCollectionEndpointsClientCreateResponse contains the response from method DataCollectionEndpointsClient.Create. -type DataCollectionEndpointsClientCreateResponse struct { - // Definition of ARM tracked top level resource. - DataCollectionEndpointResource -} - -// DataCollectionEndpointsClientDeleteResponse contains the response from method DataCollectionEndpointsClient.Delete. -type DataCollectionEndpointsClientDeleteResponse struct { - // placeholder for future response values -} - -// DataCollectionEndpointsClientGetResponse contains the response from method DataCollectionEndpointsClient.Get. -type DataCollectionEndpointsClientGetResponse struct { - // Definition of ARM tracked top level resource. - DataCollectionEndpointResource -} - -// DataCollectionEndpointsClientListByResourceGroupResponse contains the response from method DataCollectionEndpointsClient.NewListByResourceGroupPager. -type DataCollectionEndpointsClientListByResourceGroupResponse struct { - // A pageable list of resources. - DataCollectionEndpointResourceListResult -} - -// DataCollectionEndpointsClientListBySubscriptionResponse contains the response from method DataCollectionEndpointsClient.NewListBySubscriptionPager. -type DataCollectionEndpointsClientListBySubscriptionResponse struct { - // A pageable list of resources. - DataCollectionEndpointResourceListResult -} - -// DataCollectionEndpointsClientUpdateResponse contains the response from method DataCollectionEndpointsClient.Update. -type DataCollectionEndpointsClientUpdateResponse struct { - // Definition of ARM tracked top level resource. - DataCollectionEndpointResource -} - -// DataCollectionRuleAssociationsClientCreateResponse contains the response from method DataCollectionRuleAssociationsClient.Create. -type DataCollectionRuleAssociationsClientCreateResponse struct { - // Definition of generic ARM proxy resource. - DataCollectionRuleAssociationProxyOnlyResource -} - -// DataCollectionRuleAssociationsClientDeleteResponse contains the response from method DataCollectionRuleAssociationsClient.Delete. -type DataCollectionRuleAssociationsClientDeleteResponse struct { - // placeholder for future response values -} - -// DataCollectionRuleAssociationsClientGetResponse contains the response from method DataCollectionRuleAssociationsClient.Get. -type DataCollectionRuleAssociationsClientGetResponse struct { - // Definition of generic ARM proxy resource. - DataCollectionRuleAssociationProxyOnlyResource -} - -// DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse contains the response from method DataCollectionRuleAssociationsClient.NewListByDataCollectionEndpointPager. -type DataCollectionRuleAssociationsClientListByDataCollectionEndpointResponse struct { - // A pageable list of resources. - DataCollectionRuleAssociationProxyOnlyResourceListResult -} - -// DataCollectionRuleAssociationsClientListByResourceResponse contains the response from method DataCollectionRuleAssociationsClient.NewListByResourcePager. -type DataCollectionRuleAssociationsClientListByResourceResponse struct { - // A pageable list of resources. - DataCollectionRuleAssociationProxyOnlyResourceListResult -} - -// DataCollectionRuleAssociationsClientListByRuleResponse contains the response from method DataCollectionRuleAssociationsClient.NewListByRulePager. -type DataCollectionRuleAssociationsClientListByRuleResponse struct { - // A pageable list of resources. - DataCollectionRuleAssociationProxyOnlyResourceListResult -} - -// DataCollectionRulesClientCreateResponse contains the response from method DataCollectionRulesClient.Create. -type DataCollectionRulesClientCreateResponse struct { - // Definition of ARM tracked top level resource. - DataCollectionRuleResource -} - -// DataCollectionRulesClientDeleteResponse contains the response from method DataCollectionRulesClient.Delete. -type DataCollectionRulesClientDeleteResponse struct { - // placeholder for future response values -} - -// DataCollectionRulesClientGetResponse contains the response from method DataCollectionRulesClient.Get. -type DataCollectionRulesClientGetResponse struct { - // Definition of ARM tracked top level resource. - DataCollectionRuleResource -} - -// DataCollectionRulesClientListByResourceGroupResponse contains the response from method DataCollectionRulesClient.NewListByResourceGroupPager. -type DataCollectionRulesClientListByResourceGroupResponse struct { - // A pageable list of resources. - DataCollectionRuleResourceListResult -} - -// DataCollectionRulesClientListBySubscriptionResponse contains the response from method DataCollectionRulesClient.NewListBySubscriptionPager. -type DataCollectionRulesClientListBySubscriptionResponse struct { - // A pageable list of resources. - DataCollectionRuleResourceListResult -} - -// DataCollectionRulesClientUpdateResponse contains the response from method DataCollectionRulesClient.Update. -type DataCollectionRulesClientUpdateResponse struct { - // Definition of ARM tracked top level resource. - DataCollectionRuleResource -} - -// DiagnosticSettingsCategoryClientGetResponse contains the response from method DiagnosticSettingsCategoryClient.Get. -type DiagnosticSettingsCategoryClientGetResponse struct { - // The diagnostic settings category resource. - DiagnosticSettingsCategoryResource -} - -// DiagnosticSettingsCategoryClientListResponse contains the response from method DiagnosticSettingsCategoryClient.NewListPager. -type DiagnosticSettingsCategoryClientListResponse struct { - // Represents a collection of diagnostic setting category resources. - DiagnosticSettingsCategoryResourceCollection -} - -// DiagnosticSettingsClientCreateOrUpdateResponse contains the response from method DiagnosticSettingsClient.CreateOrUpdate. -type DiagnosticSettingsClientCreateOrUpdateResponse struct { - // The diagnostic setting resource. - DiagnosticSettingsResource -} - -// DiagnosticSettingsClientDeleteResponse contains the response from method DiagnosticSettingsClient.Delete. -type DiagnosticSettingsClientDeleteResponse struct { - // placeholder for future response values -} - -// DiagnosticSettingsClientGetResponse contains the response from method DiagnosticSettingsClient.Get. -type DiagnosticSettingsClientGetResponse struct { - // The diagnostic setting resource. - DiagnosticSettingsResource -} - -// DiagnosticSettingsClientListResponse contains the response from method DiagnosticSettingsClient.NewListPager. -type DiagnosticSettingsClientListResponse struct { - // Represents a collection of alert rule resources. - DiagnosticSettingsResourceCollection -} - -// EventCategoriesClientListResponse contains the response from method EventCategoriesClient.NewListPager. -type EventCategoriesClientListResponse struct { - // A collection of event categories. Currently possible values are: Administrative, Security, ServiceHealth, Alert, Recommendation, - // Policy. - EventCategoryCollection -} - -// LogProfilesClientCreateOrUpdateResponse contains the response from method LogProfilesClient.CreateOrUpdate. -type LogProfilesClientCreateOrUpdateResponse struct { - // The log profile resource. - LogProfileResource -} - -// LogProfilesClientDeleteResponse contains the response from method LogProfilesClient.Delete. -type LogProfilesClientDeleteResponse struct { - // placeholder for future response values -} - -// LogProfilesClientGetResponse contains the response from method LogProfilesClient.Get. -type LogProfilesClientGetResponse struct { - // The log profile resource. - LogProfileResource -} - -// LogProfilesClientListResponse contains the response from method LogProfilesClient.NewListPager. -type LogProfilesClientListResponse struct { - // Represents a collection of log profiles. - LogProfileCollection -} - -// LogProfilesClientUpdateResponse contains the response from method LogProfilesClient.Update. -type LogProfilesClientUpdateResponse struct { - // The log profile resource. - LogProfileResource -} - -// MetricAlertsClientCreateOrUpdateResponse contains the response from method MetricAlertsClient.CreateOrUpdate. -type MetricAlertsClientCreateOrUpdateResponse struct { - // The metric alert resource. - MetricAlertResource -} - -// MetricAlertsClientDeleteResponse contains the response from method MetricAlertsClient.Delete. -type MetricAlertsClientDeleteResponse struct { - // placeholder for future response values -} - -// MetricAlertsClientGetResponse contains the response from method MetricAlertsClient.Get. -type MetricAlertsClientGetResponse struct { - // The metric alert resource. - MetricAlertResource -} - -// MetricAlertsClientListByResourceGroupResponse contains the response from method MetricAlertsClient.NewListByResourceGroupPager. -type MetricAlertsClientListByResourceGroupResponse struct { - // Represents a collection of alert rule resources. - MetricAlertResourceCollection -} - -// MetricAlertsClientListBySubscriptionResponse contains the response from method MetricAlertsClient.NewListBySubscriptionPager. -type MetricAlertsClientListBySubscriptionResponse struct { - // Represents a collection of alert rule resources. - MetricAlertResourceCollection -} - -// MetricAlertsClientUpdateResponse contains the response from method MetricAlertsClient.Update. -type MetricAlertsClientUpdateResponse struct { - // The metric alert resource. - MetricAlertResource -} - -// MetricAlertsStatusClientListByNameResponse contains the response from method MetricAlertsStatusClient.ListByName. -type MetricAlertsStatusClientListByNameResponse struct { - // Represents a collection of alert rule resources. - MetricAlertStatusCollection -} - -// MetricAlertsStatusClientListResponse contains the response from method MetricAlertsStatusClient.List. -type MetricAlertsStatusClientListResponse struct { - // Represents a collection of alert rule resources. - MetricAlertStatusCollection -} - -// MetricDefinitionsClientListAtSubscriptionScopeResponse contains the response from method MetricDefinitionsClient.NewListAtSubscriptionScopePager. -type MetricDefinitionsClientListAtSubscriptionScopeResponse struct { - // Represents collection of metric definitions. - SubscriptionScopeMetricDefinitionCollection -} - -// MetricDefinitionsClientListResponse contains the response from method MetricDefinitionsClient.NewListPager. -type MetricDefinitionsClientListResponse struct { - // Represents collection of metric definitions. - MetricDefinitionCollection -} - -// MetricNamespacesClientListResponse contains the response from method MetricNamespacesClient.NewListPager. -type MetricNamespacesClientListResponse struct { - // Represents collection of metric namespaces. - MetricNamespaceCollection -} - -// MetricsClientListAtSubscriptionScopePostResponse contains the response from method MetricsClient.ListAtSubscriptionScopePost. -type MetricsClientListAtSubscriptionScopePostResponse struct { - // The response to a subscription scope metrics query. - SubscriptionScopeMetricResponse -} - -// MetricsClientListAtSubscriptionScopeResponse contains the response from method MetricsClient.ListAtSubscriptionScope. -type MetricsClientListAtSubscriptionScopeResponse struct { - // The response to a subscription scope metrics query. - SubscriptionScopeMetricResponse -} - -// MetricsClientListResponse contains the response from method MetricsClient.List. -type MetricsClientListResponse struct { - // The response to a metrics query. - Response -} - -// OperationsClientListResponse contains the response from method OperationsClient.List. -type OperationsClientListResponse struct { - // Result of the request to list Microsoft.Insights operations. It contains a list of operations and a URL link to get the - // next set of results. - OperationListResult -} - -// OperationsForMonitorClientListResponse contains the response from method OperationsForMonitorClient.NewListPager. -type OperationsForMonitorClientListResponse struct { - // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. - OperationListResultAutoGenerated -} - -// PredictiveMetricClientGetResponse contains the response from method PredictiveMetricClient.Get. -type PredictiveMetricClientGetResponse struct { - // The response to a metrics query. - PredictiveResponse -} - -// PrivateEndpointConnectionsClientCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsClient.BeginCreateOrUpdate. -type PrivateEndpointConnectionsClientCreateOrUpdateResponse struct { - // The Private Endpoint Connection resource. - PrivateEndpointConnection -} - -// PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.BeginDelete. -type PrivateEndpointConnectionsClientDeleteResponse struct { - // placeholder for future response values -} - -// PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. -type PrivateEndpointConnectionsClientGetResponse struct { - // The Private Endpoint Connection resource. - PrivateEndpointConnection -} - -// PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse contains the response from method PrivateEndpointConnectionsClient.ListByPrivateLinkScope. -type PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse struct { - // List of private endpoint connection associated with the specified storage account - PrivateEndpointConnectionListResult -} - -// PrivateLinkResourcesClientGetResponse contains the response from method PrivateLinkResourcesClient.Get. -type PrivateLinkResourcesClientGetResponse struct { - // A private link resource - PrivateLinkResource -} - -// PrivateLinkResourcesClientListByPrivateLinkScopeResponse contains the response from method PrivateLinkResourcesClient.ListByPrivateLinkScope. -type PrivateLinkResourcesClientListByPrivateLinkScopeResponse struct { - // A list of private link resources - PrivateLinkResourceListResult -} - -// PrivateLinkScopeOperationStatusClientGetResponse contains the response from method PrivateLinkScopeOperationStatusClient.Get. -type PrivateLinkScopeOperationStatusClientGetResponse struct { - // The status of operation. - OperationStatus -} - -// PrivateLinkScopedResourcesClientCreateOrUpdateResponse contains the response from method PrivateLinkScopedResourcesClient.BeginCreateOrUpdate. -type PrivateLinkScopedResourcesClientCreateOrUpdateResponse struct { - // A private link scoped resource - ScopedResource -} - -// PrivateLinkScopedResourcesClientDeleteResponse contains the response from method PrivateLinkScopedResourcesClient.BeginDelete. -type PrivateLinkScopedResourcesClientDeleteResponse struct { - // placeholder for future response values -} - -// PrivateLinkScopedResourcesClientGetResponse contains the response from method PrivateLinkScopedResourcesClient.Get. -type PrivateLinkScopedResourcesClientGetResponse struct { - // A private link scoped resource - ScopedResource -} - -// PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse contains the response from method PrivateLinkScopedResourcesClient.NewListByPrivateLinkScopePager. -type PrivateLinkScopedResourcesClientListByPrivateLinkScopeResponse struct { - // A list of scoped resources in a private link scope. - ScopedResourceListResult -} - -// PrivateLinkScopesClientCreateOrUpdateResponse contains the response from method PrivateLinkScopesClient.CreateOrUpdate. -type PrivateLinkScopesClientCreateOrUpdateResponse struct { - // An Azure Monitor PrivateLinkScope definition. - AzureMonitorPrivateLinkScope -} - -// PrivateLinkScopesClientDeleteResponse contains the response from method PrivateLinkScopesClient.BeginDelete. -type PrivateLinkScopesClientDeleteResponse struct { - // placeholder for future response values -} - -// PrivateLinkScopesClientGetResponse contains the response from method PrivateLinkScopesClient.Get. -type PrivateLinkScopesClientGetResponse struct { - // An Azure Monitor PrivateLinkScope definition. - AzureMonitorPrivateLinkScope -} - -// PrivateLinkScopesClientListByResourceGroupResponse contains the response from method PrivateLinkScopesClient.NewListByResourceGroupPager. -type PrivateLinkScopesClientListByResourceGroupResponse struct { - // Describes the list of Azure Monitor PrivateLinkScope resources. - AzureMonitorPrivateLinkScopeListResult -} - -// PrivateLinkScopesClientListResponse contains the response from method PrivateLinkScopesClient.NewListPager. -type PrivateLinkScopesClientListResponse struct { - // Describes the list of Azure Monitor PrivateLinkScope resources. - AzureMonitorPrivateLinkScopeListResult -} - -// PrivateLinkScopesClientUpdateTagsResponse contains the response from method PrivateLinkScopesClient.UpdateTags. -type PrivateLinkScopesClientUpdateTagsResponse struct { - // An Azure Monitor PrivateLinkScope definition. - AzureMonitorPrivateLinkScope -} - -// ScheduledQueryRulesClientCreateOrUpdateResponse contains the response from method ScheduledQueryRulesClient.CreateOrUpdate. -type ScheduledQueryRulesClientCreateOrUpdateResponse struct { - // The scheduled query rule resource. - ScheduledQueryRuleResource -} - -// ScheduledQueryRulesClientDeleteResponse contains the response from method ScheduledQueryRulesClient.Delete. -type ScheduledQueryRulesClientDeleteResponse struct { - // placeholder for future response values -} - -// ScheduledQueryRulesClientGetResponse contains the response from method ScheduledQueryRulesClient.Get. -type ScheduledQueryRulesClientGetResponse struct { - // The scheduled query rule resource. - ScheduledQueryRuleResource -} - -// ScheduledQueryRulesClientListByResourceGroupResponse contains the response from method ScheduledQueryRulesClient.NewListByResourceGroupPager. -type ScheduledQueryRulesClientListByResourceGroupResponse struct { - // Represents a collection of scheduled query rule resources. - ScheduledQueryRuleResourceCollection -} - -// ScheduledQueryRulesClientListBySubscriptionResponse contains the response from method ScheduledQueryRulesClient.NewListBySubscriptionPager. -type ScheduledQueryRulesClientListBySubscriptionResponse struct { - // Represents a collection of scheduled query rule resources. - ScheduledQueryRuleResourceCollection -} - -// ScheduledQueryRulesClientUpdateResponse contains the response from method ScheduledQueryRulesClient.Update. -type ScheduledQueryRulesClientUpdateResponse struct { - // The scheduled query rule resource. - ScheduledQueryRuleResource -} - -// TenantActionGroupsClientCreateOrUpdateResponse contains the response from method TenantActionGroupsClient.CreateOrUpdate. -type TenantActionGroupsClientCreateOrUpdateResponse struct { - // A tenant action group resource. - TenantActionGroupResource -} - -// TenantActionGroupsClientDeleteResponse contains the response from method TenantActionGroupsClient.Delete. -type TenantActionGroupsClientDeleteResponse struct { - // placeholder for future response values -} - -// TenantActionGroupsClientGetResponse contains the response from method TenantActionGroupsClient.Get. -type TenantActionGroupsClientGetResponse struct { - // A tenant action group resource. - TenantActionGroupResource -} - -// TenantActionGroupsClientListByManagementGroupIDResponse contains the response from method TenantActionGroupsClient.NewListByManagementGroupIDPager. -type TenantActionGroupsClientListByManagementGroupIDResponse struct { - // A list of tenant action groups. - TenantActionGroupList -} - -// TenantActionGroupsClientUpdateResponse contains the response from method TenantActionGroupsClient.Update. -type TenantActionGroupsClientUpdateResponse struct { - // A tenant action group resource. - TenantActionGroupResource -} - -// TenantActivityLogsClientListResponse contains the response from method TenantActivityLogsClient.NewListPager. -type TenantActivityLogsClientListResponse struct { - // Represents collection of events. - EventDataCollection -} - -// VMInsightsClientGetOnboardingStatusResponse contains the response from method VMInsightsClient.GetOnboardingStatus. -type VMInsightsClientGetOnboardingStatusResponse struct { - // VM Insights onboarding status for a resource. - VMInsightsOnboardingStatus -} diff --git a/sdk/resourcemanager/monitor/armmonitor/responses.go b/sdk/resourcemanager/monitor/armmonitor/responses.go new file mode 100644 index 000000000000..2acdfb918ffc --- /dev/null +++ b/sdk/resourcemanager/monitor/armmonitor/responses.go @@ -0,0 +1,93 @@ +// 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 armmonitor + +// ActionGroupsClientCreateNotificationsAtActionGroupResourceLevelResponse contains the response from method ActionGroupsClient.BeginCreateNotificationsAtActionGroupResourceLevel. +type ActionGroupsClientCreateNotificationsAtActionGroupResourceLevelResponse struct { + // The details of the test notification results. + TestNotificationDetailsResponse +} + +// ActionGroupsClientCreateOrUpdateResponse contains the response from method ActionGroupsClient.CreateOrUpdate. +type ActionGroupsClientCreateOrUpdateResponse struct { + // An action group resource. + ActionGroupResource +} + +// ActionGroupsClientDeleteResponse contains the response from method ActionGroupsClient.Delete. +type ActionGroupsClientDeleteResponse struct { + // placeholder for future response values +} + +// ActionGroupsClientEnableReceiverResponse contains the response from method ActionGroupsClient.EnableReceiver. +type ActionGroupsClientEnableReceiverResponse struct { + // placeholder for future response values +} + +// ActionGroupsClientGetResponse contains the response from method ActionGroupsClient.Get. +type ActionGroupsClientGetResponse struct { + // An action group resource. + ActionGroupResource +} + +// ActionGroupsClientGetTestNotificationsAtActionGroupResourceLevelResponse contains the response from method ActionGroupsClient.GetTestNotificationsAtActionGroupResourceLevel. +type ActionGroupsClientGetTestNotificationsAtActionGroupResourceLevelResponse struct { + // The details of the test notification results. + TestNotificationDetailsResponse +} + +// ActionGroupsClientListByResourceGroupResponse contains the response from method ActionGroupsClient.NewListByResourceGroupPager. +type ActionGroupsClientListByResourceGroupResponse struct { + // A list of action groups. + ActionGroupList +} + +// ActionGroupsClientListBySubscriptionIDResponse contains the response from method ActionGroupsClient.NewListBySubscriptionIDPager. +type ActionGroupsClientListBySubscriptionIDResponse struct { + // A list of action groups. + ActionGroupList +} + +// ActionGroupsClientUpdateResponse contains the response from method ActionGroupsClient.Update. +type ActionGroupsClientUpdateResponse struct { + // An action group resource. + ActionGroupResource +} + +// ScheduledQueryRulesClientCreateOrUpdateResponse contains the response from method ScheduledQueryRulesClient.CreateOrUpdate. +type ScheduledQueryRulesClientCreateOrUpdateResponse struct { + // The scheduled query rule resource. + ScheduledQueryRuleResource +} + +// ScheduledQueryRulesClientDeleteResponse contains the response from method ScheduledQueryRulesClient.Delete. +type ScheduledQueryRulesClientDeleteResponse struct { + // placeholder for future response values +} + +// ScheduledQueryRulesClientGetResponse contains the response from method ScheduledQueryRulesClient.Get. +type ScheduledQueryRulesClientGetResponse struct { + // The scheduled query rule resource. + ScheduledQueryRuleResource +} + +// ScheduledQueryRulesClientListByResourceGroupResponse contains the response from method ScheduledQueryRulesClient.NewListByResourceGroupPager. +type ScheduledQueryRulesClientListByResourceGroupResponse struct { + // Represents a collection of scheduled query rule resources. + ScheduledQueryRuleResourceCollection +} + +// ScheduledQueryRulesClientListBySubscriptionResponse contains the response from method ScheduledQueryRulesClient.NewListBySubscriptionPager. +type ScheduledQueryRulesClientListBySubscriptionResponse struct { + // Represents a collection of scheduled query rule resources. + ScheduledQueryRuleResourceCollection +} + +// ScheduledQueryRulesClientUpdateResponse contains the response from method ScheduledQueryRulesClient.Update. +type ScheduledQueryRulesClientUpdateResponse struct { + // The scheduled query rule resource. + ScheduledQueryRuleResource +} diff --git a/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client.go b/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client.go index 96c5d6d1a89d..2f94af79bf8a 100644 --- a/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_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. @@ -46,7 +43,7 @@ func NewScheduledQueryRulesClient(subscriptionID string, credential azcore.Token // CreateOrUpdate - Creates or updates a scheduled query rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01-preview +// Generated from API version 2025-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - ruleName - The name of the rule. // - parameters - The parameters of the rule to create or update. @@ -75,7 +72,7 @@ func (client *ScheduledQueryRulesClient) CreateOrUpdate(ctx context.Context, res } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ScheduledQueryRulesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, parameters ScheduledQueryRuleResource, options *ScheduledQueryRulesClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ScheduledQueryRulesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, parameters ScheduledQueryRuleResource, _ *ScheduledQueryRulesClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -94,7 +91,7 @@ func (client *ScheduledQueryRulesClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { @@ -115,7 +112,7 @@ func (client *ScheduledQueryRulesClient) createOrUpdateHandleResponse(resp *http // Delete - Deletes a scheduled query rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01-preview +// Generated from API version 2025-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - ruleName - The name of the rule. // - options - ScheduledQueryRulesClientDeleteOptions contains the optional parameters for the ScheduledQueryRulesClient.Delete @@ -142,7 +139,7 @@ func (client *ScheduledQueryRulesClient) Delete(ctx context.Context, resourceGro } // deleteCreateRequest creates the Delete request. -func (client *ScheduledQueryRulesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, options *ScheduledQueryRulesClientDeleteOptions) (*policy.Request, error) { +func (client *ScheduledQueryRulesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, _ *ScheduledQueryRulesClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -161,7 +158,7 @@ func (client *ScheduledQueryRulesClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -170,7 +167,7 @@ func (client *ScheduledQueryRulesClient) deleteCreateRequest(ctx context.Context // Get - Retrieve an scheduled query rule definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01-preview +// Generated from API version 2025-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - ruleName - The name of the rule. // - options - ScheduledQueryRulesClientGetOptions contains the optional parameters for the ScheduledQueryRulesClient.Get method. @@ -197,7 +194,7 @@ func (client *ScheduledQueryRulesClient) Get(ctx context.Context, resourceGroupN } // getCreateRequest creates the Get request. -func (client *ScheduledQueryRulesClient) getCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, options *ScheduledQueryRulesClientGetOptions) (*policy.Request, error) { +func (client *ScheduledQueryRulesClient) getCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, _ *ScheduledQueryRulesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -216,7 +213,7 @@ func (client *ScheduledQueryRulesClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -233,7 +230,7 @@ func (client *ScheduledQueryRulesClient) getHandleResponse(resp *http.Response) // NewListByResourceGroupPager - Retrieve scheduled query rule definitions in a resource group. // -// Generated from API version 2022-08-01-preview +// Generated from API version 2025-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ScheduledQueryRulesClientListByResourceGroupOptions contains the optional parameters for the ScheduledQueryRulesClient.NewListByResourceGroupPager // method. @@ -261,7 +258,7 @@ func (client *ScheduledQueryRulesClient) NewListByResourceGroupPager(resourceGro } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *ScheduledQueryRulesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ScheduledQueryRulesClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *ScheduledQueryRulesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *ScheduledQueryRulesClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -276,7 +273,7 @@ func (client *ScheduledQueryRulesClient) listByResourceGroupCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -293,7 +290,7 @@ func (client *ScheduledQueryRulesClient) listByResourceGroupHandleResponse(resp // NewListBySubscriptionPager - Retrieve a scheduled query rule definitions in a subscription. // -// Generated from API version 2022-08-01-preview +// Generated from API version 2025-01-01-preview // - options - ScheduledQueryRulesClientListBySubscriptionOptions contains the optional parameters for the ScheduledQueryRulesClient.NewListBySubscriptionPager // method. func (client *ScheduledQueryRulesClient) NewListBySubscriptionPager(options *ScheduledQueryRulesClientListBySubscriptionOptions) *runtime.Pager[ScheduledQueryRulesClientListBySubscriptionResponse] { @@ -320,7 +317,7 @@ func (client *ScheduledQueryRulesClient) NewListBySubscriptionPager(options *Sch } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *ScheduledQueryRulesClient) listBySubscriptionCreateRequest(ctx context.Context, options *ScheduledQueryRulesClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *ScheduledQueryRulesClient) listBySubscriptionCreateRequest(ctx context.Context, _ *ScheduledQueryRulesClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -331,7 +328,7 @@ func (client *ScheduledQueryRulesClient) listBySubscriptionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -349,7 +346,7 @@ func (client *ScheduledQueryRulesClient) listBySubscriptionHandleResponse(resp * // Update - Update a scheduled query rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-08-01-preview +// Generated from API version 2025-01-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - ruleName - The name of the rule. // - parameters - The parameters of the rule to update. @@ -378,7 +375,7 @@ func (client *ScheduledQueryRulesClient) Update(ctx context.Context, resourceGro } // updateCreateRequest creates the Update request. -func (client *ScheduledQueryRulesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, parameters ScheduledQueryRuleResourcePatch, options *ScheduledQueryRulesClientUpdateOptions) (*policy.Request, error) { +func (client *ScheduledQueryRulesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, ruleName string, parameters ScheduledQueryRuleResourcePatch, _ *ScheduledQueryRulesClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/scheduledQueryRules/{ruleName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -397,7 +394,7 @@ func (client *ScheduledQueryRulesClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-08-01-preview") + reqQP.Set("api-version", "2025-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, parameters); err != nil { diff --git a/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client_example_test.go deleted file mode 100644 index 405112627130..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/scheduledqueryrules_client_example_test.go +++ /dev/null @@ -1,859 +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 armmonitor_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/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/listScheduledQueryRulesBySubscription.json -func ExampleScheduledQueryRulesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewScheduledQueryRulesClient().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.ScheduledQueryRuleResourceCollection = armmonitor.ScheduledQueryRuleResourceCollection{ - // Value: []*armmonitor.ScheduledQueryRuleResource{ - // { - // Name: to.Ptr("perf"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/perf"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Performance rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // { - // Name: to.Ptr("ComputerIp"), - // Operator: to.Ptr(armmonitor.DimensionOperatorExclude), - // Values: []*string{ - // to.Ptr("192.168.1.1")}, - // }, - // { - // Name: to.Ptr("OSType"), - // Operator: to.Ptr(armmonitor.DimensionOperatorInclude), - // Values: []*string{ - // to.Ptr("*")}, - // }}, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // MetricMeasureColumn: to.Ptr("% Processor Time"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Perf | where ObjectName == \"Processor\""), - // ResourceIDColumn: to.Ptr("resourceId"), - // Threshold: to.Ptr[float64](70), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // TargetResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines")}, - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // }, - // { - // Name: to.Ptr("heartbeat"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/MyResourceGroupName2/providers/microsoft.insights/scheduledqueryrules/heartbeat"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Health check rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // }, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Heartbeat"), - // Threshold: to.Ptr[float64](360), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationCount), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // TargetResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines")}, - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/listScheduledQueryRulesByResourceGroup.json -func ExampleScheduledQueryRulesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewScheduledQueryRulesClient().NewListByResourceGroupPager("QueryResourceGroupName", 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.ScheduledQueryRuleResourceCollection = armmonitor.ScheduledQueryRuleResourceCollection{ - // Value: []*armmonitor.ScheduledQueryRuleResource{ - // { - // Name: to.Ptr("perf"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/perf"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Performance rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // { - // Name: to.Ptr("ComputerIp"), - // Operator: to.Ptr(armmonitor.DimensionOperatorExclude), - // Values: []*string{ - // to.Ptr("192.168.1.1")}, - // }, - // { - // Name: to.Ptr("OSType"), - // Operator: to.Ptr(armmonitor.DimensionOperatorInclude), - // Values: []*string{ - // to.Ptr("*")}, - // }}, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // MetricMeasureColumn: to.Ptr("% Processor Time"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Perf | where ObjectName == \"Processor\""), - // ResourceIDColumn: to.Ptr("resourceId"), - // Threshold: to.Ptr[float64](70), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // TargetResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines")}, - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // }, - // { - // Name: to.Ptr("heartbeat"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/heartbeat"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Health check rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // }, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Heartbeat"), - // Threshold: to.Ptr[float64](360), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationCount), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // TargetResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines")}, - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/getScheduledQueryRule.json -func ExampleScheduledQueryRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScheduledQueryRulesClient().Get(ctx, "QueryResourceGroupName", "perf", 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.ScheduledQueryRuleResource = armmonitor.ScheduledQueryRuleResource{ - // Name: to.Ptr("perf"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/perf"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Performance rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // { - // Name: to.Ptr("ComputerIp"), - // Operator: to.Ptr(armmonitor.DimensionOperatorExclude), - // Values: []*string{ - // to.Ptr("192.168.1.1")}, - // }, - // { - // Name: to.Ptr("OSType"), - // Operator: to.Ptr(armmonitor.DimensionOperatorInclude), - // Values: []*string{ - // to.Ptr("*")}, - // }}, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // MetricMeasureColumn: to.Ptr("% Processor Time"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Perf | where ObjectName == \"Processor\""), - // ResourceIDColumn: to.Ptr("resourceId"), - // Threshold: to.Ptr[float64](70), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1/providers/Microsoft.Compute/virtualMachines/vm1")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/createOrUpdateScheduledQueryRule.json -func ExampleScheduledQueryRulesClient_CreateOrUpdate_createOrUpdateAScheduledQueryRuleForSingleResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScheduledQueryRulesClient().CreateOrUpdate(ctx, "QueryResourceGroupName", "perf", armmonitor.ScheduledQueryRuleResource{ - Location: to.Ptr("eastus"), - Properties: &armmonitor.ScheduledQueryRuleProperties{ - Description: to.Ptr("Performance rule"), - Actions: &armmonitor.Actions{ - ActionGroups: []*string{ - to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - CustomProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }, - CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - AllOf: []*armmonitor.Condition{ - { - Dimensions: []*armmonitor.Dimension{ - { - Name: to.Ptr("ComputerIp"), - Operator: to.Ptr(armmonitor.DimensionOperatorExclude), - Values: []*string{ - to.Ptr("192.168.1.1")}, - }, - { - Name: to.Ptr("OSType"), - Operator: to.Ptr(armmonitor.DimensionOperatorInclude), - Values: []*string{ - to.Ptr("*")}, - }}, - FailingPeriods: &armmonitor.ConditionFailingPeriods{ - MinFailingPeriodsToAlert: to.Ptr[int64](1), - NumberOfEvaluationPeriods: to.Ptr[int64](1), - }, - MetricMeasureColumn: to.Ptr("% Processor Time"), - Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - Query: to.Ptr("Perf | where ObjectName == \"Processor\""), - ResourceIDColumn: to.Ptr("resourceId"), - Threshold: to.Ptr[float64](70), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT5M"), - MuteActionsDuration: to.Ptr("PT30M"), - RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - AutoResolved: to.Ptr(true), - TimeToResolve: to.Ptr("PT10M"), - }, - Scopes: []*string{ - to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1/providers/Microsoft.Compute/virtualMachines/vm1")}, - Severity: to.Ptr(armmonitor.AlertSeverity(4)), - SkipQueryValidation: to.Ptr(true), - WindowSize: to.Ptr("PT10M"), - }, - }, 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.ScheduledQueryRuleResource = armmonitor.ScheduledQueryRuleResource{ - // Name: to.Ptr("perf"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/perf"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Performance rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // { - // Name: to.Ptr("ComputerIp"), - // Operator: to.Ptr(armmonitor.DimensionOperatorExclude), - // Values: []*string{ - // to.Ptr("192.168.1.1")}, - // }, - // { - // Name: to.Ptr("OSType"), - // Operator: to.Ptr(armmonitor.DimensionOperatorInclude), - // Values: []*string{ - // to.Ptr("*")}, - // }}, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // MetricMeasureColumn: to.Ptr("% Processor Time"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Perf | where ObjectName == \"Processor\""), - // ResourceIDColumn: to.Ptr("resourceId"), - // Threshold: to.Ptr[float64](70), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1/providers/Microsoft.Compute/virtualMachines/vm1")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/createOrUpdateScheduledQueryRuleResourceGroup.json -func ExampleScheduledQueryRulesClient_CreateOrUpdate_createOrUpdateAScheduledQueryRuleOnResourceGroupS() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScheduledQueryRulesClient().CreateOrUpdate(ctx, "QueryResourceGroupName", "heartbeat", armmonitor.ScheduledQueryRuleResource{ - Location: to.Ptr("eastus"), - Properties: &armmonitor.ScheduledQueryRuleProperties{ - Description: to.Ptr("Health check rule"), - Actions: &armmonitor.Actions{ - ActionGroups: []*string{ - to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - CustomProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }, - CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - AllOf: []*armmonitor.Condition{ - { - Dimensions: []*armmonitor.Dimension{}, - FailingPeriods: &armmonitor.ConditionFailingPeriods{ - MinFailingPeriodsToAlert: to.Ptr[int64](1), - NumberOfEvaluationPeriods: to.Ptr[int64](1), - }, - Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - Query: to.Ptr("Heartbeat"), - Threshold: to.Ptr[float64](360), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationCount), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT5M"), - MuteActionsDuration: to.Ptr("PT30M"), - RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - AutoResolved: to.Ptr(true), - TimeToResolve: to.Ptr("PT10M"), - }, - Scopes: []*string{ - to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1")}, - Severity: to.Ptr(armmonitor.AlertSeverity(4)), - SkipQueryValidation: to.Ptr(true), - TargetResourceTypes: []*string{ - to.Ptr("Microsoft.Compute/virtualMachines")}, - WindowSize: to.Ptr("PT10M"), - }, - }, 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.ScheduledQueryRuleResource = armmonitor.ScheduledQueryRuleResource{ - // Name: to.Ptr("heartbeat"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/heartbeat"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Health check rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // }, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Heartbeat"), - // Threshold: to.Ptr[float64](360), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationCount), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // TargetResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines")}, - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/createOrUpdateScheduledQueryRuleSubscription.json -func ExampleScheduledQueryRulesClient_CreateOrUpdate_createOrUpdateAScheduledQueryRuleOnSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScheduledQueryRulesClient().CreateOrUpdate(ctx, "QueryResourceGroupName", "perf", armmonitor.ScheduledQueryRuleResource{ - Location: to.Ptr("eastus"), - Properties: &armmonitor.ScheduledQueryRuleProperties{ - Description: to.Ptr("Performance rule"), - Actions: &armmonitor.Actions{ - ActionGroups: []*string{ - to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - CustomProperties: map[string]*string{ - "key11": to.Ptr("value11"), - "key12": to.Ptr("value12"), - }, - }, - CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - AllOf: []*armmonitor.Condition{ - { - Dimensions: []*armmonitor.Dimension{ - { - Name: to.Ptr("ComputerIp"), - Operator: to.Ptr(armmonitor.DimensionOperatorExclude), - Values: []*string{ - to.Ptr("192.168.1.1")}, - }, - { - Name: to.Ptr("OSType"), - Operator: to.Ptr(armmonitor.DimensionOperatorInclude), - Values: []*string{ - to.Ptr("*")}, - }}, - FailingPeriods: &armmonitor.ConditionFailingPeriods{ - MinFailingPeriodsToAlert: to.Ptr[int64](1), - NumberOfEvaluationPeriods: to.Ptr[int64](1), - }, - MetricMeasureColumn: to.Ptr("% Processor Time"), - Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - Query: to.Ptr("Perf | where ObjectName == \"Processor\""), - ResourceIDColumn: to.Ptr("resourceId"), - Threshold: to.Ptr[float64](70), - TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), - }}, - }, - Enabled: to.Ptr(true), - EvaluationFrequency: to.Ptr("PT5M"), - MuteActionsDuration: to.Ptr("PT30M"), - RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - AutoResolved: to.Ptr(true), - TimeToResolve: to.Ptr("PT10M"), - }, - Scopes: []*string{ - to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147")}, - Severity: to.Ptr(armmonitor.AlertSeverity(4)), - SkipQueryValidation: to.Ptr(true), - TargetResourceTypes: []*string{ - to.Ptr("Microsoft.Compute/virtualMachines")}, - WindowSize: to.Ptr("PT10M"), - }, - }, 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.ScheduledQueryRuleResource = armmonitor.ScheduledQueryRuleResource{ - // Name: to.Ptr("perf"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/perf"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Performance rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // { - // Name: to.Ptr("ComputerIp"), - // Operator: to.Ptr(armmonitor.DimensionOperatorExclude), - // Values: []*string{ - // to.Ptr("192.168.1.1")}, - // }, - // { - // Name: to.Ptr("OSType"), - // Operator: to.Ptr(armmonitor.DimensionOperatorInclude), - // Values: []*string{ - // to.Ptr("*")}, - // }}, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // MetricMeasureColumn: to.Ptr("% Processor Time"), - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Perf | where ObjectName == \"Processor\""), - // ResourceIDColumn: to.Ptr("resourceId"), - // Threshold: to.Ptr[float64](70), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationAverage), - // }}, - // }, - // Enabled: to.Ptr(true), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // TargetResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines")}, - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/patchScheduledQueryRule.json -func ExampleScheduledQueryRulesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewScheduledQueryRulesClient().Update(ctx, "QueryResourceGroupName", "heartbeat", armmonitor.ScheduledQueryRuleResourcePatch{ - Properties: &armmonitor.ScheduledQueryRuleProperties{ - Enabled: to.Ptr(false), - }, - }, 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.ScheduledQueryRuleResource = armmonitor.ScheduledQueryRuleResource{ - // Name: to.Ptr("heartbeat"), - // Type: to.Ptr("microsoft.insights/scheduledqueryrules"), - // ID: to.Ptr("/subscriptions/dd4bfc94-a096-412b-9c43-4bd13e35afbc/resourcegroups/QueryResourceGroupName/providers/microsoft.insights/scheduledqueryrules/heartbeat"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.ScheduledQueryRuleProperties{ - // Description: to.Ptr("Health check rule"), - // Actions: &armmonitor.Actions{ - // ActionGroups: []*string{ - // to.Ptr("/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")}, - // CustomProperties: map[string]*string{ - // "key11": to.Ptr("value11"), - // "key12": to.Ptr("value12"), - // }, - // }, - // CheckWorkspaceAlertsStorageConfigured: to.Ptr(true), - // Criteria: &armmonitor.ScheduledQueryRuleCriteria{ - // AllOf: []*armmonitor.Condition{ - // { - // Dimensions: []*armmonitor.Dimension{ - // }, - // FailingPeriods: &armmonitor.ConditionFailingPeriods{ - // MinFailingPeriodsToAlert: to.Ptr[int64](1), - // NumberOfEvaluationPeriods: to.Ptr[int64](1), - // }, - // Operator: to.Ptr(armmonitor.ConditionOperatorGreaterThan), - // Query: to.Ptr("Heartbeat"), - // Threshold: to.Ptr[float64](360), - // TimeAggregation: to.Ptr(armmonitor.TimeAggregationCount), - // }}, - // }, - // Enabled: to.Ptr(false), - // EvaluationFrequency: to.Ptr("PT5M"), - // IsWorkspaceAlertsStorageConfigured: to.Ptr(true), - // MuteActionsDuration: to.Ptr("PT30M"), - // RuleResolveConfiguration: &armmonitor.RuleResolveConfiguration{ - // AutoResolved: to.Ptr(true), - // TimeToResolve: to.Ptr("PT10M"), - // }, - // Scopes: []*string{ - // to.Ptr("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147")}, - // Severity: to.Ptr(armmonitor.AlertSeverity(4)), - // SkipQueryValidation: to.Ptr(true), - // TargetResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines")}, - // WindowSize: to.Ptr("PT10M"), - // }, - // Tags: map[string]*string{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/deleteScheduledQueryRule.json -func ExampleScheduledQueryRulesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewScheduledQueryRulesClient().Delete(ctx, "QueryResourceGroupName", "heartbeat", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client.go b/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client.go deleted file mode 100644 index 06e332a4dbb0..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client.go +++ /dev/null @@ -1,349 +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 armmonitor - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// TenantActionGroupsClient contains the methods for the TenantActionGroups group. -// Don't use this type directly, use NewTenantActionGroupsClient() instead. -type TenantActionGroupsClient struct { - internal *arm.Client -} - -// NewTenantActionGroupsClient creates a new instance of TenantActionGroupsClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewTenantActionGroupsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*TenantActionGroupsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &TenantActionGroupsClient{ - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Create a new tenant action group or update an existing one. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-03-01-preview -// - managementGroupID - The management group id. -// - tenantActionGroupName - The name of the action group. -// - xmsClientTenantID - The tenant ID of the client making the request. -// - actionGroup - The tenant action group to create or use for the update. -// - options - TenantActionGroupsClientCreateOrUpdateOptions contains the optional parameters for the TenantActionGroupsClient.CreateOrUpdate -// method. -func (client *TenantActionGroupsClient) CreateOrUpdate(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, actionGroup TenantActionGroupResource, options *TenantActionGroupsClientCreateOrUpdateOptions) (TenantActionGroupsClientCreateOrUpdateResponse, error) { - var err error - const operationName = "TenantActionGroupsClient.CreateOrUpdate" - 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, managementGroupID, tenantActionGroupName, xmsClientTenantID, actionGroup, options) - if err != nil { - return TenantActionGroupsClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return TenantActionGroupsClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return TenantActionGroupsClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *TenantActionGroupsClient) createOrUpdateCreateRequest(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, actionGroup TenantActionGroupResource, options *TenantActionGroupsClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/tenantActionGroups/{tenantActionGroupName}" - if managementGroupID == "" { - return nil, errors.New("parameter managementGroupID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) - if tenantActionGroupName == "" { - return nil, errors.New("parameter tenantActionGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{tenantActionGroupName}", url.PathEscape(tenantActionGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-client-tenant-id"] = []string{xmsClientTenantID} - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, actionGroup); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *TenantActionGroupsClient) createOrUpdateHandleResponse(resp *http.Response) (TenantActionGroupsClientCreateOrUpdateResponse, error) { - result := TenantActionGroupsClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.TenantActionGroupResource); err != nil { - return TenantActionGroupsClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Delete a tenant action group. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-03-01-preview -// - managementGroupID - The management group id. -// - tenantActionGroupName - The name of the action group. -// - xmsClientTenantID - The tenant ID of the client making the request. -// - options - TenantActionGroupsClientDeleteOptions contains the optional parameters for the TenantActionGroupsClient.Delete -// method. -func (client *TenantActionGroupsClient) Delete(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, options *TenantActionGroupsClientDeleteOptions) (TenantActionGroupsClientDeleteResponse, error) { - var err error - const operationName = "TenantActionGroupsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, managementGroupID, tenantActionGroupName, xmsClientTenantID, options) - if err != nil { - return TenantActionGroupsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return TenantActionGroupsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return TenantActionGroupsClientDeleteResponse{}, err - } - return TenantActionGroupsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *TenantActionGroupsClient) deleteCreateRequest(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, options *TenantActionGroupsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/tenantActionGroups/{tenantActionGroupName}" - if managementGroupID == "" { - return nil, errors.New("parameter managementGroupID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) - if tenantActionGroupName == "" { - return nil, errors.New("parameter tenantActionGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{tenantActionGroupName}", url.PathEscape(tenantActionGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-client-tenant-id"] = []string{xmsClientTenantID} - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get a tenant action group. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-03-01-preview -// - managementGroupID - The management group id. -// - tenantActionGroupName - The name of the action group. -// - xmsClientTenantID - The tenant ID of the client making the request. -// - options - TenantActionGroupsClientGetOptions contains the optional parameters for the TenantActionGroupsClient.Get method. -func (client *TenantActionGroupsClient) Get(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, options *TenantActionGroupsClientGetOptions) (TenantActionGroupsClientGetResponse, error) { - var err error - const operationName = "TenantActionGroupsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, managementGroupID, tenantActionGroupName, xmsClientTenantID, options) - if err != nil { - return TenantActionGroupsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return TenantActionGroupsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return TenantActionGroupsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *TenantActionGroupsClient) getCreateRequest(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, options *TenantActionGroupsClientGetOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/tenantActionGroups/{tenantActionGroupName}" - if managementGroupID == "" { - return nil, errors.New("parameter managementGroupID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) - if tenantActionGroupName == "" { - return nil, errors.New("parameter tenantActionGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{tenantActionGroupName}", url.PathEscape(tenantActionGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-client-tenant-id"] = []string{xmsClientTenantID} - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *TenantActionGroupsClient) getHandleResponse(resp *http.Response) (TenantActionGroupsClientGetResponse, error) { - result := TenantActionGroupsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.TenantActionGroupResource); err != nil { - return TenantActionGroupsClientGetResponse{}, err - } - return result, nil -} - -// NewListByManagementGroupIDPager - Get a list of all tenant action groups in a management group. -// -// Generated from API version 2023-03-01-preview -// - managementGroupID - The management group id. -// - xmsClientTenantID - The tenant ID of the client making the request. -// - options - TenantActionGroupsClientListByManagementGroupIDOptions contains the optional parameters for the TenantActionGroupsClient.NewListByManagementGroupIDPager -// method. -func (client *TenantActionGroupsClient) NewListByManagementGroupIDPager(managementGroupID string, xmsClientTenantID string, options *TenantActionGroupsClientListByManagementGroupIDOptions) *runtime.Pager[TenantActionGroupsClientListByManagementGroupIDResponse] { - return runtime.NewPager(runtime.PagingHandler[TenantActionGroupsClientListByManagementGroupIDResponse]{ - More: func(page TenantActionGroupsClientListByManagementGroupIDResponse) bool { - return false - }, - Fetcher: func(ctx context.Context, page *TenantActionGroupsClientListByManagementGroupIDResponse) (TenantActionGroupsClientListByManagementGroupIDResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TenantActionGroupsClient.NewListByManagementGroupIDPager") - req, err := client.listByManagementGroupIDCreateRequest(ctx, managementGroupID, xmsClientTenantID, options) - if err != nil { - return TenantActionGroupsClientListByManagementGroupIDResponse{}, err - } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return TenantActionGroupsClientListByManagementGroupIDResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return TenantActionGroupsClientListByManagementGroupIDResponse{}, runtime.NewResponseError(resp) - } - return client.listByManagementGroupIDHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByManagementGroupIDCreateRequest creates the ListByManagementGroupID request. -func (client *TenantActionGroupsClient) listByManagementGroupIDCreateRequest(ctx context.Context, managementGroupID string, xmsClientTenantID string, options *TenantActionGroupsClientListByManagementGroupIDOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/tenantActionGroups" - if managementGroupID == "" { - return nil, errors.New("parameter managementGroupID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-client-tenant-id"] = []string{xmsClientTenantID} - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByManagementGroupIDHandleResponse handles the ListByManagementGroupID response. -func (client *TenantActionGroupsClient) listByManagementGroupIDHandleResponse(resp *http.Response) (TenantActionGroupsClientListByManagementGroupIDResponse, error) { - result := TenantActionGroupsClientListByManagementGroupIDResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.TenantActionGroupList); err != nil { - return TenantActionGroupsClientListByManagementGroupIDResponse{}, err - } - return result, nil -} - -// Update - Updates an existing tenant action group's tags. To update other fields use the CreateOrUpdate method. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2023-03-01-preview -// - managementGroupID - The management group id. -// - tenantActionGroupName - The name of the action group. -// - xmsClientTenantID - The tenant ID of the client making the request. -// - tenantActionGroupPatch - Parameters supplied to the operation. -// - options - TenantActionGroupsClientUpdateOptions contains the optional parameters for the TenantActionGroupsClient.Update -// method. -func (client *TenantActionGroupsClient) Update(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, tenantActionGroupPatch ActionGroupPatchBodyAutoGenerated, options *TenantActionGroupsClientUpdateOptions) (TenantActionGroupsClientUpdateResponse, error) { - var err error - const operationName = "TenantActionGroupsClient.Update" - 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, managementGroupID, tenantActionGroupName, xmsClientTenantID, tenantActionGroupPatch, options) - if err != nil { - return TenantActionGroupsClientUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return TenantActionGroupsClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return TenantActionGroupsClientUpdateResponse{}, err - } - resp, err := client.updateHandleResponse(httpResp) - return resp, err -} - -// updateCreateRequest creates the Update request. -func (client *TenantActionGroupsClient) updateCreateRequest(ctx context.Context, managementGroupID string, tenantActionGroupName string, xmsClientTenantID string, tenantActionGroupPatch ActionGroupPatchBodyAutoGenerated, options *TenantActionGroupsClientUpdateOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Management/managementGroups/{managementGroupId}/providers/Microsoft.Insights/tenantActionGroups/{tenantActionGroupName}" - if managementGroupID == "" { - return nil, errors.New("parameter managementGroupID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{managementGroupId}", url.PathEscape(managementGroupID)) - if tenantActionGroupName == "" { - return nil, errors.New("parameter tenantActionGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{tenantActionGroupName}", url.PathEscape(tenantActionGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-03-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["x-ms-client-tenant-id"] = []string{xmsClientTenantID} - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, tenantActionGroupPatch); err != nil { - return nil, err - } - return req, nil -} - -// updateHandleResponse handles the Update response. -func (client *TenantActionGroupsClient) updateHandleResponse(resp *http.Response) (TenantActionGroupsClientUpdateResponse, error) { - result := TenantActionGroupsClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.TenantActionGroupResource); err != nil { - return TenantActionGroupsClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client_example_test.go deleted file mode 100644 index e63ca7241bbc..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/tenantactiongroups_client_example_test.go +++ /dev/null @@ -1,425 +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 armmonitor_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/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2023-03-01-preview/examples/createOrUpdateTenantActionGroup.json -func ExampleTenantActionGroupsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTenantActionGroupsClient().CreateOrUpdate(ctx, "72f988bf-86f1-41af-91ab-2d7cd011db47", "testTenantActionGroup", "72f988bf-86f1-41af-91ab-2d7cd011db47", armmonitor.TenantActionGroupResource{ - Location: to.Ptr("Global"), - Tags: map[string]*string{}, - Properties: &armmonitor.TenantActionGroup{ - AzureAppPushReceivers: []*armmonitor.AzureAppPushReceiverAutoGenerated{ - { - Name: to.Ptr("Sample azureAppPush"), - EmailAddress: to.Ptr("johndoe@email.com"), - }}, - EmailReceivers: []*armmonitor.EmailReceiverAutoGenerated{ - { - Name: to.Ptr("John Doe's email"), - EmailAddress: to.Ptr("johndoe@email.com"), - UseCommonAlertSchema: to.Ptr(false), - }, - { - Name: to.Ptr("Jane Smith's email"), - EmailAddress: to.Ptr("janesmith@email.com"), - UseCommonAlertSchema: to.Ptr(true), - }}, - Enabled: to.Ptr(true), - GroupShortName: to.Ptr("sample"), - SmsReceivers: []*armmonitor.SmsReceiverAutoGenerated{ - { - Name: to.Ptr("John Doe's mobile"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("2062022299"), - }, - { - Name: to.Ptr("Jane Smith's mobile"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("0987654321"), - }}, - VoiceReceivers: []*armmonitor.VoiceReceiverAutoGenerated{ - { - Name: to.Ptr("Sample voice"), - CountryCode: to.Ptr("1"), - PhoneNumber: to.Ptr("2062022299"), - }}, - WebhookReceivers: []*armmonitor.WebhookReceiverAutoGenerated{ - { - Name: to.Ptr("Sample webhook 1"), - ServiceURI: to.Ptr("http://www.example.com/webhook1"), - UseCommonAlertSchema: to.Ptr(true), - }, - { - Name: to.Ptr("Sample webhook 2"), - IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - ServiceURI: to.Ptr("http://www.example.com/webhook2"), - TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - UseAADAuth: to.Ptr(true), - UseCommonAlertSchema: to.Ptr(true), - }}, - }, - }, 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.TenantActionGroupResource = armmonitor.TenantActionGroupResource{ - // Name: to.Ptr("testTenantActionGroup"), - // Type: to.Ptr("Microsoft.Insights/TenantActionGroups"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.Insights/tenantActionGroups/testTenantActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.TenantActionGroup{ - // EmailReceivers: []*armmonitor.EmailReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(true), - // GroupShortName: to.Ptr("sample"), - // SmsReceivers: []*armmonitor.SmsReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample voice"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // }}, - // WebhookReceivers: []*armmonitor.WebhookReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample webhook 1"), - // ServiceURI: to.Ptr("http://www.example.com/webhook1"), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2023-03-01-preview/examples/getTenantActionGroup.json -func ExampleTenantActionGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTenantActionGroupsClient().Get(ctx, "72f988bf-86f1-41af-91ab-2d7cd011db47", "testTenantActionGroup", "72f988bf-86f1-41af-91ab-2d7cd011db47", 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.TenantActionGroupResource = armmonitor.TenantActionGroupResource{ - // Name: to.Ptr("testTenantActionGroup"), - // Type: to.Ptr("Microsoft.Insights/TenantActionGroups"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.Insights/tenantActionGroups/testTenantActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.TenantActionGroup{ - // EmailReceivers: []*armmonitor.EmailReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(true), - // GroupShortName: to.Ptr("sample"), - // SmsReceivers: []*armmonitor.SmsReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample voice"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // }}, - // WebhookReceivers: []*armmonitor.WebhookReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample webhook 1"), - // ServiceURI: to.Ptr("http://www.example.com/webhook1"), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2023-03-01-preview/examples/deleteTenantActionGroup.json -func ExampleTenantActionGroupsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewTenantActionGroupsClient().Delete(ctx, "72f988bf-86f1-41af-91ab-2d7cd011db47", "testTenantActionGroup", "72f988bf-86f1-41af-91ab-2d7cd011db47", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2023-03-01-preview/examples/patchTenantActionGroup.json -func ExampleTenantActionGroupsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTenantActionGroupsClient().Update(ctx, "72f988bf-86f1-41af-91ab-2d7cd011db47", "testTenantActionGroup", "72f988bf-86f1-41af-91ab-2d7cd011db47", armmonitor.ActionGroupPatchBodyAutoGenerated{ - Properties: &armmonitor.ActionGroupPatchAutoGenerated{ - Enabled: to.Ptr(false), - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, 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.TenantActionGroupResource = armmonitor.TenantActionGroupResource{ - // Name: to.Ptr("testTenantActionGroup"), - // Type: to.Ptr("Microsoft.Insights/TenantActionGroups"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.Insights/tenantActionGroups/testTenantActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // "key1": to.Ptr("value1"), - // "key2": to.Ptr("value2"), - // }, - // Properties: &armmonitor.TenantActionGroup{ - // EmailReceivers: []*armmonitor.EmailReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(false), - // GroupShortName: to.Ptr("sample"), - // SmsReceivers: []*armmonitor.SmsReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample voice"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // }}, - // WebhookReceivers: []*armmonitor.WebhookReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample webhook 1"), - // ServiceURI: to.Ptr("http://www.example.com/webhook1"), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2023-03-01-preview/examples/listTenantActionGroups.json -func ExampleTenantActionGroupsClient_NewListByManagementGroupIDPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTenantActionGroupsClient().NewListByManagementGroupIDPager("72f988bf-86f1-41af-91ab-2d7cd011db47", "72f988bf-86f1-41af-91ab-2d7cd011db47", 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.TenantActionGroupList = armmonitor.TenantActionGroupList{ - // Value: []*armmonitor.TenantActionGroupResource{ - // { - // Name: to.Ptr("testTenantActionGroup"), - // Type: to.Ptr("Microsoft.Insights/TenantActionGroups"), - // ID: to.Ptr("/providers/Microsoft.Management/managementGroups/72f988bf-86f1-41af-91ab-2d7cd011db47/providers/Microsoft.Insights/tenantActionGroups/testTenantActionGroup"), - // Location: to.Ptr("Global"), - // Tags: map[string]*string{ - // }, - // Properties: &armmonitor.TenantActionGroup{ - // EmailReceivers: []*armmonitor.EmailReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's email"), - // EmailAddress: to.Ptr("johndoe@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Jane Smith's email"), - // EmailAddress: to.Ptr("janesmith@email.com"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // Enabled: to.Ptr(true), - // GroupShortName: to.Ptr("sample"), - // SmsReceivers: []*armmonitor.SmsReceiverAutoGenerated{ - // { - // Name: to.Ptr("John Doe's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }, - // { - // Name: to.Ptr("Jane Smith's mobile"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("0987654321"), - // Status: to.Ptr(armmonitor.ReceiverStatusEnabled), - // }}, - // VoiceReceivers: []*armmonitor.VoiceReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample voice"), - // CountryCode: to.Ptr("1"), - // PhoneNumber: to.Ptr("2062022299"), - // }}, - // WebhookReceivers: []*armmonitor.WebhookReceiverAutoGenerated{ - // { - // Name: to.Ptr("Sample webhook 1"), - // ServiceURI: to.Ptr("http://www.example.com/webhook1"), - // UseCommonAlertSchema: to.Ptr(true), - // }, - // { - // Name: to.Ptr("Sample webhook 2"), - // IdentifierURI: to.Ptr("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a"), - // ObjectID: to.Ptr("d3bb868c-fe44-452c-aa26-769a6538c808"), - // ServiceURI: to.Ptr("http://www.example.com/webhook2"), - // TenantID: to.Ptr("68a4459a-ccb8-493c-b9da-dd30457d1b84"), - // UseAADAuth: to.Ptr(true), - // UseCommonAlertSchema: to.Ptr(true), - // }}, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client.go b/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client.go deleted file mode 100644 index 5fba971cf4ba..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client.go +++ /dev/null @@ -1,98 +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 armmonitor - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" -) - -// TenantActivityLogsClient contains the methods for the TenantActivityLogs group. -// Don't use this type directly, use NewTenantActivityLogsClient() instead. -type TenantActivityLogsClient struct { - internal *arm.Client -} - -// NewTenantActivityLogsClient creates a new instance of TenantActivityLogsClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewTenantActivityLogsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*TenantActivityLogsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &TenantActivityLogsClient{ - internal: cl, - } - return client, nil -} - -// NewListPager - Gets the Activity Logs for the Tenant. Everything that is applicable to the API to get the Activity Logs -// for the subscription is applicable to this API (the parameters, $filter, etc.). One thing to -// point out here is that this API does not retrieve the logs at the individual subscription of the tenant but only surfaces -// the logs that were generated at the tenant level. -// -// Generated from API version 2015-04-01 -// - options - TenantActivityLogsClientListOptions contains the optional parameters for the TenantActivityLogsClient.NewListPager -// method. -func (client *TenantActivityLogsClient) NewListPager(options *TenantActivityLogsClientListOptions) *runtime.Pager[TenantActivityLogsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[TenantActivityLogsClientListResponse]{ - More: func(page TenantActivityLogsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *TenantActivityLogsClientListResponse) (TenantActivityLogsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TenantActivityLogsClient.NewListPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, options) - }, nil) - if err != nil { - return TenantActivityLogsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *TenantActivityLogsClient) listCreateRequest(ctx context.Context, options *TenantActivityLogsClientListOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Insights/eventtypes/management/values" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-04-01") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.Select != nil { - reqQP.Set("$select", *options.Select) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *TenantActivityLogsClient) listHandleResponse(resp *http.Response) (TenantActivityLogsClientListResponse, error) { - result := TenantActivityLogsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.EventDataCollection); err != nil { - return TenantActivityLogsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client_example_test.go deleted file mode 100644 index 21dd5bab2e23..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/tenantactivitylogs_client_example_test.go +++ /dev/null @@ -1,325 +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 armmonitor_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/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetTenantActivityLogsFiltered.json -func ExampleTenantActivityLogsClient_NewListPager_getTenantActivityLogsWithFilter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTenantActivityLogsClient().NewListPager(&armmonitor.TenantActivityLogsClientListOptions{Filter: to.Ptr("eventTimestamp ge '2015-01-21T20:00:00Z' and eventTimestamp le '2015-01-23T20:00:00Z' and resourceGroupName eq 'MSSupportGroup'"), - Select: 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.EventDataCollection = armmonitor.EventDataCollection{ - // Value: []*armmonitor.EventData{ - // { - // OperationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // Description: to.Ptr(""), - // Authorization: &armmonitor.SenderAuthorization{ - // Action: to.Ptr("microsoft.support/supporttickets/write"), - // Role: to.Ptr("Subscription Admin"), - // Scope: to.Ptr("/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841"), - // }, - // Caller: to.Ptr("admin@contoso.com"), - // Claims: map[string]*string{ - // "name": to.Ptr("John Smith"), - // "appid": to.Ptr("c44b4083-3bq0-49c1-b47d-974e53cbdf3c"), - // "appidacr": to.Ptr("2"), - // "aud": to.Ptr("https://management.core.windows.net/"), - // "exp": to.Ptr("1421880271"), - // "groups": to.Ptr("cacfe77c-e058-4712-83qw-f9b08849fd60,7f71d11d-4c41-4b23-99d2-d32ce7aa621c,31522864-0578-4ea0-9gdc-e66cc564d18c"), - // "http://schemas.microsoft.com/claims/authnclassreference": to.Ptr("1"), - // "http://schemas.microsoft.com/claims/authnmethodsreferences": to.Ptr("pwd"), - // "http://schemas.microsoft.com/identity/claims/objectidentifier": to.Ptr("2468adf0-8211-44e3-95xq-85137af64708"), - // "http://schemas.microsoft.com/identity/claims/scope": to.Ptr("user_impersonation"), - // "http://schemas.microsoft.com/identity/claims/tenantid": to.Ptr("1e8d8218-c5e7-4578-9acc-9abbd5d23315"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname": to.Ptr("John"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name": to.Ptr("admin@contoso.com"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier": to.Ptr("9vckmEGF7zDKk1YzIY8k0t1_EAPaXoeHyPRn6f413zM"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname": to.Ptr("Smith"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn": to.Ptr("admin@contoso.com"), - // "iat": to.Ptr("1421876371"), - // "iss": to.Ptr("https://sts.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/"), - // "nbf": to.Ptr("1421876371"), - // "puid": to.Ptr("20030000801A118C"), - // "ver": to.Ptr("1.0"), - // }, - // CorrelationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // EventDataID: to.Ptr("44ade6b4-3813-45e6-ae27-7420a95fa2f8"), - // EventName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("End request"), - // Value: to.Ptr("EndRequest"), - // }, - // EventTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:26.979Z"); return t}()), - // HTTPRequest: &armmonitor.HTTPRequestInfo{ - // Method: to.Ptr("PUT"), - // ClientIPAddress: to.Ptr("192.168.35.115"), - // ClientRequestID: to.Ptr("27003b25-91d3-418f-8eb1-29e537dcb249"), - // }, - // ID: to.Ptr("/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841/events/44ade6b4-3813-45e6-ae27-7420a95fa2f8/ticks/635574752669792776"), - // Level: to.Ptr(armmonitor.EventLevelInformational), - // OperationName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support/supporttickets/write"), - // Value: to.Ptr("microsoft.support/supporttickets/write"), - // }, - // Properties: map[string]*string{ - // "statusCode": to.Ptr("Created"), - // }, - // ResourceGroupName: to.Ptr("MSSupportGroup"), - // ResourceProviderName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support"), - // Value: to.Ptr("microsoft.support"), - // }, - // Status: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Succeeded"), - // Value: to.Ptr("Succeeded"), - // }, - // SubStatus: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Created (HTTP Status Code: 201)"), - // Value: to.Ptr("Created"), - // }, - // SubmissionTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:39.993Z"); return t}()), - // SubscriptionID: to.Ptr("089bd33f-d4ec-47fe-8ba5-0753aa5c5b33"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetTenantActivityLogsFilteredAndSelected.json -func ExampleTenantActivityLogsClient_NewListPager_getTenantActivityLogsWithFilterAndSelect() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTenantActivityLogsClient().NewListPager(&armmonitor.TenantActivityLogsClientListOptions{Filter: to.Ptr("eventTimestamp ge '2015-01-21T20:00:00Z' and eventTimestamp le '2015-01-23T20:00:00Z' and resourceGroupName eq 'MSSupportGroup'"), - Select: to.Ptr("eventName,id,resourceGroupName,resourceProviderName,operationName,status,eventTimestamp,correlationId,submissionTimestamp,level"), - }) - 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.EventDataCollection = armmonitor.EventDataCollection{ - // Value: []*armmonitor.EventData{ - // { - // CorrelationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // EventName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("End request"), - // Value: to.Ptr("EndRequest"), - // }, - // EventTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:26.979Z"); return t}()), - // ID: to.Ptr("/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841/events/44ade6b4-3813-45e6-ae27-7420a95fa2f8/ticks/635574752669792776"), - // Level: to.Ptr(armmonitor.EventLevelInformational), - // OperationName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support/supporttickets/write"), - // Value: to.Ptr("microsoft.support/supporttickets/write"), - // }, - // ResourceGroupName: to.Ptr("MSSupportGroup"), - // ResourceProviderName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support"), - // Value: to.Ptr("microsoft.support"), - // }, - // Status: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Succeeded"), - // Value: to.Ptr("Succeeded"), - // }, - // SubmissionTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:39.993Z"); return t}()), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetTenantActivityLogsSelected.json -func ExampleTenantActivityLogsClient_NewListPager_getTenantActivityLogsWithSelect() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTenantActivityLogsClient().NewListPager(&armmonitor.TenantActivityLogsClientListOptions{Filter: nil, - Select: to.Ptr("eventName,id,resourceGroupName,resourceProviderName,operationName,status,eventTimestamp,correlationId,submissionTimestamp,level"), - }) - 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.EventDataCollection = armmonitor.EventDataCollection{ - // Value: []*armmonitor.EventData{ - // { - // CorrelationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // EventName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("End request"), - // Value: to.Ptr("EndRequest"), - // }, - // EventTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:26.979Z"); return t}()), - // ID: to.Ptr("/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841/events/44ade6b4-3813-45e6-ae27-7420a95fa2f8/ticks/635574752669792776"), - // Level: to.Ptr(armmonitor.EventLevelInformational), - // OperationName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support/supporttickets/write"), - // Value: to.Ptr("microsoft.support/supporttickets/write"), - // }, - // ResourceGroupName: to.Ptr("MSSupportGroup"), - // ResourceProviderName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support"), - // Value: to.Ptr("microsoft.support"), - // }, - // Status: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Succeeded"), - // Value: to.Ptr("Succeeded"), - // }, - // SubmissionTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:39.993Z"); return t}()), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetTenantActivityLogsNoParams.json -func ExampleTenantActivityLogsClient_NewListPager_getTenantActivityLogsWithoutFilterOrSelect() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTenantActivityLogsClient().NewListPager(&armmonitor.TenantActivityLogsClientListOptions{Filter: nil, - Select: 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.EventDataCollection = armmonitor.EventDataCollection{ - // Value: []*armmonitor.EventData{ - // { - // OperationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // Description: to.Ptr(""), - // Authorization: &armmonitor.SenderAuthorization{ - // Action: to.Ptr("microsoft.support/supporttickets/write"), - // Role: to.Ptr("Subscription Admin"), - // Scope: to.Ptr("/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841"), - // }, - // Caller: to.Ptr("admin@contoso.com"), - // Claims: map[string]*string{ - // "name": to.Ptr("John Smith"), - // "appid": to.Ptr("c44b4083-3bq0-49c1-b47d-974e53cbdf3c"), - // "appidacr": to.Ptr("2"), - // "aud": to.Ptr("https://management.core.windows.net/"), - // "exp": to.Ptr("1421880271"), - // "groups": to.Ptr("cacfe77c-e058-4712-83qw-f9b08849fd60,7f71d11d-4c41-4b23-99d2-d32ce7aa621c,31522864-0578-4ea0-9gdc-e66cc564d18c"), - // "http://schemas.microsoft.com/claims/authnclassreference": to.Ptr("1"), - // "http://schemas.microsoft.com/claims/authnmethodsreferences": to.Ptr("pwd"), - // "http://schemas.microsoft.com/identity/claims/objectidentifier": to.Ptr("2468adf0-8211-44e3-95xq-85137af64708"), - // "http://schemas.microsoft.com/identity/claims/scope": to.Ptr("user_impersonation"), - // "http://schemas.microsoft.com/identity/claims/tenantid": to.Ptr("1e8d8218-c5e7-4578-9acc-9abbd5d23315"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname": to.Ptr("John"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name": to.Ptr("admin@contoso.com"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier": to.Ptr("9vckmEGF7zDKk1YzIY8k0t1_EAPaXoeHyPRn6f413zM"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname": to.Ptr("Smith"), - // "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/upn": to.Ptr("admin@contoso.com"), - // "iat": to.Ptr("1421876371"), - // "iss": to.Ptr("https://sts.windows.net/72f988bf-86f1-41af-91ab-2d7cd011db47/"), - // "nbf": to.Ptr("1421876371"), - // "puid": to.Ptr("20030000801A118C"), - // "ver": to.Ptr("1.0"), - // }, - // CorrelationID: to.Ptr("1e121103-0ba6-4300-ac9d-952bb5d0c80f"), - // EventDataID: to.Ptr("44ade6b4-3813-45e6-ae27-7420a95fa2f8"), - // EventName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("End request"), - // Value: to.Ptr("EndRequest"), - // }, - // EventTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:26.979Z"); return t}()), - // HTTPRequest: &armmonitor.HTTPRequestInfo{ - // Method: to.Ptr("PUT"), - // ClientIPAddress: to.Ptr("192.168.35.115"), - // ClientRequestID: to.Ptr("27003b25-91d3-418f-8eb1-29e537dcb249"), - // }, - // ID: to.Ptr("/subscriptions/089bd33f-d4ec-47fe-8ba5-0753aa5c5b33/resourceGroups/MSSupportGroup/providers/microsoft.support/supporttickets/115012112305841/events/44ade6b4-3813-45e6-ae27-7420a95fa2f8/ticks/635574752669792776"), - // Level: to.Ptr(armmonitor.EventLevelInformational), - // OperationName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support/supporttickets/write"), - // Value: to.Ptr("microsoft.support/supporttickets/write"), - // }, - // Properties: map[string]*string{ - // "statusCode": to.Ptr("Created"), - // }, - // ResourceGroupName: to.Ptr("MSSupportGroup"), - // ResourceProviderName: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("microsoft.support"), - // Value: to.Ptr("microsoft.support"), - // }, - // Status: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Succeeded"), - // Value: to.Ptr("Succeeded"), - // }, - // SubStatus: &armmonitor.LocalizableString{ - // LocalizedValue: to.Ptr("Created (HTTP Status Code: 201)"), - // Value: to.Ptr("Created"), - // }, - // SubmissionTimestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2015-01-21T22:14:39.993Z"); return t}()), - // SubscriptionID: to.Ptr("089bd33f-d4ec-47fe-8ba5-0753aa5c5b33"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/monitor/armmonitor/time_rfc3339.go b/sdk/resourcemanager/monitor/armmonitor/time_rfc3339.go index b3823502263e..fb66e0b1a522 100644 --- a/sdk/resourcemanager/monitor/armmonitor/time_rfc3339.go +++ b/sdk/resourcemanager/monitor/armmonitor/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 @@ -84,72 +108,3 @@ func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) e *t = (*time.Time)(&aux) return nil } - -const ( - utcTimeJSON = `"15:04:05.999999999"` - utcTime = "15:04:05.999999999" - timeFormat = "15:04:05.999999999Z07:00" -) - -type timeRFC3339 time.Time - -func (t timeRFC3339) MarshalJSON() ([]byte, error) { - s, _ := t.MarshalText() - return []byte(fmt.Sprintf("\"%s\"", s)), nil -} - -func (t timeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return []byte(tt.Format(timeFormat)), nil -} - -func (t *timeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcTimeJSON - if tzOffsetRegex.Match(data) { - layout = timeFormat - } - return t.Parse(layout, string(data)) -} - -func (t *timeRFC3339) UnmarshalText(data []byte) error { - layout := utcTime - if tzOffsetRegex.Match(data) { - layout = timeFormat - } - return t.Parse(layout, string(data)) -} - -func (t *timeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = timeRFC3339(p) - return err -} - -func (t timeRFC3339) String() string { - tt := time.Time(t) - return tt.Format(timeFormat) -} - -func populateTimeRFC3339(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] = (*timeRFC3339)(t) -} - -func unpopulateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { - return nil - } - var aux timeRFC3339 - 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/monitor/armmonitor/vminsights_client.go b/sdk/resourcemanager/monitor/armmonitor/vminsights_client.go deleted file mode 100644 index 61aa48ba6fc2..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/vminsights_client.go +++ /dev/null @@ -1,92 +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 armmonitor - -import ( - "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "strings" -) - -// VMInsightsClient contains the methods for the VMInsights group. -// Don't use this type directly, use NewVMInsightsClient() instead. -type VMInsightsClient struct { - internal *arm.Client -} - -// NewVMInsightsClient creates a new instance of VMInsightsClient with the specified values. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewVMInsightsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*VMInsightsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &VMInsightsClient{ - internal: cl, - } - return client, nil -} - -// GetOnboardingStatus - Retrieves the VM Insights onboarding status for the specified resource or resource scope. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2018-11-27-preview -// - resourceURI - The fully qualified Azure Resource manager identifier of the resource, or scope, whose status to retrieve. -// - options - VMInsightsClientGetOnboardingStatusOptions contains the optional parameters for the VMInsightsClient.GetOnboardingStatus -// method. -func (client *VMInsightsClient) GetOnboardingStatus(ctx context.Context, resourceURI string, options *VMInsightsClientGetOnboardingStatusOptions) (VMInsightsClientGetOnboardingStatusResponse, error) { - var err error - const operationName = "VMInsightsClient.GetOnboardingStatus" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getOnboardingStatusCreateRequest(ctx, resourceURI, options) - if err != nil { - return VMInsightsClientGetOnboardingStatusResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return VMInsightsClientGetOnboardingStatusResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return VMInsightsClientGetOnboardingStatusResponse{}, err - } - resp, err := client.getOnboardingStatusHandleResponse(httpResp) - return resp, err -} - -// getOnboardingStatusCreateRequest creates the GetOnboardingStatus request. -func (client *VMInsightsClient) getOnboardingStatusCreateRequest(ctx context.Context, resourceURI string, options *VMInsightsClientGetOnboardingStatusOptions) (*policy.Request, error) { - urlPath := "/{resourceUri}/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default" - urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2018-11-27-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getOnboardingStatusHandleResponse handles the GetOnboardingStatus response. -func (client *VMInsightsClient) getOnboardingStatusHandleResponse(resp *http.Response) (VMInsightsClientGetOnboardingStatusResponse, error) { - result := VMInsightsClientGetOnboardingStatusResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.VMInsightsOnboardingStatus); err != nil { - return VMInsightsClientGetOnboardingStatusResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/monitor/armmonitor/vminsights_client_example_test.go b/sdk/resourcemanager/monitor/armmonitor/vminsights_client_example_test.go deleted file mode 100644 index 6834327911e3..000000000000 --- a/sdk/resourcemanager/monitor/armmonitor/vminsights_client_example_test.go +++ /dev/null @@ -1,219 +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 armmonitor_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusVMScaleSet.json -func ExampleVMInsightsClient_GetOnboardingStatus_getStatusForAVmScaleSetThatIsActivelyReportingData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVMInsightsClient().GetOnboardingStatus(ctx, "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/my-service-cluster/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-01", 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.VMInsightsOnboardingStatus = armmonitor.VMInsightsOnboardingStatus{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Insights/vmInsightsOnboardingStatuses"), - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/my-service-cluster/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-01/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default"), - // Properties: &armmonitor.VMInsightsOnboardingStatusProperties{ - // Data: []*armmonitor.DataContainer{ - // { - // Workspace: &armmonitor.WorkspaceInfo{ - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourcegroups/monitoring/providers/microsoft.operationalinsights/workspaces/vm-monitoring"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.WorkspaceInfoProperties{ - // CustomerID: to.Ptr("c7f8f44d-d8ee-4b79-9d9a-4d8a1f2a112a"), - // }, - // }, - // }}, - // DataStatus: to.Ptr(armmonitor.DataStatusPresent), - // OnboardingStatus: to.Ptr(armmonitor.OnboardingStatusOnboarded), - // ResourceID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/my-service-cluster/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-01"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusSingleVMUnknown.json -func ExampleVMInsightsClient_GetOnboardingStatus_getStatusForAVmThatHasNotYetReportedData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVMInsightsClient().GetOnboardingStatus(ctx, "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/vm-resource-group/providers/Microsoft.Compute/virtualMachines/ubuntu-vm", 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.VMInsightsOnboardingStatus = armmonitor.VMInsightsOnboardingStatus{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Insights/vmInsightsOnboardingStatuses"), - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/vm-resource-group/providers/Microsoft.Compute/virtualMachines/ubuntu-vm/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default"), - // Properties: &armmonitor.VMInsightsOnboardingStatusProperties{ - // Data: []*armmonitor.DataContainer{ - // }, - // DataStatus: to.Ptr(armmonitor.DataStatusNotPresent), - // OnboardingStatus: to.Ptr(armmonitor.OnboardingStatusUnknown), - // ResourceID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/vm-resource-group/providers/Microsoft.Compute/virtualMachines/ubuntu-vm"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusSingleVM.json -func ExampleVMInsightsClient_GetOnboardingStatus_getStatusForAVmThatIsActivelyReportingData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVMInsightsClient().GetOnboardingStatus(ctx, "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/vm-resource-group/providers/Microsoft.Compute/virtualMachines/ubuntu-vm", 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.VMInsightsOnboardingStatus = armmonitor.VMInsightsOnboardingStatus{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Insights/vmInsightsOnboardingStatuses"), - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/vm-resource-group/providers/Microsoft.Compute/virtualMachines/ubuntu-vm/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default"), - // Properties: &armmonitor.VMInsightsOnboardingStatusProperties{ - // Data: []*armmonitor.DataContainer{ - // { - // Workspace: &armmonitor.WorkspaceInfo{ - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourcegroups/monitoring/providers/microsoft.operationalinsights/workspaces/vm-monitoring"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.WorkspaceInfoProperties{ - // CustomerID: to.Ptr("c7f8f44d-d8ee-4b79-9d9a-4d8a1f2a112a"), - // }, - // }, - // }}, - // DataStatus: to.Ptr(armmonitor.DataStatusPresent), - // OnboardingStatus: to.Ptr(armmonitor.OnboardingStatusOnboarded), - // ResourceID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/vm-resource-group/providers/Microsoft.Compute/virtualMachines/ubuntu-vm"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusResourceGroup.json -func ExampleVMInsightsClient_GetOnboardingStatus_getStatusForAResourceGroupThatHasAtLeastOneVmThatIsActivelyReportingData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVMInsightsClient().GetOnboardingStatus(ctx, "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/resource-group-with-vms", 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.VMInsightsOnboardingStatus = armmonitor.VMInsightsOnboardingStatus{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Insights/vmInsightsOnboardingStatuses"), - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/resource-group-with-vms/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default"), - // Properties: &armmonitor.VMInsightsOnboardingStatusProperties{ - // Data: []*armmonitor.DataContainer{ - // { - // Workspace: &armmonitor.WorkspaceInfo{ - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourcegroups/monitoring/providers/microsoft.operationalinsights/workspaces/vm-monitoring"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.WorkspaceInfoProperties{ - // CustomerID: to.Ptr("c7f8f44d-d8ee-4b79-9d9a-4d8a1f2a112a"), - // }, - // }, - // }}, - // DataStatus: to.Ptr(armmonitor.DataStatusPresent), - // OnboardingStatus: to.Ptr(armmonitor.OnboardingStatusOnboarded), - // ResourceID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/resource-group-with-vms"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/969fd0c2634fbcc1975d7abe3749330a5145a97c/specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusSubscription.json -func ExampleVMInsightsClient_GetOnboardingStatus_getStatusForASubscriptionThatHasAtLeastOneVmThatIsActivelyReportingData() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armmonitor.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVMInsightsClient().GetOnboardingStatus(ctx, "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87", 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.VMInsightsOnboardingStatus = armmonitor.VMInsightsOnboardingStatus{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Insights/vmInsightsOnboardingStatuses"), - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default"), - // Properties: &armmonitor.VMInsightsOnboardingStatusProperties{ - // Data: []*armmonitor.DataContainer{ - // { - // Workspace: &armmonitor.WorkspaceInfo{ - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourcegroups/monitoring/providers/microsoft.operationalinsights/workspaces/vm-monitoring-secondary"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.WorkspaceInfoProperties{ - // CustomerID: to.Ptr("f096d163-206e-4abf-9db3-2c62af003d68"), - // }, - // }, - // }, - // { - // Workspace: &armmonitor.WorkspaceInfo{ - // ID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourcegroups/monitoring/providers/microsoft.operationalinsights/workspaces/vm-monitoring"), - // Location: to.Ptr("eastus"), - // Properties: &armmonitor.WorkspaceInfoProperties{ - // CustomerID: to.Ptr("c7f8f44d-d8ee-4b79-9d9a-4d8a1f2a112a"), - // }, - // }, - // }}, - // DataStatus: to.Ptr(armmonitor.DataStatusPresent), - // OnboardingStatus: to.Ptr(armmonitor.OnboardingStatusOnboarded), - // ResourceID: to.Ptr("/subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87"), - // }, - // } -} diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/CHANGELOG.md b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/CHANGELOG.md index 714bb7420d4a..7c4d69123a32 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/CHANGELOG.md +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.0.1 (2025-04-27) +### Other Changes + + ## 1.0.0 (2024-12-26) ### Breaking Changes diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/accountquotas_client.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/accountquotas_client.go index 2d4f2f8c6ed8..10909e113180 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/accountquotas_client.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/accountquotas_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. @@ -74,7 +71,7 @@ func (client *AccountQuotasClient) Get(ctx context.Context, resourceGroupName st } // getCreateRequest creates the Get request. -func (client *AccountQuotasClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, quotaName QuotaNames, options *AccountQuotasClientGetOptions) (*policy.Request, error) { +func (client *AccountQuotasClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, quotaName QuotaNames, _ *AccountQuotasClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas/{quotaName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -143,7 +140,7 @@ func (client *AccountQuotasClient) NewListByAccountPager(resourceGroupName strin } // listByAccountCreateRequest creates the ListByAccount request. -func (client *AccountQuotasClient) listByAccountCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *AccountQuotasClientListByAccountOptions) (*policy.Request, error) { +func (client *AccountQuotasClient) listByAccountCreateRequest(ctx context.Context, resourceGroupName string, accountName string, _ *AccountQuotasClientListByAccountOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}/quotas" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/accountquotas_client_example_test.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/accountquotas_client_example_test.go deleted file mode 100644 index 6c1287505870..000000000000 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/accountquotas_client_example_test.go +++ /dev/null @@ -1,111 +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 armplaywrighttesting_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/playwrighttesting/armplaywrighttesting" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/2bde125befabb21807a2021765901f20e3e74ec8/specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/stable/2024-12-01/examples/AccountQuotas_ListByAccount.json -func ExampleAccountQuotasClient_NewListByAccountPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armplaywrighttesting.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAccountQuotasClient().NewListByAccountPager("dummyrg", "myPlaywrightAccount", 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.AccountQuotaListResult = armplaywrighttesting.AccountQuotaListResult{ - // Value: []*armplaywrighttesting.AccountQuota{ - // { - // Name: to.Ptr("ScalableExecution"), - // Type: to.Ptr("Microsoft.AzurePlaywrightService/Accounts/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.AzurePlaywrightService/accounts/myPlaywrightAccount/quotas/ScalableExecution"), - // Properties: &armplaywrighttesting.AccountQuotaProperties{ - // FreeTrial: &armplaywrighttesting.AccountFreeTrialProperties{ - // AllocatedValue: to.Ptr[int32](0), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-31T10:19:36.081Z"); return t}()), - // ExpiryAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-31T10:19:36.081Z"); return t}()), - // PercentageUsed: to.Ptr[float32](100), - // UsedValue: to.Ptr[int32](0), - // }, - // ProvisioningState: to.Ptr(armplaywrighttesting.ProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("Reporting"), - // Type: to.Ptr("Microsoft.AzurePlaywrightService/Accounts/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.AzurePlaywrightService/accounts/myPlaywrightAccount/quotas/Reporting"), - // Properties: &armplaywrighttesting.AccountQuotaProperties{ - // FreeTrial: &armplaywrighttesting.AccountFreeTrialProperties{ - // AllocatedValue: to.Ptr[int32](0), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-31T10:19:36.081Z"); return t}()), - // ExpiryAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-31T10:19:36.081Z"); return t}()), - // PercentageUsed: to.Ptr[float32](100), - // UsedValue: to.Ptr[int32](0), - // }, - // ProvisioningState: to.Ptr(armplaywrighttesting.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/2bde125befabb21807a2021765901f20e3e74ec8/specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/stable/2024-12-01/examples/AccountQuotas_Get.json -func ExampleAccountQuotasClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armplaywrighttesting.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAccountQuotasClient().Get(ctx, "dummyrg", "myPlaywrightAccount", armplaywrighttesting.QuotaNamesScalableExecution, 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.AccountQuota = armplaywrighttesting.AccountQuota{ - // Name: to.Ptr("ScalableExecution"), - // Type: to.Ptr("Microsoft.AzurePlaywrightService/Accounts/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.AzurePlaywrightService/accounts/myPlaywrightAccount/quotas/ScalableExecution"), - // Properties: &armplaywrighttesting.AccountQuotaProperties{ - // FreeTrial: &armplaywrighttesting.AccountFreeTrialProperties{ - // AllocatedValue: to.Ptr[int32](0), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-31T10:19:36.081Z"); return t}()), - // ExpiryAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-31T10:19:36.081Z"); return t}()), - // PercentageUsed: to.Ptr[float32](100), - // UsedValue: to.Ptr[int32](0), - // }, - // ProvisioningState: to.Ptr(armplaywrighttesting.ProvisioningStateSucceeded), - // }, - // } -} diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/accounts_client.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/accounts_client.go index 1d753293495f..75e1dedc436e 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/accounts_client.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/accounts_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. @@ -74,7 +71,7 @@ func (client *AccountsClient) CheckNameAvailability(ctx context.Context, body Ch } // checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. -func (client *AccountsClient) checkNameAvailabilityCreateRequest(ctx context.Context, body CheckNameAvailabilityRequest, options *AccountsClientCheckNameAvailabilityOptions) (*policy.Request, error) { +func (client *AccountsClient) checkNameAvailabilityCreateRequest(ctx context.Context, body CheckNameAvailabilityRequest, _ *AccountsClientCheckNameAvailabilityOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/checkNameAvailability" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -156,7 +153,7 @@ func (client *AccountsClient) createOrUpdate(ctx context.Context, resourceGroupN } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *AccountsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, resource Account, options *AccountsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *AccountsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, resource Account, _ *AccountsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -235,7 +232,7 @@ func (client *AccountsClient) deleteOperation(ctx context.Context, resourceGroup } // deleteCreateRequest creates the Delete request. -func (client *AccountsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *AccountsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, _ *AccountsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -290,7 +287,7 @@ func (client *AccountsClient) Get(ctx context.Context, resourceGroupName string, } // getCreateRequest creates the Get request. -func (client *AccountsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *AccountsClientGetOptions) (*policy.Request, error) { +func (client *AccountsClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, _ *AccountsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -354,7 +351,7 @@ func (client *AccountsClient) NewListByResourceGroupPager(resourceGroupName stri } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *AccountsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AccountsClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *AccountsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *AccountsClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -413,7 +410,7 @@ func (client *AccountsClient) NewListBySubscriptionPager(options *AccountsClient } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *AccountsClient) listBySubscriptionCreateRequest(ctx context.Context, options *AccountsClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *AccountsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *AccountsClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/accounts" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -470,7 +467,7 @@ func (client *AccountsClient) Update(ctx context.Context, resourceGroupName stri } // updateCreateRequest creates the Update request. -func (client *AccountsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, properties AccountUpdate, options *AccountsClientUpdateOptions) (*policy.Request, error) { +func (client *AccountsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, accountName string, properties AccountUpdate, _ *AccountsClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzurePlaywrightService/accounts/{accountName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/accounts_client_example_test.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/accounts_client_example_test.go deleted file mode 100644 index 4da7390342c2..000000000000 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/accounts_client_example_test.go +++ /dev/null @@ -1,328 +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 armplaywrighttesting_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/playwrighttesting/armplaywrighttesting" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/2bde125befabb21807a2021765901f20e3e74ec8/specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/stable/2024-12-01/examples/Accounts_ListBySubscription.json -func ExampleAccountsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armplaywrighttesting.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAccountsClient().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.AccountListResult = armplaywrighttesting.AccountListResult{ - // Value: []*armplaywrighttesting.Account{ - // { - // Name: to.Ptr("myPlaywrightAccount"), - // Type: to.Ptr("Microsoft.AzurePlaywrightService/accounts"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.AzurePlaywrightService/accounts/myPlaywrightAccount"), - // SystemData: &armplaywrighttesting.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(armplaywrighttesting.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(armplaywrighttesting.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "Team": to.Ptr("Dev Exp"), - // }, - // Properties: &armplaywrighttesting.AccountProperties{ - // DashboardURI: to.Ptr("https://dashboard.00000000-0000-0000-0000-000000000000.domain.com"), - // LocalAuth: to.Ptr(armplaywrighttesting.EnablementStatusEnabled), - // ProvisioningState: to.Ptr(armplaywrighttesting.ProvisioningStateSucceeded), - // RegionalAffinity: to.Ptr(armplaywrighttesting.EnablementStatusEnabled), - // Reporting: to.Ptr(armplaywrighttesting.EnablementStatusEnabled), - // ScalableExecution: to.Ptr(armplaywrighttesting.EnablementStatusEnabled), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/2bde125befabb21807a2021765901f20e3e74ec8/specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/stable/2024-12-01/examples/Accounts_CheckNameAvailability.json -func ExampleAccountsClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armplaywrighttesting.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAccountsClient().CheckNameAvailability(ctx, armplaywrighttesting.CheckNameAvailabilityRequest{ - Name: to.Ptr("dummyName"), - Type: to.Ptr("Microsoft.AzurePlaywrightService/Accounts"), - }, 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.CheckNameAvailabilityResponse = armplaywrighttesting.CheckNameAvailabilityResponse{ - // Message: to.Ptr("Test message."), - // NameAvailable: to.Ptr(true), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/2bde125befabb21807a2021765901f20e3e74ec8/specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/stable/2024-12-01/examples/Accounts_ListByResourceGroup.json -func ExampleAccountsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armplaywrighttesting.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAccountsClient().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.AccountListResult = armplaywrighttesting.AccountListResult{ - // Value: []*armplaywrighttesting.Account{ - // { - // Name: to.Ptr("myPlaywrightAccount"), - // Type: to.Ptr("Microsoft.AzurePlaywrightService/accounts"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.AzurePlaywrightService/accounts/myPlaywrightAccount"), - // SystemData: &armplaywrighttesting.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(armplaywrighttesting.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(armplaywrighttesting.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "Team": to.Ptr("Dev Exp"), - // }, - // Properties: &armplaywrighttesting.AccountProperties{ - // DashboardURI: to.Ptr("https://dashboard.00000000-0000-0000-0000-000000000000.domain.com"), - // LocalAuth: to.Ptr(armplaywrighttesting.EnablementStatusEnabled), - // ProvisioningState: to.Ptr(armplaywrighttesting.ProvisioningStateSucceeded), - // RegionalAffinity: to.Ptr(armplaywrighttesting.EnablementStatusEnabled), - // Reporting: to.Ptr(armplaywrighttesting.EnablementStatusEnabled), - // ScalableExecution: to.Ptr(armplaywrighttesting.EnablementStatusEnabled), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/2bde125befabb21807a2021765901f20e3e74ec8/specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/stable/2024-12-01/examples/Accounts_Get.json -func ExampleAccountsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armplaywrighttesting.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAccountsClient().Get(ctx, "dummyrg", "myPlaywrightAccount", 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.Account = armplaywrighttesting.Account{ - // Name: to.Ptr("myPlaywrightAccount"), - // Type: to.Ptr("Microsoft.AzurePlaywrightService/accounts"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.AzurePlaywrightService/accounts/myPlaywrightAccount"), - // SystemData: &armplaywrighttesting.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(armplaywrighttesting.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(armplaywrighttesting.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "Team": to.Ptr("Dev Exp"), - // }, - // Properties: &armplaywrighttesting.AccountProperties{ - // DashboardURI: to.Ptr("https://dashboard.00000000-0000-0000-0000-000000000000.domain.com"), - // LocalAuth: to.Ptr(armplaywrighttesting.EnablementStatusEnabled), - // ProvisioningState: to.Ptr(armplaywrighttesting.ProvisioningStateSucceeded), - // RegionalAffinity: to.Ptr(armplaywrighttesting.EnablementStatusEnabled), - // Reporting: to.Ptr(armplaywrighttesting.EnablementStatusEnabled), - // ScalableExecution: to.Ptr(armplaywrighttesting.EnablementStatusEnabled), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/2bde125befabb21807a2021765901f20e3e74ec8/specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/stable/2024-12-01/examples/Accounts_CreateOrUpdate.json -func ExampleAccountsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armplaywrighttesting.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAccountsClient().BeginCreateOrUpdate(ctx, "dummyrg", "myPlaywrightAccount", armplaywrighttesting.Account{ - Location: to.Ptr("westus"), - Tags: map[string]*string{ - "Team": to.Ptr("Dev Exp"), - }, - Properties: &armplaywrighttesting.AccountProperties{ - RegionalAffinity: to.Ptr(armplaywrighttesting.EnablementStatusEnabled), - }, - }, 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.Account = armplaywrighttesting.Account{ - // Name: to.Ptr("myPlaywrightAccount"), - // Type: to.Ptr("Microsoft.AzurePlaywrightService/accounts"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.AzurePlaywrightService/accounts/myPlaywrightAccount"), - // SystemData: &armplaywrighttesting.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(armplaywrighttesting.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(armplaywrighttesting.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "Team": to.Ptr("Dev Exp"), - // }, - // Properties: &armplaywrighttesting.AccountProperties{ - // DashboardURI: to.Ptr("https://dashboard.00000000-0000-0000-0000-000000000000.domain.com"), - // LocalAuth: to.Ptr(armplaywrighttesting.EnablementStatusEnabled), - // ProvisioningState: to.Ptr(armplaywrighttesting.ProvisioningStateSucceeded), - // RegionalAffinity: to.Ptr(armplaywrighttesting.EnablementStatusEnabled), - // Reporting: to.Ptr(armplaywrighttesting.EnablementStatusEnabled), - // ScalableExecution: to.Ptr(armplaywrighttesting.EnablementStatusEnabled), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/2bde125befabb21807a2021765901f20e3e74ec8/specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/stable/2024-12-01/examples/Accounts_Update.json -func ExampleAccountsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armplaywrighttesting.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAccountsClient().Update(ctx, "dummyrg", "myPlaywrightAccount", armplaywrighttesting.AccountUpdate{ - Properties: &armplaywrighttesting.AccountUpdateProperties{ - RegionalAffinity: to.Ptr(armplaywrighttesting.EnablementStatusEnabled), - }, - 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) - } - // 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.Account = armplaywrighttesting.Account{ - // Name: to.Ptr("myPlaywrightAccount"), - // Type: to.Ptr("Microsoft.AzurePlaywrightService/accounts"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/dummyrg/providers/Microsoft.AzurePlaywrightService/accounts/myPlaywrightAccount"), - // SystemData: &armplaywrighttesting.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(armplaywrighttesting.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(armplaywrighttesting.CreatedByTypeUser), - // }, - // Location: to.Ptr("westus"), - // Tags: map[string]*string{ - // "Team": to.Ptr("Dev Exp"), - // }, - // Properties: &armplaywrighttesting.AccountProperties{ - // DashboardURI: to.Ptr("https://dashboard.00000000-0000-0000-0000-000000000000.domain.com"), - // LocalAuth: to.Ptr(armplaywrighttesting.EnablementStatusEnabled), - // ProvisioningState: to.Ptr(armplaywrighttesting.ProvisioningStateSucceeded), - // RegionalAffinity: to.Ptr(armplaywrighttesting.EnablementStatusEnabled), - // Reporting: to.Ptr(armplaywrighttesting.EnablementStatusEnabled), - // ScalableExecution: to.Ptr(armplaywrighttesting.EnablementStatusEnabled), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/2bde125befabb21807a2021765901f20e3e74ec8/specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/stable/2024-12-01/examples/Accounts_Delete.json -func ExampleAccountsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armplaywrighttesting.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAccountsClient().BeginDelete(ctx, "dummyrg", "myPlaywrightAccount", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/autorest.md b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/autorest.md index 1479dec27fae..bb3facbaba0d 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/autorest.md +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/2bde125befabb21807a2021765901f20e3e74ec8/specification/playwrighttesting/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/2bde125befabb21807a2021765901f20e3e74ec8/specification/playwrighttesting/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/playwrighttesting/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/playwrighttesting/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 -tag: package-2024-12-01 +module-version: 1.0.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/client_factory.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/client_factory.go index 8f5324dba41a..6bb31965c106 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/client_factory.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/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. diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/constants.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/constants.go index c5d9a632c800..1c3e70098e71 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/constants.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/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 armplaywrighttesting const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/playwrighttesting/armplaywrighttesting" - moduleVersion = "v1.0.0" + moduleVersion = "v1.0.1" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/accountquotas_server.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/accountquotas_server.go index aaeeb23aa185..e63df9939c3a 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/accountquotas_server.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/accountquotas_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. @@ -58,23 +55,42 @@ func (a *AccountQuotasServerTransport) Do(req *http.Request) (*http.Response, er return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - switch method { - case "AccountQuotasClient.Get": - resp, err = a.dispatchGet(req) - case "AccountQuotasClient.NewListByAccountPager": - resp, err = a.dispatchNewListByAccountPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *AccountQuotasServerTransport) 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 accountQuotasServerTransportInterceptor != nil { + res.resp, res.err, intercepted = accountQuotasServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AccountQuotasClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AccountQuotasClient.NewListByAccountPager": + res.resp, res.err = a.dispatchNewListByAccountPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *AccountQuotasServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -160,3 +176,9 @@ func (a *AccountQuotasServerTransport) dispatchNewListByAccountPager(req *http.R } return resp, nil } + +// set this to conditionally intercept incoming requests to AccountQuotasServerTransport +var accountQuotasServerTransportInterceptor 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/playwrighttesting/armplaywrighttesting/fake/accounts_server.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/accounts_server.go index 406361968301..d6111d29e01e 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/accounts_server.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/accounts_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. @@ -33,7 +30,7 @@ type AccountsServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, accountName string, resource armplaywrighttesting.Account, options *armplaywrighttesting.AccountsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armplaywrighttesting.AccountsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method AccountsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, accountName string, options *armplaywrighttesting.AccountsClientBeginDeleteOptions) (resp azfake.PollerResponder[armplaywrighttesting.AccountsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method AccountsClient.Get @@ -84,33 +81,52 @@ func (a *AccountsServerTransport) 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 a.dispatchToMethodFake(req, method) +} - switch method { - case "AccountsClient.CheckNameAvailability": - resp, err = a.dispatchCheckNameAvailability(req) - case "AccountsClient.BeginCreateOrUpdate": - resp, err = a.dispatchBeginCreateOrUpdate(req) - case "AccountsClient.BeginDelete": - resp, err = a.dispatchBeginDelete(req) - case "AccountsClient.Get": - resp, err = a.dispatchGet(req) - case "AccountsClient.NewListByResourceGroupPager": - resp, err = a.dispatchNewListByResourceGroupPager(req) - case "AccountsClient.NewListBySubscriptionPager": - resp, err = a.dispatchNewListBySubscriptionPager(req) - case "AccountsClient.Update": - resp, err = a.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *AccountsServerTransport) 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 accountsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = accountsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AccountsClient.CheckNameAvailability": + res.resp, res.err = a.dispatchCheckNameAvailability(req) + case "AccountsClient.BeginCreateOrUpdate": + res.resp, res.err = a.dispatchBeginCreateOrUpdate(req) + case "AccountsClient.BeginDelete": + res.resp, res.err = a.dispatchBeginDelete(req) + case "AccountsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AccountsClient.NewListByResourceGroupPager": + res.resp, res.err = a.dispatchNewListByResourceGroupPager(req) + case "AccountsClient.NewListBySubscriptionPager": + res.resp, res.err = a.dispatchNewListBySubscriptionPager(req) + case "AccountsClient.Update": + res.resp, res.err = a.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *AccountsServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { @@ -223,9 +239,9 @@ func (a *AccountsServerTransport) dispatchBeginDelete(req *http.Request) (*http. return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { a.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { a.beginDelete.remove(req) @@ -373,3 +389,9 @@ func (a *AccountsServerTransport) dispatchUpdate(req *http.Request) (*http.Respo } return resp, nil } + +// set this to conditionally intercept incoming requests to AccountsServerTransport +var accountsServerTransportInterceptor 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/playwrighttesting/armplaywrighttesting/fake/internal.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/internal.go index be04ff43d678..e3def49261ba 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/internal.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/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/playwrighttesting/armplaywrighttesting/fake/operations_server.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/operations_server.go index 7aeff67acad7..73712d2ef9fb 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/operations_server.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/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. @@ -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/playwrighttesting/armplaywrighttesting/fake/quotas_server.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/quotas_server.go index d21966504bf1..bae9a36597a2 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/quotas_server.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/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. @@ -58,23 +55,42 @@ 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.Get": - resp, err = q.dispatchGet(req) - case "QuotasClient.NewListBySubscriptionPager": - resp, err = q.dispatchNewListBySubscriptionPager(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.Get": + res.resp, res.err = q.dispatchGet(req) + case "QuotasClient.NewListBySubscriptionPager": + res.resp, res.err = q.dispatchNewListBySubscriptionPager(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) dispatchGet(req *http.Request) (*http.Response, error) { @@ -152,3 +168,9 @@ func (q *QuotasServerTransport) dispatchNewListBySubscriptionPager(req *http.Req } 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/playwrighttesting/armplaywrighttesting/fake/server_factory.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/server_factory.go index cbfc3bbc6cd1..2a61883ce9db 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/server_factory.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/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,10 +16,17 @@ import ( // ServerFactory is a fake server for instances of the armplaywrighttesting.ClientFactory type. type ServerFactory struct { + // AccountQuotasServer contains the fakes for client AccountQuotasClient AccountQuotasServer AccountQuotasServer - AccountsServer AccountsServer - OperationsServer OperationsServer - QuotasServer QuotasServer + + // AccountsServer contains the fakes for client AccountsClient + AccountsServer AccountsServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // 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/playwrighttesting/armplaywrighttesting/fake/time_rfc3339.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/time_rfc3339.go deleted file mode 100644 index 81f308b0d343..000000000000 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/fake/time_rfc3339.go +++ /dev/null @@ -1,110 +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 ( - utcDateTime = "2006-01-02T15:04:05.999999999" - utcDateTimeJSON = `"` + utcDateTime + `"` - utcDateTimeNoT = "2006-01-02 15:04:05.999999999" - utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` - dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` - dateTimeJSON = `"` + time.RFC3339Nano + `"` - dateTimeJSONNoT = `"` + dateTimeNoT + `"` -) - -type dateTimeRFC3339 time.Time - -func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalJSON() -} - -func (t dateTimeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalText() -} - -func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = dateTimeJSON - } else if tzOffset { - layout = dateTimeJSONNoT - } else if hasT { - layout = utcDateTimeJSON - } else { - layout = utcDateTimeJSONNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = time.RFC3339Nano - } else if tzOffset { - layout = dateTimeNoT - } else if hasT { - layout = utcDateTime - } else { - layout = utcDateTimeNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = dateTimeRFC3339(p) - return err -} - -func (t dateTimeRFC3339) String() string { - return time.Time(t).Format(time.RFC3339Nano) -} - -func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*dateTimeRFC3339)(t) -} - -func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || string(data) == "null" { - return nil - } - var aux dateTimeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/go.mod b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/go.mod index 5b603ea9189a..70501c531691 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/go.mod +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/playwrighttesting/a 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 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.2 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.36.0 // indirect golang.org/x/net v0.38.0 // indirect - golang.org/x/sys v0.31.0 // indirect golang.org/x/text v0.23.0 // indirect ) diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/go.sum b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/go.sum index 4bacf756f06c..4de695d9e23a 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/go.sum +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/go.sum @@ -1,44 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 h1:DSDNVxqkoXJiko6x8a90zidoYqnYYa6c1MTzDKzKkTo= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1/go.mod h1:zGqV2R4Cr/k8Uye5w+dgQ06WJtEcbQG/8J7BB6hnCr4= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 h1:F0gBpfdPLGsw+nsgk6aqqkZS1jiixa5WwFe3fk/T3Ys= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2/go.mod h1:SqINnQ9lVVdRlyC8cd1lCI0SdX4n2paeABd2K8ggfnE= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2 h1:yz1bePFlP5Vws5+8ez6T3HWXPmwOK7Yvq8QxDBD3SKY= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2/go.mod h1:Pa9ZNPuoNu/GztvBSKk9J1cDJW6vk/n0zLtV4mgd8N8= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= -github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 h1:oygO0locgZJe7PpYPXT5A29ZkwJaPqcva7BVeemZOZs= -github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= -github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= -github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8= -github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6 h1:IsMZxCuZqKuao2vNdfD82fjjgPLfyHLpR41Z88viRWs= -github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6/go.mod h1:3VeWNIJaW+O5xpRQbPp0Ybqu1vJd/pm7s2F473HRrkw= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E= -github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= -golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= -golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/models.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/models.go index 44bdcd0a6936..3b28dce2396b 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/models.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/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. @@ -63,7 +60,7 @@ type AccountListResult struct { // AccountProperties - Account resource properties. type AccountProperties struct { - // When enabled, this feature allows the workspace to use local auth(through access key) for authentication of test runs. + // When enabled, this feature allows the workspace to use local auth (through service access token) for executing operations. LocalAuth *EnablementStatus // This property sets the connection region for Playwright client workers to cloud-hosted browsers. If enabled, workers connect @@ -134,7 +131,7 @@ type AccountUpdate struct { // AccountUpdateProperties - The updatable properties of the Account. type AccountUpdateProperties struct { - // When enabled, this feature allows the workspace to use local auth(through access key) for authentication of test runs. + // When enabled, this feature allows the workspace to use local auth (through service access token) for executing operations. LocalAuth *EnablementStatus // This property sets the connection region for Playwright client workers to cloud-hosted browsers. If enabled, workers connect diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/models_serde.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/models_serde.go index 40ff005da6ed..2b61c283f410 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/models_serde.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/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. diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/operations_client.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/operations_client.go index ee87f7a9cca9..de357b8a183f 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/operations_client.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/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. @@ -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.AzurePlaywrightService/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/operations_client_example_test.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/operations_client_example_test.go deleted file mode 100644 index 67eb9ee70a76..000000000000 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/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 armplaywrighttesting_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/playwrighttesting/armplaywrighttesting" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/2bde125befabb21807a2021765901f20e3e74ec8/specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/stable/2024-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 := armplaywrighttesting.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 = armplaywrighttesting.OperationListResult{ - // Value: []*armplaywrighttesting.Operation{ - // { - // Name: to.Ptr("Microsoft.AzurePlaywrightService/accounts/Write"), - // Display: &armplaywrighttesting.OperationDisplay{ - // Description: to.Ptr("Set PlaywrightAccounts"), - // Operation: to.Ptr("Creates or updates the PlaywrightAccounts"), - // Provider: to.Ptr("Microsoft.AzurePlaywrightService"), - // Resource: to.Ptr("accounts"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzurePlaywrightService/accounts/Delete"), - // Display: &armplaywrighttesting.OperationDisplay{ - // Description: to.Ptr("Delete PlaywrightAccounts"), - // Operation: to.Ptr("Deletes the PlaywrightAccounts"), - // Provider: to.Ptr("Microsoft.AzurePlaywrightService"), - // Resource: to.Ptr("accounts"), - // }, - // IsDataAction: to.Ptr(false), - // }, - // { - // Name: to.Ptr("Microsoft.AzurePlaywrightService/accounts/Read"), - // Display: &armplaywrighttesting.OperationDisplay{ - // Description: to.Ptr("Read PlaywrightAccounts"), - // Operation: to.Ptr("Reads the PlaywrightAccounts"), - // Provider: to.Ptr("Microsoft.AzurePlaywrightService"), - // Resource: to.Ptr("accounts"), - // }, - // IsDataAction: to.Ptr(false), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/options.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/options.go index 44020bef05cb..59d2e8877f34 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/options.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/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. @@ -21,13 +18,13 @@ type AccountQuotasClientListByAccountOptions struct { // AccountsClientBeginCreateOrUpdateOptions contains the optional parameters for the AccountsClient.BeginCreateOrUpdate method. type AccountsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // AccountsClientBeginDeleteOptions contains the optional parameters for the AccountsClient.BeginDelete method. type AccountsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/quotas_client.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/quotas_client.go index 2426e4eac1de..c941c147ba86 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/quotas_client.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/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. @@ -73,7 +70,7 @@ func (client *QuotasClient) Get(ctx context.Context, location string, quotaName } // getCreateRequest creates the Get request. -func (client *QuotasClient) getCreateRequest(ctx context.Context, location string, quotaName QuotaNames, options *QuotasClientGetOptions) (*policy.Request, error) { +func (client *QuotasClient) getCreateRequest(ctx context.Context, location string, quotaName QuotaNames, _ *QuotasClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas/{quotaName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -137,7 +134,7 @@ func (client *QuotasClient) NewListBySubscriptionPager(location string, options } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *QuotasClient) listBySubscriptionCreateRequest(ctx context.Context, location string, options *QuotasClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *QuotasClient) listBySubscriptionCreateRequest(ctx context.Context, location string, _ *QuotasClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.AzurePlaywrightService/locations/{location}/quotas" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/quotas_client_example_test.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/quotas_client_example_test.go deleted file mode 100644 index a04917a4089d..000000000000 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/quotas_client_example_test.go +++ /dev/null @@ -1,105 +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 armplaywrighttesting_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/playwrighttesting/armplaywrighttesting" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/2bde125befabb21807a2021765901f20e3e74ec8/specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/stable/2024-12-01/examples/Quotas_ListBySubscription.json -func ExampleQuotasClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armplaywrighttesting.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewQuotasClient().NewListBySubscriptionPager("eastus", 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.QuotaListResult = armplaywrighttesting.QuotaListResult{ - // Value: []*armplaywrighttesting.Quota{ - // { - // Name: to.Ptr("ScalableExecution"), - // Type: to.Ptr("Microsoft.AzurePlaywrightService/Locations/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.AzurePlaywrightService/locations/eastus/quotas/ScalableExecution"), - // Properties: &armplaywrighttesting.QuotaProperties{ - // FreeTrial: &armplaywrighttesting.FreeTrialProperties{ - // AccountID: to.Ptr("3fa85f64-5717-4562-b3fc-2c963f66afa6"), - // State: to.Ptr(armplaywrighttesting.FreeTrialStateActive), - // }, - // OfferingType: to.Ptr(armplaywrighttesting.OfferingTypeNotApplicable), - // ProvisioningState: to.Ptr(armplaywrighttesting.ProvisioningStateSucceeded), - // }, - // }, - // { - // Name: to.Ptr("Reporting"), - // Type: to.Ptr("Microsoft.AzurePlaywrightService/Locations/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.AzurePlaywrightService/locations/eastus/quotas/Reporting"), - // Properties: &armplaywrighttesting.QuotaProperties{ - // FreeTrial: &armplaywrighttesting.FreeTrialProperties{ - // AccountID: to.Ptr("3fa85f64-5717-4562-b3fc-2c963f66afa6"), - // State: to.Ptr(armplaywrighttesting.FreeTrialStateActive), - // }, - // OfferingType: to.Ptr(armplaywrighttesting.OfferingTypePrivatePreview), - // ProvisioningState: to.Ptr(armplaywrighttesting.ProvisioningStateSucceeded), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/2bde125befabb21807a2021765901f20e3e74ec8/specification/playwrighttesting/resource-manager/Microsoft.AzurePlaywrightService/stable/2024-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 := armplaywrighttesting.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewQuotasClient().Get(ctx, "eastus", armplaywrighttesting.QuotaNamesScalableExecution, 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.Quota = armplaywrighttesting.Quota{ - // Name: to.Ptr("ScalableExecution"), - // Type: to.Ptr("Microsoft.AzurePlaywrightService/Locations/Quotas"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.AzurePlaywrightService/locations/eastus/quotas/ScalableExecution"), - // Properties: &armplaywrighttesting.QuotaProperties{ - // FreeTrial: &armplaywrighttesting.FreeTrialProperties{ - // AccountID: to.Ptr("3fa85f64-5717-4562-b3fc-2c963f66afa6"), - // State: to.Ptr(armplaywrighttesting.FreeTrialStateActive), - // }, - // OfferingType: to.Ptr(armplaywrighttesting.OfferingTypeNotApplicable), - // ProvisioningState: to.Ptr(armplaywrighttesting.ProvisioningStateSucceeded), - // }, - // } -} diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/responses.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/responses.go index 66f882cdd186..8c4c57be5737 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/responses.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/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. diff --git a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/time_rfc3339.go b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/time_rfc3339.go index 8b01a8334f23..1c6fb65bc407 100644 --- a/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/time_rfc3339.go +++ b/sdk/resourcemanager/playwrighttesting/armplaywrighttesting/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. @@ -60,6 +57,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/CHANGELOG.md b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/CHANGELOG.md index b1718bc8b92b..0c5a8c14e0f5 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/CHANGELOG.md +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/CHANGELOG.md @@ -1,5 +1,262 @@ # Release History +## 1.0.0 (2025-04-27) +### Breaking Changes + +- Function `*ProtectedItemClient.BeginPlannedFailover` parameter(s) have been changed from `(context.Context, string, string, string, *ProtectedItemClientBeginPlannedFailoverOptions)` to `(context.Context, string, string, string, PlannedFailoverModel, *ProtectedItemClientBeginPlannedFailoverOptions)` +- Type of `EmailConfigurationModel.SystemData` has been changed from `*EmailConfigurationModelSystemData` to `*SystemData` +- Type of `EventModel.SystemData` has been changed from `*EventModelSystemData` to `*SystemData` +- Type of `FabricModel.SystemData` has been changed from `*FabricModelSystemData` to `*SystemData` +- Type of `FabricModelUpdate.SystemData` has been changed from `*FabricModelUpdateSystemData` to `*SystemData` +- Type of `PolicyModel.SystemData` has been changed from `*PolicyModelSystemData` to `*SystemData` +- Type of `ProtectedItemModel.SystemData` has been changed from `*ProtectedItemModelSystemData` to `*SystemData` +- Type of `ProtectedItemModelProperties.CurrentJob` has been changed from `*ProtectedItemModelPropertiesCurrentJob` to `*ProtectedItemJobProperties` +- Type of `ProtectedItemModelProperties.LastFailedEnableProtectionJob` has been changed from `*ProtectedItemModelPropertiesLastFailedEnableProtectionJob` to `*ProtectedItemJobProperties` +- Type of `ProtectedItemModelProperties.LastFailedPlannedFailoverJob` has been changed from `*ProtectedItemModelPropertiesLastFailedPlannedFailoverJob` to `*ProtectedItemJobProperties` +- Type of `ProtectedItemModelProperties.LastTestFailoverJob` has been changed from `*ProtectedItemModelPropertiesLastTestFailoverJob` to `*ProtectedItemJobProperties` +- Type of `RecoveryPointModel.SystemData` has been changed from `*RecoveryPointModelSystemData` to `*SystemData` +- Type of `ReplicationExtensionModel.SystemData` has been changed from `*ReplicationExtensionModelSystemData` to `*SystemData` +- Type of `VaultModel.SystemData` has been changed from `*VaultModelSystemData` to `*SystemData` +- Type of `VaultModelUpdate.SystemData` has been changed from `*VaultModelUpdateSystemData` to `*SystemData` +- Enum `WorkflowObjectType` has been removed +- Enum `WorkflowState` has been removed +- Function `NewAzureSiteRecoveryManagementServiceAPIClient` has been removed +- Function `*AzureSiteRecoveryManagementServiceAPIClient.CheckNameAvailability` has been removed +- Function `*AzureSiteRecoveryManagementServiceAPIClient.DeploymentPreflight` has been removed +- Function `*ClientFactory.NewAzureSiteRecoveryManagementServiceAPIClient` has been removed +- Function `*ClientFactory.NewDraClient` has been removed +- Function `*ClientFactory.NewDraOperationStatusClient` has been removed +- Function `*ClientFactory.NewFabricOperationsStatusClient` has been removed +- Function `*ClientFactory.NewPolicyOperationStatusClient` has been removed +- Function `*ClientFactory.NewProtectedItemOperationStatusClient` has been removed +- Function `*ClientFactory.NewRecoveryPointsClient` has been removed +- Function `*ClientFactory.NewReplicationExtensionOperationStatusClient` has been removed +- Function `*ClientFactory.NewVaultOperationStatusClient` has been removed +- Function `*ClientFactory.NewWorkflowClient` has been removed +- Function `*ClientFactory.NewWorkflowOperationStatusClient` has been removed +- Function `NewDraClient` has been removed +- Function `*DraClient.BeginCreate` has been removed +- Function `*DraClient.BeginDelete` has been removed +- Function `*DraClient.Get` has been removed +- Function `*DraClient.NewListPager` has been removed +- Function `*DraModelCustomProperties.GetDraModelCustomProperties` has been removed +- Function `NewDraOperationStatusClient` has been removed +- Function `*DraOperationStatusClient.Get` has been removed +- Function `NewFabricOperationsStatusClient` has been removed +- Function `*FabricOperationsStatusClient.Get` has been removed +- Function `*FailoverWorkflowModelCustomProperties.GetWorkflowModelCustomProperties` has been removed +- Function `NewPolicyOperationStatusClient` has been removed +- Function `*PolicyOperationStatusClient.Get` has been removed +- Function `NewProtectedItemOperationStatusClient` has been removed +- Function `*ProtectedItemOperationStatusClient.Get` has been removed +- Function `NewRecoveryPointsClient` has been removed +- Function `*RecoveryPointsClient.Get` has been removed +- Function `*RecoveryPointsClient.NewListPager` has been removed +- Function `NewReplicationExtensionOperationStatusClient` has been removed +- Function `*ReplicationExtensionOperationStatusClient.Get` has been removed +- Function `*TestFailoverCleanupWorkflowModelCustomProperties.GetWorkflowModelCustomProperties` has been removed +- Function `*TestFailoverWorkflowModelCustomProperties.GetWorkflowModelCustomProperties` has been removed +- Function `*VMwareDraModelCustomProperties.GetDraModelCustomProperties` has been removed +- Function `NewVaultOperationStatusClient` has been removed +- Function `*VaultOperationStatusClient.Get` has been removed +- Function `NewWorkflowClient` has been removed +- Function `*WorkflowClient.Get` has been removed +- Function `*WorkflowClient.NewListPager` has been removed +- Function `*WorkflowModelCustomProperties.GetWorkflowModelCustomProperties` has been removed +- Function `NewWorkflowOperationStatusClient` has been removed +- Function `*WorkflowOperationStatusClient.Get` has been removed +- Struct `DraModel` has been removed +- Struct `DraModelCollection` has been removed +- Struct `DraModelProperties` has been removed +- Struct `DraModelSystemData` has been removed +- Struct `EmailConfigurationModelCollection` has been removed +- Struct `EmailConfigurationModelSystemData` has been removed +- Struct `EventModelCollection` has been removed +- Struct `EventModelSystemData` has been removed +- Struct `FabricModelCollection` has been removed +- Struct `FabricModelSystemData` has been removed +- Struct `FabricModelUpdateSystemData` has been removed +- Struct `FailoverWorkflowModelCustomProperties` has been removed +- Struct `PolicyModelCollection` has been removed +- Struct `PolicyModelSystemData` has been removed +- Struct `ProtectedItemModelCollection` has been removed +- Struct `ProtectedItemModelPropertiesCurrentJob` has been removed +- Struct `ProtectedItemModelPropertiesLastFailedEnableProtectionJob` has been removed +- Struct `ProtectedItemModelPropertiesLastFailedPlannedFailoverJob` has been removed +- Struct `ProtectedItemModelPropertiesLastTestFailoverJob` has been removed +- Struct `ProtectedItemModelSystemData` has been removed +- Struct `RecoveryPointModelCollection` has been removed +- Struct `RecoveryPointModelSystemData` has been removed +- Struct `ReplicationExtensionModelCollection` has been removed +- Struct `ReplicationExtensionModelSystemData` has been removed +- Struct `TestFailoverCleanupWorkflowModelCustomProperties` has been removed +- Struct `TestFailoverWorkflowModelCustomProperties` has been removed +- Struct `VMwareDraModelCustomProperties` has been removed +- Struct `VaultModelCollection` has been removed +- Struct `VaultModelSystemData` has been removed +- Struct `VaultModelUpdateSystemData` has been removed +- Struct `WorkflowModel` has been removed +- Struct `WorkflowModelCollection` has been removed +- Struct `WorkflowModelProperties` has been removed +- Struct `WorkflowModelSystemData` has been removed +- Field `EmailConfigurationModelCollection` of struct `EmailConfigurationClientListResponse` has been removed +- Field `Filter` of struct `EventClientListOptions` has been removed +- Field `EventModelCollection` of struct `EventClientListResponse` has been removed +- Field `ContinuationToken` of struct `FabricClientListBySubscriptionOptions` has been removed +- Field `FabricModelCollection` of struct `FabricClientListBySubscriptionResponse` has been removed +- Field `FabricModelCollection` of struct `FabricClientListResponse` has been removed +- Field `SourceDraName`, `TargetDraName` of struct `HyperVToAzStackHCIProtectedItemModelCustomProperties` has been removed +- Field `PolicyModelCollection` of struct `PolicyClientListResponse` has been removed +- Field `Body` of struct `ProtectedItemClientBeginPlannedFailoverOptions` has been removed +- Field `ProtectedItemModelCollection` of struct `ProtectedItemClientListResponse` has been removed +- Field `DraID`, `TargetDraID` of struct `ProtectedItemModelProperties` has been removed +- Field `ReplicationExtensionModelCollection` of struct `ReplicationExtensionClientListResponse` has been removed +- Field `ChildrenWorkflows` of struct `TaskModel` has been removed +- Field `SourceDraName`, `TargetDraName` of struct `VMwareToAzStackHCIProtectedItemModelCustomProperties` has been removed +- Field `ContinuationToken` of struct `VaultClientListBySubscriptionOptions` has been removed +- Field `VaultModelCollection` of struct `VaultClientListBySubscriptionResponse` has been removed +- Field `VaultModelCollection` of struct `VaultClientListResponse` has been removed + +### Features Added + +- New enum type `CreatedByType` with values `CreatedByTypeApplication`, `CreatedByTypeKey`, `CreatedByTypeManagedIdentity`, `CreatedByTypeUser` +- New enum type `JobObjectType` with values `JobObjectTypeAvsDiskPool`, `JobObjectTypeFabric`, `JobObjectTypeFabricAgent`, `JobObjectTypePolicy`, `JobObjectTypeProtectedItem`, `JobObjectTypeRecoveryPlan`, `JobObjectTypeReplicationExtension`, `JobObjectTypeVault` +- New enum type `JobState` with values `JobStateCancelled`, `JobStateCancelling`, `JobStateCompletedWithErrors`, `JobStateCompletedWithInformation`, `JobStateCompletedWithWarnings`, `JobStateFailed`, `JobStatePending`, `JobStateStarted`, `JobStateSucceeded` +- New enum type `ManagedServiceIdentityType` with values `ManagedServiceIdentityTypeNone`, `ManagedServiceIdentityTypeSystemAssigned`, `ManagedServiceIdentityTypeSystemAssignedUserAssigned`, `ManagedServiceIdentityTypeUserAssigned` +- New enum type `PrivateEndpointConnectionStatus` with values `PrivateEndpointConnectionStatusApproved`, `PrivateEndpointConnectionStatusDisconnected`, `PrivateEndpointConnectionStatusPending`, `PrivateEndpointConnectionStatusRejected` +- New enum type `VaultIdentityType` with values `VaultIdentityTypeNone`, `VaultIdentityTypeSystemAssigned`, `VaultIdentityTypeUserAssigned` +- New function `NewCheckNameAvailabilityClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CheckNameAvailabilityClient, error)` +- New function `*CheckNameAvailabilityClient.Post(context.Context, string, *CheckNameAvailabilityClientPostOptions) (CheckNameAvailabilityClientPostResponse, error)` +- New function `*ClientFactory.NewCheckNameAvailabilityClient() *CheckNameAvailabilityClient` +- New function `*ClientFactory.NewDeploymentPreflightClient() *DeploymentPreflightClient` +- New function `*ClientFactory.NewFabricAgentClient() *FabricAgentClient` +- New function `*ClientFactory.NewJobClient() *JobClient` +- New function `*ClientFactory.NewLocationBasedOperationResultsClient() *LocationBasedOperationResultsClient` +- New function `*ClientFactory.NewOperationResultsClient() *OperationResultsClient` +- New function `*ClientFactory.NewPrivateEndpointConnectionProxiesClient() *PrivateEndpointConnectionProxiesClient` +- New function `*ClientFactory.NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient` +- New function `*ClientFactory.NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient` +- New function `*ClientFactory.NewRecoveryPointClient() *RecoveryPointClient` +- New function `NewDeploymentPreflightClient(string, azcore.TokenCredential, *arm.ClientOptions) (*DeploymentPreflightClient, error)` +- New function `*DeploymentPreflightClient.Post(context.Context, string, string, *DeploymentPreflightClientPostOptions) (DeploymentPreflightClientPostResponse, error)` +- New function `NewFabricAgentClient(string, azcore.TokenCredential, *arm.ClientOptions) (*FabricAgentClient, error)` +- New function `*FabricAgentClient.BeginCreate(context.Context, string, string, string, FabricAgentModel, *FabricAgentClientBeginCreateOptions) (*runtime.Poller[FabricAgentClientCreateResponse], error)` +- New function `*FabricAgentClient.BeginDelete(context.Context, string, string, string, *FabricAgentClientBeginDeleteOptions) (*runtime.Poller[FabricAgentClientDeleteResponse], error)` +- New function `*FabricAgentClient.Get(context.Context, string, string, string, *FabricAgentClientGetOptions) (FabricAgentClientGetResponse, error)` +- New function `*FabricAgentClient.NewListPager(string, string, *FabricAgentClientListOptions) *runtime.Pager[FabricAgentClientListResponse]` +- New function `*FabricAgentModelCustomProperties.GetFabricAgentModelCustomProperties() *FabricAgentModelCustomProperties` +- New function `*FailoverJobModelCustomProperties.GetJobModelCustomProperties() *JobModelCustomProperties` +- New function `*HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate.GetProtectedItemModelCustomPropertiesUpdate() *ProtectedItemModelCustomPropertiesUpdate` +- New function `NewJobClient(string, azcore.TokenCredential, *arm.ClientOptions) (*JobClient, error)` +- New function `*JobClient.Get(context.Context, string, string, string, *JobClientGetOptions) (JobClientGetResponse, error)` +- New function `*JobClient.NewListPager(string, string, *JobClientListOptions) *runtime.Pager[JobClientListResponse]` +- New function `*JobModelCustomProperties.GetJobModelCustomProperties() *JobModelCustomProperties` +- New function `NewLocationBasedOperationResultsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*LocationBasedOperationResultsClient, error)` +- New function `*LocationBasedOperationResultsClient.Get(context.Context, string, string, string, *LocationBasedOperationResultsClientGetOptions) (LocationBasedOperationResultsClientGetResponse, error)` +- New function `NewOperationResultsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*OperationResultsClient, error)` +- New function `*OperationResultsClient.Get(context.Context, string, string, *OperationResultsClientGetOptions) (OperationResultsClientGetResponse, error)` +- New function `NewPrivateEndpointConnectionProxiesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*PrivateEndpointConnectionProxiesClient, error)` +- New function `*PrivateEndpointConnectionProxiesClient.Create(context.Context, string, string, string, PrivateEndpointConnectionProxy, *PrivateEndpointConnectionProxiesClientCreateOptions) (PrivateEndpointConnectionProxiesClientCreateResponse, error)` +- New function `*PrivateEndpointConnectionProxiesClient.BeginDelete(context.Context, string, string, string, *PrivateEndpointConnectionProxiesClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionProxiesClientDeleteResponse], error)` +- New function `*PrivateEndpointConnectionProxiesClient.Get(context.Context, string, string, string, *PrivateEndpointConnectionProxiesClientGetOptions) (PrivateEndpointConnectionProxiesClientGetResponse, error)` +- New function `*PrivateEndpointConnectionProxiesClient.NewListPager(string, string, *PrivateEndpointConnectionProxiesClientListOptions) *runtime.Pager[PrivateEndpointConnectionProxiesClientListResponse]` +- New function `*PrivateEndpointConnectionProxiesClient.Validate(context.Context, string, string, string, PrivateEndpointConnectionProxy, *PrivateEndpointConnectionProxiesClientValidateOptions) (PrivateEndpointConnectionProxiesClientValidateResponse, error)` +- New function `NewPrivateEndpointConnectionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error)` +- New function `*PrivateEndpointConnectionsClient.BeginDelete(context.Context, string, string, string, *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error)` +- New function `*PrivateEndpointConnectionsClient.Get(context.Context, string, string, string, *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error)` +- New function `*PrivateEndpointConnectionsClient.NewListPager(string, string, *PrivateEndpointConnectionsClientListOptions) *runtime.Pager[PrivateEndpointConnectionsClientListResponse]` +- New function `*PrivateEndpointConnectionsClient.Update(context.Context, string, string, string, PrivateEndpointConnection, *PrivateEndpointConnectionsClientUpdateOptions) (PrivateEndpointConnectionsClientUpdateResponse, error)` +- New function `NewPrivateLinkResourcesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*PrivateLinkResourcesClient, error)` +- New function `*PrivateLinkResourcesClient.Get(context.Context, string, string, string, *PrivateLinkResourcesClientGetOptions) (PrivateLinkResourcesClientGetResponse, error)` +- New function `*PrivateLinkResourcesClient.NewListPager(string, string, *PrivateLinkResourcesClientListOptions) *runtime.Pager[PrivateLinkResourcesClientListResponse]` +- New function `*ProtectedItemClient.BeginUpdate(context.Context, string, string, string, ProtectedItemModelUpdate, *ProtectedItemClientBeginUpdateOptions) (*runtime.Poller[ProtectedItemClientUpdateResponse], error)` +- New function `*ProtectedItemModelCustomPropertiesUpdate.GetProtectedItemModelCustomPropertiesUpdate() *ProtectedItemModelCustomPropertiesUpdate` +- New function `NewRecoveryPointClient(string, azcore.TokenCredential, *arm.ClientOptions) (*RecoveryPointClient, error)` +- New function `*RecoveryPointClient.Get(context.Context, string, string, string, string, *RecoveryPointClientGetOptions) (RecoveryPointClientGetResponse, error)` +- New function `*RecoveryPointClient.NewListPager(string, string, string, *RecoveryPointClientListOptions) *runtime.Pager[RecoveryPointClientListResponse]` +- New function `*TestFailoverCleanupJobModelCustomProperties.GetJobModelCustomProperties() *JobModelCustomProperties` +- New function `*TestFailoverJobModelCustomProperties.GetJobModelCustomProperties() *JobModelCustomProperties` +- New function `*VMwareFabricAgentModelCustomProperties.GetFabricAgentModelCustomProperties() *FabricAgentModelCustomProperties` +- New function `*VMwareToAzStackHCIEventModelCustomProperties.GetEventModelCustomProperties() *EventModelCustomProperties` +- New function `*VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate.GetProtectedItemModelCustomPropertiesUpdate() *ProtectedItemModelCustomPropertiesUpdate` +- New function `*VMwareToAzStackHCIRecoveryPointModelCustomProperties.GetRecoveryPointModelCustomProperties() *RecoveryPointModelCustomProperties` +- New struct `ConnectionDetails` +- New struct `DiskControllerInputs` +- New struct `EmailConfigurationModelListResult` +- New struct `EventModelListResult` +- New struct `FabricAgentModel` +- New struct `FabricAgentModelListResult` +- New struct `FabricAgentModelProperties` +- New struct `FabricModelListResult` +- New struct `FailoverJobModelCustomProperties` +- New struct `GroupConnectivityInformation` +- New struct `HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate` +- New struct `JobModel` +- New struct `JobModelCustomPropertiesAffectedObjectDetails` +- New struct `JobModelListResult` +- New struct `JobModelProperties` +- New struct `ManagedServiceIdentity` +- New struct `PolicyModelListResult` +- New struct `PrivateEndpoint` +- New struct `PrivateEndpointConnection` +- New struct `PrivateEndpointConnectionListResult` +- New struct `PrivateEndpointConnectionProxy` +- New struct `PrivateEndpointConnectionProxyListResult` +- New struct `PrivateEndpointConnectionProxyProperties` +- New struct `PrivateEndpointConnectionResponseProperties` +- New struct `PrivateLinkResource` +- New struct `PrivateLinkResourceListResult` +- New struct `PrivateLinkResourceProperties` +- New struct `PrivateLinkServiceConnection` +- New struct `PrivateLinkServiceConnectionState` +- New struct `PrivateLinkServiceProxy` +- New struct `ProtectedItemJobProperties` +- New struct `ProtectedItemModelListResult` +- New struct `ProtectedItemModelPropertiesUpdate` +- New struct `ProtectedItemModelUpdate` +- New struct `RecoveryPointModelListResult` +- New struct `RemotePrivateEndpoint` +- New struct `RemotePrivateEndpointConnection` +- New struct `ReplicationExtensionModelListResult` +- New struct `SystemData` +- New struct `TestFailoverCleanupJobModelCustomProperties` +- New struct `TestFailoverJobModelCustomProperties` +- New struct `UserAssignedIdentity` +- New struct `VMwareFabricAgentModelCustomProperties` +- New struct `VMwareToAzStackHCIEventModelCustomProperties` +- New struct `VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate` +- New struct `VMwareToAzStackHCIRecoveryPointModelCustomProperties` +- New struct `VaultIdentityModel` +- New struct `VaultModelListResult` +- New field `Properties` in struct `DeploymentPreflightResource` +- New anonymous field `EmailConfigurationModelListResult` in struct `EmailConfigurationClientListResponse` +- New field `ProvisioningState` in struct `EmailConfigurationModelProperties` +- New field `ODataOptions`, `PageSize` in struct `EventClientListOptions` +- New anonymous field `EventModelListResult` in struct `EventClientListResponse` +- New field `ProvisioningState` in struct `EventModelProperties` +- New anonymous field `FabricModelListResult` in struct `FabricClientListBySubscriptionResponse` +- New anonymous field `FabricModelListResult` in struct `FabricClientListResponse` +- New field `DiskBlockSize`, `DiskController`, `DiskIdentifier`, `DiskLogicalSectorSize`, `DiskPhysicalSectorSize` in struct `HyperVToAzStackHCIDiskInput` +- New field `IsMacMigrationEnabled`, `IsStaticIPMigrationEnabled` in struct `HyperVToAzStackHCINicInput` +- New field `DiskBlockSize`, `DiskLogicalSectorSize`, `DiskPhysicalSectorSize` in struct `HyperVToAzStackHCIProtectedDiskProperties` +- New field `SourceFabricAgentName`, `TargetFabricAgentName` in struct `HyperVToAzStackHCIProtectedItemModelCustomProperties` +- New anonymous field `PolicyModelListResult` in struct `PolicyClientListResponse` +- New field `ContinuationToken`, `ODataOptions`, `PageSize` in struct `ProtectedItemClientListOptions` +- New anonymous field `ProtectedItemModelListResult` in struct `ProtectedItemClientListResponse` +- New field `FabricAgentID`, `TargetFabricAgentID` in struct `ProtectedItemModelProperties` +- New field `ProvisioningState` in struct `RecoveryPointModelProperties` +- New anonymous field `ReplicationExtensionModelListResult` in struct `ReplicationExtensionClientListResponse` +- New field `ChildrenJobs` in struct `TaskModel` +- New field `DiskBlockSize`, `DiskController`, `DiskIdentifier`, `DiskLogicalSectorSize`, `DiskPhysicalSectorSize` in struct `VMwareToAzStackHCIDiskInput` +- New field `IsMacMigrationEnabled`, `IsStaticIPMigrationEnabled` in struct `VMwareToAzStackHCINicInput` +- New field `DiskBlockSize`, `DiskLogicalSectorSize`, `DiskPhysicalSectorSize` in struct `VMwareToAzStackHCIProtectedDiskProperties` +- New field `SourceFabricAgentName`, `TargetFabricAgentName` in struct `VMwareToAzStackHCIProtectedItemModelCustomProperties` +- New anonymous field `VaultModelListResult` in struct `VaultClientListBySubscriptionResponse` +- New anonymous field `VaultModelListResult` in struct `VaultClientListResponse` +- New field `Identity` in struct `VaultModel` +- New field `Identity` in struct `VaultModelUpdate` + + ## 0.2.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/README.md b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/README.md index ff396a9bbd04..90230626d4de 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/README.md +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/README.md @@ -55,7 +55,7 @@ clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory(", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureSiteRecoveryManagementServiceAPIClient().CheckNameAvailability(ctx, "trfqtbtmusswpibw", &armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityOptions{Body: &armrecoveryservicesdatareplication.CheckNameAvailabilityModel{ - Name: to.Ptr("updkdcixs"), - Type: to.Ptr("gngmcancdauwhdixjjvqnfkvqc"), - }, - }) - 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.CheckNameAvailabilityResponseModel = armrecoveryservicesdatareplication.CheckNameAvailabilityResponseModel{ - // Message: to.Ptr("gddmrunlrhtuhm"), - // NameAvailable: to.Ptr(true), - // Reason: to.Ptr("wwbvswyrmghbmv"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/DeploymentPreflight.json -func ExampleAzureSiteRecoveryManagementServiceAPIClient_DeploymentPreflight() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureSiteRecoveryManagementServiceAPIClient().DeploymentPreflight(ctx, "rgrecoveryservicesdatareplication", "kjoiahxljomjcmvabaobumg", &armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightOptions{Body: &armrecoveryservicesdatareplication.DeploymentPreflightModel{ - Resources: []*armrecoveryservicesdatareplication.DeploymentPreflightResource{ - { - Name: to.Ptr("xtgugoflfc"), - Type: to.Ptr("nsnaptduolqcxsikrewvgjbxqpt"), - APIVersion: to.Ptr("otihymhvzblycdoxo"), - Location: to.Ptr("cbsgtxkjdzwbyp"), - }}, - }, - }) - 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.DeploymentPreflightModel = armrecoveryservicesdatareplication.DeploymentPreflightModel{ - // Resources: []*armrecoveryservicesdatareplication.DeploymentPreflightResource{ - // { - // Name: to.Ptr("xtgugoflfc"), - // Type: to.Ptr("nsnaptduolqcxsikrewvgjbxqpt"), - // APIVersion: to.Ptr("otihymhvzblycdoxo"), - // Location: to.Ptr("cbsgtxkjdzwbyp"), - // }}, - // } -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/checknameavailability_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/checknameavailability_client.go new file mode 100644 index 000000000000..fa9420a77d1f --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/checknameavailability_client.go @@ -0,0 +1,107 @@ +// 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 armrecoveryservicesdatareplication + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CheckNameAvailabilityClient contains the methods for the CheckNameAvailability group. +// Don't use this type directly, use NewCheckNameAvailabilityClient() instead. +type CheckNameAvailabilityClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCheckNameAvailabilityClient creates a new instance of CheckNameAvailabilityClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewCheckNameAvailabilityClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CheckNameAvailabilityClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CheckNameAvailabilityClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Post - Checks the resource name availability. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - location - The name of the Azure region. +// - options - CheckNameAvailabilityClientPostOptions contains the optional parameters for the CheckNameAvailabilityClient.Post +// method. +func (client *CheckNameAvailabilityClient) Post(ctx context.Context, location string, options *CheckNameAvailabilityClientPostOptions) (CheckNameAvailabilityClientPostResponse, error) { + var err error + const operationName = "CheckNameAvailabilityClient.Post" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.postCreateRequest(ctx, location, options) + if err != nil { + return CheckNameAvailabilityClientPostResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CheckNameAvailabilityClientPostResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CheckNameAvailabilityClientPostResponse{}, err + } + resp, err := client.postHandleResponse(httpResp) + return resp, err +} + +// postCreateRequest creates the Post request. +func (client *CheckNameAvailabilityClient) postCreateRequest(ctx context.Context, location string, options *CheckNameAvailabilityClientPostOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/locations/{location}/checkNameAvailability" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Body != nil { + if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// postHandleResponse handles the Post response. +func (client *CheckNameAvailabilityClient) postHandleResponse(resp *http.Response) (CheckNameAvailabilityClientPostResponse, error) { + result := CheckNameAvailabilityClientPostResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResponseModel); err != nil { + return CheckNameAvailabilityClientPostResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/client_factory.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/client_factory.go index 5524eca60a1b..a12a2b6e868e 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/client_factory.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/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,8 +14,7 @@ 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. @@ -27,126 +23,155 @@ type ClientFactory struct { // - 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 } -// NewAzureSiteRecoveryManagementServiceAPIClient creates a new instance of AzureSiteRecoveryManagementServiceAPIClient. -func (c *ClientFactory) NewAzureSiteRecoveryManagementServiceAPIClient() *AzureSiteRecoveryManagementServiceAPIClient { - subClient, _ := NewAzureSiteRecoveryManagementServiceAPIClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewDraClient creates a new instance of DraClient. -func (c *ClientFactory) NewDraClient() *DraClient { - subClient, _ := NewDraClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewCheckNameAvailabilityClient creates a new instance of CheckNameAvailabilityClient. +func (c *ClientFactory) NewCheckNameAvailabilityClient() *CheckNameAvailabilityClient { + return &CheckNameAvailabilityClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewDraOperationStatusClient creates a new instance of DraOperationStatusClient. -func (c *ClientFactory) NewDraOperationStatusClient() *DraOperationStatusClient { - subClient, _ := NewDraOperationStatusClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewDeploymentPreflightClient creates a new instance of DeploymentPreflightClient. +func (c *ClientFactory) NewDeploymentPreflightClient() *DeploymentPreflightClient { + return &DeploymentPreflightClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewEmailConfigurationClient creates a new instance of EmailConfigurationClient. func (c *ClientFactory) NewEmailConfigurationClient() *EmailConfigurationClient { - subClient, _ := NewEmailConfigurationClient(c.subscriptionID, c.credential, c.options) - return subClient + return &EmailConfigurationClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewEventClient creates a new instance of EventClient. func (c *ClientFactory) NewEventClient() *EventClient { - subClient, _ := NewEventClient(c.subscriptionID, c.credential, c.options) - return subClient + return &EventClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewFabricAgentClient creates a new instance of FabricAgentClient. +func (c *ClientFactory) NewFabricAgentClient() *FabricAgentClient { + return &FabricAgentClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewFabricClient creates a new instance of FabricClient. func (c *ClientFactory) NewFabricClient() *FabricClient { - subClient, _ := NewFabricClient(c.subscriptionID, c.credential, c.options) - return subClient + return &FabricClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewFabricOperationsStatusClient creates a new instance of FabricOperationsStatusClient. -func (c *ClientFactory) NewFabricOperationsStatusClient() *FabricOperationsStatusClient { - subClient, _ := NewFabricOperationsStatusClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewJobClient creates a new instance of JobClient. +func (c *ClientFactory) NewJobClient() *JobClient { + return &JobClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewLocationBasedOperationResultsClient creates a new instance of LocationBasedOperationResultsClient. +func (c *ClientFactory) NewLocationBasedOperationResultsClient() *LocationBasedOperationResultsClient { + return &LocationBasedOperationResultsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewOperationResultsClient creates a new instance of OperationResultsClient. +func (c *ClientFactory) NewOperationResultsClient() *OperationResultsClient { + return &OperationResultsClient{ + 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, + } } // NewPolicyClient creates a new instance of PolicyClient. func (c *ClientFactory) NewPolicyClient() *PolicyClient { - subClient, _ := NewPolicyClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PolicyClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewPolicyOperationStatusClient creates a new instance of PolicyOperationStatusClient. -func (c *ClientFactory) NewPolicyOperationStatusClient() *PolicyOperationStatusClient { - subClient, _ := NewPolicyOperationStatusClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewPrivateEndpointConnectionProxiesClient creates a new instance of PrivateEndpointConnectionProxiesClient. +func (c *ClientFactory) NewPrivateEndpointConnectionProxiesClient() *PrivateEndpointConnectionProxiesClient { + return &PrivateEndpointConnectionProxiesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewProtectedItemClient creates a new instance of ProtectedItemClient. -func (c *ClientFactory) NewProtectedItemClient() *ProtectedItemClient { - subClient, _ := NewProtectedItemClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient. +func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { + return &PrivateEndpointConnectionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewProtectedItemOperationStatusClient creates a new instance of ProtectedItemOperationStatusClient. -func (c *ClientFactory) NewProtectedItemOperationStatusClient() *ProtectedItemOperationStatusClient { - subClient, _ := NewProtectedItemOperationStatusClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient. +func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { + return &PrivateLinkResourcesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewRecoveryPointsClient creates a new instance of RecoveryPointsClient. -func (c *ClientFactory) NewRecoveryPointsClient() *RecoveryPointsClient { - subClient, _ := NewRecoveryPointsClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewProtectedItemClient creates a new instance of ProtectedItemClient. +func (c *ClientFactory) NewProtectedItemClient() *ProtectedItemClient { + return &ProtectedItemClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewReplicationExtensionClient creates a new instance of ReplicationExtensionClient. -func (c *ClientFactory) NewReplicationExtensionClient() *ReplicationExtensionClient { - subClient, _ := NewReplicationExtensionClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewRecoveryPointClient creates a new instance of RecoveryPointClient. +func (c *ClientFactory) NewRecoveryPointClient() *RecoveryPointClient { + return &RecoveryPointClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewReplicationExtensionOperationStatusClient creates a new instance of ReplicationExtensionOperationStatusClient. -func (c *ClientFactory) NewReplicationExtensionOperationStatusClient() *ReplicationExtensionOperationStatusClient { - subClient, _ := NewReplicationExtensionOperationStatusClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewReplicationExtensionClient creates a new instance of ReplicationExtensionClient. +func (c *ClientFactory) NewReplicationExtensionClient() *ReplicationExtensionClient { + return &ReplicationExtensionClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewVaultClient creates a new instance of VaultClient. func (c *ClientFactory) NewVaultClient() *VaultClient { - subClient, _ := NewVaultClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewVaultOperationStatusClient creates a new instance of VaultOperationStatusClient. -func (c *ClientFactory) NewVaultOperationStatusClient() *VaultOperationStatusClient { - subClient, _ := NewVaultOperationStatusClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewWorkflowClient creates a new instance of WorkflowClient. -func (c *ClientFactory) NewWorkflowClient() *WorkflowClient { - subClient, _ := NewWorkflowClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewWorkflowOperationStatusClient creates a new instance of WorkflowOperationStatusClient. -func (c *ClientFactory) NewWorkflowOperationStatusClient() *WorkflowOperationStatusClient { - subClient, _ := NewWorkflowOperationStatusClient(c.subscriptionID, c.credential, c.options) - return subClient + return &VaultClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/constants.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/constants.go index bde98da71bdc..0b8066c7f6cb 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/constants.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/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 armrecoveryservicesdatareplication const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" - moduleVersion = "v0.2.0" + moduleVersion = "v1.0.0" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -27,13 +24,36 @@ func PossibleActionTypeValues() []ActionType { } } +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + // HealthStatus - Gets or sets the fabric health. type HealthStatus string const ( + // HealthStatusCritical - Critical Status. HealthStatusCritical HealthStatus = "Critical" - HealthStatusNormal HealthStatus = "Normal" - HealthStatusWarning HealthStatus = "Warning" + // HealthStatusNormal - Healthy Status. + HealthStatusNormal HealthStatus = "Normal" + // HealthStatusWarning - Warning Status. + HealthStatusWarning HealthStatus = "Warning" ) // PossibleHealthStatusValues returns the possible values for the HealthStatus const type. @@ -45,6 +65,101 @@ func PossibleHealthStatusValues() []HealthStatus { } } +// JobObjectType - Gets or sets the object type. +type JobObjectType string + +const ( + // JobObjectTypeAvsDiskPool - AVS disk pool. + JobObjectTypeAvsDiskPool JobObjectType = "AvsDiskPool" + // JobObjectTypeFabric - Fabric level job. + JobObjectTypeFabric JobObjectType = "Fabric" + // JobObjectTypeFabricAgent - Fabric agent level workflow. + JobObjectTypeFabricAgent JobObjectType = "FabricAgent" + // JobObjectTypePolicy - Policy level job. + JobObjectTypePolicy JobObjectType = "Policy" + // JobObjectTypeProtectedItem - Protected item level job. + JobObjectTypeProtectedItem JobObjectType = "ProtectedItem" + // JobObjectTypeRecoveryPlan - Recovery plan level job. + JobObjectTypeRecoveryPlan JobObjectType = "RecoveryPlan" + // JobObjectTypeReplicationExtension - Replication extension level job. + JobObjectTypeReplicationExtension JobObjectType = "ReplicationExtension" + // JobObjectTypeVault - Vault level job. + JobObjectTypeVault JobObjectType = "Vault" +) + +// PossibleJobObjectTypeValues returns the possible values for the JobObjectType const type. +func PossibleJobObjectTypeValues() []JobObjectType { + return []JobObjectType{ + JobObjectTypeAvsDiskPool, + JobObjectTypeFabric, + JobObjectTypeFabricAgent, + JobObjectTypePolicy, + JobObjectTypeProtectedItem, + JobObjectTypeRecoveryPlan, + JobObjectTypeReplicationExtension, + JobObjectTypeVault, + } +} + +// JobState - Gets or sets the job state. +type JobState string + +const ( + // JobStateCancelled - Job has been cancelled. + JobStateCancelled JobState = "Cancelled" + // JobStateCancelling - Job cancellation is in progress. + JobStateCancelling JobState = "Cancelling" + // JobStateCompletedWithErrors - Job has completed with errors. + JobStateCompletedWithErrors JobState = "CompletedWithErrors" + // JobStateCompletedWithInformation - Job has completed with information. + JobStateCompletedWithInformation JobState = "CompletedWithInformation" + // JobStateCompletedWithWarnings - Job has completed with warnings. + JobStateCompletedWithWarnings JobState = "CompletedWithWarnings" + // JobStateFailed - Job failed. + JobStateFailed JobState = "Failed" + // JobStatePending - Job has not been started. + JobStatePending JobState = "Pending" + // JobStateStarted - Job is in progress. + JobStateStarted JobState = "Started" + // JobStateSucceeded - Job has completed successfully. + JobStateSucceeded JobState = "Succeeded" +) + +// PossibleJobStateValues returns the possible values for the JobState const type. +func PossibleJobStateValues() []JobState { + return []JobState{ + JobStateCancelled, + JobStateCancelling, + JobStateCompletedWithErrors, + JobStateCompletedWithInformation, + JobStateCompletedWithWarnings, + JobStateFailed, + JobStatePending, + JobStateStarted, + JobStateSucceeded, + } +} + +// ManagedServiceIdentityType - Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). +type ManagedServiceIdentityType string + +const ( + ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" + ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" + ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" +) + +// PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type. +func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { + return []ManagedServiceIdentityType{ + ManagedServiceIdentityTypeNone, + ManagedServiceIdentityTypeSystemAssigned, + ManagedServiceIdentityTypeSystemAssignedUserAssigned, + ManagedServiceIdentityTypeUserAssigned, + } +} + // Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default // value is "user,system" type Origin string @@ -64,11 +179,37 @@ func PossibleOriginValues() []Origin { } } +// PrivateEndpointConnectionStatus - Gets or sets the status. +type PrivateEndpointConnectionStatus string + +const ( + // PrivateEndpointConnectionStatusApproved - Approved Status. + PrivateEndpointConnectionStatusApproved PrivateEndpointConnectionStatus = "Approved" + // PrivateEndpointConnectionStatusDisconnected - Disconnected Status. + PrivateEndpointConnectionStatusDisconnected PrivateEndpointConnectionStatus = "Disconnected" + // PrivateEndpointConnectionStatusPending - Pending Status. + PrivateEndpointConnectionStatusPending PrivateEndpointConnectionStatus = "Pending" + // PrivateEndpointConnectionStatusRejected - Rejected Status. + PrivateEndpointConnectionStatusRejected PrivateEndpointConnectionStatus = "Rejected" +) + +// PossiblePrivateEndpointConnectionStatusValues returns the possible values for the PrivateEndpointConnectionStatus const type. +func PossiblePrivateEndpointConnectionStatusValues() []PrivateEndpointConnectionStatus { + return []PrivateEndpointConnectionStatus{ + PrivateEndpointConnectionStatusApproved, + PrivateEndpointConnectionStatusDisconnected, + PrivateEndpointConnectionStatusPending, + PrivateEndpointConnectionStatusRejected, + } +} + // ProtectedItemActiveLocation - Gets or sets the location of the protected item. type ProtectedItemActiveLocation string const ( - ProtectedItemActiveLocationPrimary ProtectedItemActiveLocation = "Primary" + // ProtectedItemActiveLocationPrimary - Protected item is active on Primary. + ProtectedItemActiveLocationPrimary ProtectedItemActiveLocation = "Primary" + // ProtectedItemActiveLocationRecovery - Protected item is active on Recovery. ProtectedItemActiveLocationRecovery ProtectedItemActiveLocation = "Recovery" ) @@ -84,58 +225,112 @@ func PossibleProtectedItemActiveLocationValues() []ProtectedItemActiveLocation { type ProtectionState string const ( - ProtectionStateCancelFailoverFailedOnPrimary ProtectionState = "CancelFailoverFailedOnPrimary" - ProtectionStateCancelFailoverFailedOnRecovery ProtectionState = "CancelFailoverFailedOnRecovery" - ProtectionStateCancelFailoverInProgressOnPrimary ProtectionState = "CancelFailoverInProgressOnPrimary" - ProtectionStateCancelFailoverInProgressOnRecovery ProtectionState = "CancelFailoverInProgressOnRecovery" - ProtectionStateCancelFailoverStatesBegin ProtectionState = "CancelFailoverStatesBegin" - ProtectionStateCancelFailoverStatesEnd ProtectionState = "CancelFailoverStatesEnd" - ProtectionStateChangeRecoveryPointCompleted ProtectionState = "ChangeRecoveryPointCompleted" - ProtectionStateChangeRecoveryPointFailed ProtectionState = "ChangeRecoveryPointFailed" - ProtectionStateChangeRecoveryPointInitiated ProtectionState = "ChangeRecoveryPointInitiated" - ProtectionStateChangeRecoveryPointStatesBegin ProtectionState = "ChangeRecoveryPointStatesBegin" - ProtectionStateChangeRecoveryPointStatesEnd ProtectionState = "ChangeRecoveryPointStatesEnd" - ProtectionStateCommitFailoverCompleted ProtectionState = "CommitFailoverCompleted" - ProtectionStateCommitFailoverFailedOnPrimary ProtectionState = "CommitFailoverFailedOnPrimary" - ProtectionStateCommitFailoverFailedOnRecovery ProtectionState = "CommitFailoverFailedOnRecovery" - ProtectionStateCommitFailoverInProgressOnPrimary ProtectionState = "CommitFailoverInProgressOnPrimary" - ProtectionStateCommitFailoverInProgressOnRecovery ProtectionState = "CommitFailoverInProgressOnRecovery" - ProtectionStateCommitFailoverStatesBegin ProtectionState = "CommitFailoverStatesBegin" - ProtectionStateCommitFailoverStatesEnd ProtectionState = "CommitFailoverStatesEnd" - ProtectionStateDisablingFailed ProtectionState = "DisablingFailed" - ProtectionStateDisablingProtection ProtectionState = "DisablingProtection" - ProtectionStateEnablingFailed ProtectionState = "EnablingFailed" - ProtectionStateEnablingProtection ProtectionState = "EnablingProtection" - ProtectionStateInitialReplicationCompletedOnPrimary ProtectionState = "InitialReplicationCompletedOnPrimary" - ProtectionStateInitialReplicationCompletedOnRecovery ProtectionState = "InitialReplicationCompletedOnRecovery" - ProtectionStateInitialReplicationFailed ProtectionState = "InitialReplicationFailed" - ProtectionStateInitialReplicationInProgress ProtectionState = "InitialReplicationInProgress" - ProtectionStateInitialReplicationStatesBegin ProtectionState = "InitialReplicationStatesBegin" - ProtectionStateInitialReplicationStatesEnd ProtectionState = "InitialReplicationStatesEnd" - ProtectionStateMarkedForDeletion ProtectionState = "MarkedForDeletion" - ProtectionStatePlannedFailoverCompleted ProtectionState = "PlannedFailoverCompleted" - ProtectionStatePlannedFailoverCompleting ProtectionState = "PlannedFailoverCompleting" - ProtectionStatePlannedFailoverCompletionFailed ProtectionState = "PlannedFailoverCompletionFailed" - ProtectionStatePlannedFailoverFailed ProtectionState = "PlannedFailoverFailed" - ProtectionStatePlannedFailoverInitiated ProtectionState = "PlannedFailoverInitiated" - ProtectionStatePlannedFailoverTransitionStatesBegin ProtectionState = "PlannedFailoverTransitionStatesBegin" - ProtectionStatePlannedFailoverTransitionStatesEnd ProtectionState = "PlannedFailoverTransitionStatesEnd" - ProtectionStateProtected ProtectionState = "Protected" - ProtectionStateProtectedStatesBegin ProtectionState = "ProtectedStatesBegin" - ProtectionStateProtectedStatesEnd ProtectionState = "ProtectedStatesEnd" - ProtectionStateReprotectFailed ProtectionState = "ReprotectFailed" - ProtectionStateReprotectInitiated ProtectionState = "ReprotectInitiated" - ProtectionStateReprotectStatesBegin ProtectionState = "ReprotectStatesBegin" - ProtectionStateReprotectStatesEnd ProtectionState = "ReprotectStatesEnd" - ProtectionStateUnplannedFailoverCompleted ProtectionState = "UnplannedFailoverCompleted" - ProtectionStateUnplannedFailoverCompleting ProtectionState = "UnplannedFailoverCompleting" - ProtectionStateUnplannedFailoverCompletionFailed ProtectionState = "UnplannedFailoverCompletionFailed" - ProtectionStateUnplannedFailoverFailed ProtectionState = "UnplannedFailoverFailed" - ProtectionStateUnplannedFailoverInitiated ProtectionState = "UnplannedFailoverInitiated" + // ProtectionStateCancelFailoverFailedOnPrimary - Cancel failover failed on the primary side. + ProtectionStateCancelFailoverFailedOnPrimary ProtectionState = "CancelFailoverFailedOnPrimary" + // ProtectionStateCancelFailoverFailedOnRecovery - Cancel failover failed on the recovery side. + ProtectionStateCancelFailoverFailedOnRecovery ProtectionState = "CancelFailoverFailedOnRecovery" + // ProtectionStateCancelFailoverInProgressOnPrimary - Cancel failover is in progress on the primary side. + ProtectionStateCancelFailoverInProgressOnPrimary ProtectionState = "CancelFailoverInProgressOnPrimary" + // ProtectionStateCancelFailoverInProgressOnRecovery - Cancel failover is in progress on the recovery side. + ProtectionStateCancelFailoverInProgressOnRecovery ProtectionState = "CancelFailoverInProgressOnRecovery" + // ProtectionStateCancelFailoverStatesBegin - Begin marker for cancel failover states. + ProtectionStateCancelFailoverStatesBegin ProtectionState = "CancelFailoverStatesBegin" + // ProtectionStateCancelFailoverStatesEnd - End marker for cancel failover states. + ProtectionStateCancelFailoverStatesEnd ProtectionState = "CancelFailoverStatesEnd" + // ProtectionStateChangeRecoveryPointCompleted - Change recovery point has been completed successfully. + ProtectionStateChangeRecoveryPointCompleted ProtectionState = "ChangeRecoveryPointCompleted" + // ProtectionStateChangeRecoveryPointFailed - Change recovery point has failed. + ProtectionStateChangeRecoveryPointFailed ProtectionState = "ChangeRecoveryPointFailed" + // ProtectionStateChangeRecoveryPointInitiated - Change recovery point has been initiated.. + ProtectionStateChangeRecoveryPointInitiated ProtectionState = "ChangeRecoveryPointInitiated" + // ProtectionStateChangeRecoveryPointStatesBegin - Begin marker for change recovery point states. + ProtectionStateChangeRecoveryPointStatesBegin ProtectionState = "ChangeRecoveryPointStatesBegin" + // ProtectionStateChangeRecoveryPointStatesEnd - End marker for change recovery point states. + ProtectionStateChangeRecoveryPointStatesEnd ProtectionState = "ChangeRecoveryPointStatesEnd" + // ProtectionStateCommitFailoverCompleted - Commit failover has been completed successfully. + ProtectionStateCommitFailoverCompleted ProtectionState = "CommitFailoverCompleted" + // ProtectionStateCommitFailoverFailedOnPrimary - Commit failover failed on the primary side. + ProtectionStateCommitFailoverFailedOnPrimary ProtectionState = "CommitFailoverFailedOnPrimary" + // ProtectionStateCommitFailoverFailedOnRecovery - Commit failover failed on the recovery side. + ProtectionStateCommitFailoverFailedOnRecovery ProtectionState = "CommitFailoverFailedOnRecovery" + // ProtectionStateCommitFailoverInProgressOnPrimary - Commit failover is in progress on the primary side. + ProtectionStateCommitFailoverInProgressOnPrimary ProtectionState = "CommitFailoverInProgressOnPrimary" + // ProtectionStateCommitFailoverInProgressOnRecovery - Commit failover is in progress on the recovery side. + ProtectionStateCommitFailoverInProgressOnRecovery ProtectionState = "CommitFailoverInProgressOnRecovery" + // ProtectionStateCommitFailoverStatesBegin - Begin marker for commit failover states. + ProtectionStateCommitFailoverStatesBegin ProtectionState = "CommitFailoverStatesBegin" + // ProtectionStateCommitFailoverStatesEnd - End marker for commit failover states. + ProtectionStateCommitFailoverStatesEnd ProtectionState = "CommitFailoverStatesEnd" + // ProtectionStateDisablingFailed - Disable protection failed. + ProtectionStateDisablingFailed ProtectionState = "DisablingFailed" + // ProtectionStateDisablingProtection - Disabling protection is in progress. + ProtectionStateDisablingProtection ProtectionState = "DisablingProtection" + // ProtectionStateEnablingFailed - Enable protection failed. + ProtectionStateEnablingFailed ProtectionState = "EnablingFailed" + // ProtectionStateEnablingProtection - Enable protection is in progress. + ProtectionStateEnablingProtection ProtectionState = "EnablingProtection" + // ProtectionStateInitialReplicationCompletedOnPrimary - Initial replication has completed on the primary side. + ProtectionStateInitialReplicationCompletedOnPrimary ProtectionState = "InitialReplicationCompletedOnPrimary" + // ProtectionStateInitialReplicationCompletedOnRecovery - Initial replication has completed on the recovery side. + ProtectionStateInitialReplicationCompletedOnRecovery ProtectionState = "InitialReplicationCompletedOnRecovery" + // ProtectionStateInitialReplicationFailed - Initial replication failed and would need to be started again. + ProtectionStateInitialReplicationFailed ProtectionState = "InitialReplicationFailed" + // ProtectionStateInitialReplicationInProgress - Initial replication is in progress. + ProtectionStateInitialReplicationInProgress ProtectionState = "InitialReplicationInProgress" + // ProtectionStateInitialReplicationStatesBegin - Begin marker for initial replication states. + ProtectionStateInitialReplicationStatesBegin ProtectionState = "InitialReplicationStatesBegin" + // ProtectionStateInitialReplicationStatesEnd - End marker for initial replication states. + ProtectionStateInitialReplicationStatesEnd ProtectionState = "InitialReplicationStatesEnd" + // ProtectionStateMarkedForDeletion - Disabling protection succeeded. This is a transient state before the protected item + // is deleted. + ProtectionStateMarkedForDeletion ProtectionState = "MarkedForDeletion" + // ProtectionStatePlannedFailoverCompleted - Planned failover has been completed successfully. + ProtectionStatePlannedFailoverCompleted ProtectionState = "PlannedFailoverCompleted" + // ProtectionStatePlannedFailoverCompleting - Planned failover preparing protected entities is in progress. + ProtectionStatePlannedFailoverCompleting ProtectionState = "PlannedFailoverCompleting" + // ProtectionStatePlannedFailoverCompletionFailed - Planned failover preparing protected entities failed. + ProtectionStatePlannedFailoverCompletionFailed ProtectionState = "PlannedFailoverCompletionFailed" + // ProtectionStatePlannedFailoverFailed - Planned failover initiation failed. + ProtectionStatePlannedFailoverFailed ProtectionState = "PlannedFailoverFailed" + // ProtectionStatePlannedFailoverInitiated - Planned failover has been initiated. + ProtectionStatePlannedFailoverInitiated ProtectionState = "PlannedFailoverInitiated" + // ProtectionStatePlannedFailoverTransitionStatesBegin - Begin marker for planned failover transition states. + ProtectionStatePlannedFailoverTransitionStatesBegin ProtectionState = "PlannedFailoverTransitionStatesBegin" + // ProtectionStatePlannedFailoverTransitionStatesEnd - End marker for planned failover transition states. + ProtectionStatePlannedFailoverTransitionStatesEnd ProtectionState = "PlannedFailoverTransitionStatesEnd" + // ProtectionStateProtected - Protected item is protected and replication is on-going. Any issues with replication will be + // surfaced separately via the health property and will not affect the state. + ProtectionStateProtected ProtectionState = "Protected" + // ProtectionStateProtectedStatesBegin - Begin marker for protected steady-state states. + ProtectionStateProtectedStatesBegin ProtectionState = "ProtectedStatesBegin" + // ProtectionStateProtectedStatesEnd - End marker for protected steady-state states. + ProtectionStateProtectedStatesEnd ProtectionState = "ProtectedStatesEnd" + // ProtectionStateReprotectFailed - Reprotect has failed. + ProtectionStateReprotectFailed ProtectionState = "ReprotectFailed" + // ProtectionStateReprotectInitiated - Reprotect has been initiated. + ProtectionStateReprotectInitiated ProtectionState = "ReprotectInitiated" + // ProtectionStateReprotectStatesBegin - Begin marker for reprotect states. + ProtectionStateReprotectStatesBegin ProtectionState = "ReprotectStatesBegin" + // ProtectionStateReprotectStatesEnd - End marker for reprotect states. + ProtectionStateReprotectStatesEnd ProtectionState = "ReprotectStatesEnd" + // ProtectionStateUnplannedFailoverCompleted - Unplanned failover preparing protected entities is in progress. + ProtectionStateUnplannedFailoverCompleted ProtectionState = "UnplannedFailoverCompleted" + // ProtectionStateUnplannedFailoverCompleting - Unplanned failover preparing protected entities is in progress. + ProtectionStateUnplannedFailoverCompleting ProtectionState = "UnplannedFailoverCompleting" + // ProtectionStateUnplannedFailoverCompletionFailed - Unplanned failover preparing protected entities failed. + ProtectionStateUnplannedFailoverCompletionFailed ProtectionState = "UnplannedFailoverCompletionFailed" + // ProtectionStateUnplannedFailoverFailed - Unplanned failover initiation failed. + ProtectionStateUnplannedFailoverFailed ProtectionState = "UnplannedFailoverFailed" + // ProtectionStateUnplannedFailoverInitiated - Unplanned failover has been initiated. + ProtectionStateUnplannedFailoverInitiated ProtectionState = "UnplannedFailoverInitiated" + // ProtectionStateUnplannedFailoverTransitionStatesBegin - Begin marker for unplanned failover transition states. ProtectionStateUnplannedFailoverTransitionStatesBegin ProtectionState = "UnplannedFailoverTransitionStatesBegin" - ProtectionStateUnplannedFailoverTransitionStatesEnd ProtectionState = "UnplannedFailoverTransitionStatesEnd" - ProtectionStateUnprotectedStatesBegin ProtectionState = "UnprotectedStatesBegin" - ProtectionStateUnprotectedStatesEnd ProtectionState = "UnprotectedStatesEnd" + // ProtectionStateUnplannedFailoverTransitionStatesEnd - End marker for unplanned failover transition states. + ProtectionStateUnplannedFailoverTransitionStatesEnd ProtectionState = "UnplannedFailoverTransitionStatesEnd" + // ProtectionStateUnprotectedStatesBegin - Begin marker for unprotected states. + ProtectionStateUnprotectedStatesBegin ProtectionState = "UnprotectedStatesBegin" + // ProtectionStateUnprotectedStatesEnd - End marker for unprotected states. + ProtectionStateUnprotectedStatesEnd ProtectionState = "UnprotectedStatesEnd" ) // PossibleProtectionStateValues returns the possible values for the ProtectionState const type. @@ -196,17 +391,24 @@ func PossibleProtectionStateValues() []ProtectionState { } } -// ProvisioningState - Gets or sets the provisioning state of the Dra. +// ProvisioningState - Gets or sets the provisioning state of the email configuration. type ProvisioningState string const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" - ProvisioningStateDeleted ProvisioningState = "Deleted" - ProvisioningStateDeleting ProvisioningState = "Deleting" - ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateCanceled - Resource creation has been canceled + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateCreating - Resource is being created. + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleted - Resource has been deleted. + ProvisioningStateDeleted ProvisioningState = "Deleted" + // ProvisioningStateDeleting - Resource is being deleted. + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed - Resource creation failed. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateSucceeded - Resource creation/update succeeded. ProvisioningStateSucceeded ProvisioningState = "Succeeded" - ProvisioningStateUpdating ProvisioningState = "Updating" + // ProvisioningStateUpdating - Resource is being updated. + ProvisioningStateUpdating ProvisioningState = "Updating" ) // PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. @@ -226,8 +428,10 @@ func PossibleProvisioningStateValues() []ProvisioningState { type RecoveryPointType string const ( + // RecoveryPointTypeApplicationConsistent - Application consistent recovery point. RecoveryPointTypeApplicationConsistent RecoveryPointType = "ApplicationConsistent" - RecoveryPointTypeCrashConsistent RecoveryPointType = "CrashConsistent" + // RecoveryPointTypeCrashConsistent - Crash consistent recovery point. + RecoveryPointTypeCrashConsistent RecoveryPointType = "CrashConsistent" ) // PossibleRecoveryPointTypeValues returns the possible values for the RecoveryPointType const type. @@ -242,8 +446,10 @@ func PossibleRecoveryPointTypeValues() []RecoveryPointType { type ReplicationVaultType string const ( + // ReplicationVaultTypeDisasterRecovery - Disaster recovery vault. ReplicationVaultTypeDisasterRecovery ReplicationVaultType = "DisasterRecovery" - ReplicationVaultTypeMigrate ReplicationVaultType = "Migrate" + // ReplicationVaultTypeMigrate - Migrate vault. + ReplicationVaultTypeMigrate ReplicationVaultType = "Migrate" ) // PossibleReplicationVaultTypeValues returns the possible values for the ReplicationVaultType const type. @@ -258,9 +464,13 @@ func PossibleReplicationVaultTypeValues() []ReplicationVaultType { type ResynchronizationState string const ( - ResynchronizationStateNone ResynchronizationState = "None" + // ResynchronizationStateNone - Resynchronization is not active. + ResynchronizationStateNone ResynchronizationState = "None" + // ResynchronizationStateResynchronizationCompleted - Resynchronization has been completed successfully. ResynchronizationStateResynchronizationCompleted ResynchronizationState = "ResynchronizationCompleted" - ResynchronizationStateResynchronizationFailed ResynchronizationState = "ResynchronizationFailed" + // ResynchronizationStateResynchronizationFailed - Resynchronization has failed and would need to be started again. + ResynchronizationStateResynchronizationFailed ResynchronizationState = "ResynchronizationFailed" + // ResynchronizationStateResynchronizationInitiated - Resynchronization has been initiated. ResynchronizationStateResynchronizationInitiated ResynchronizationState = "ResynchronizationInitiated" ) @@ -278,11 +488,17 @@ func PossibleResynchronizationStateValues() []ResynchronizationState { type TaskState string const ( + // TaskStateCancelled - Task has been cancelled. TaskStateCancelled TaskState = "Cancelled" - TaskStateFailed TaskState = "Failed" - TaskStatePending TaskState = "Pending" - TaskStateSkipped TaskState = "Skipped" - TaskStateStarted TaskState = "Started" + // TaskStateFailed - Task failed. + TaskStateFailed TaskState = "Failed" + // TaskStatePending - Task has not been started. + TaskStatePending TaskState = "Pending" + // TaskStateSkipped - Task has been skipped. + TaskStateSkipped TaskState = "Skipped" + // TaskStateStarted - Task is in progress. + TaskStateStarted TaskState = "Started" + // TaskStateSucceeded - Task has completed successfully. TaskStateSucceeded TaskState = "Succeeded" ) @@ -302,15 +518,25 @@ func PossibleTaskStateValues() []TaskState { type TestFailoverState string const ( - TestFailoverStateMarkedForDeletion TestFailoverState = "MarkedForDeletion" - TestFailoverStateNone TestFailoverState = "None" + // TestFailoverStateMarkedForDeletion - Test failover cleanup has completed/failed. This is a transient state before the state + // is moved back to None. + TestFailoverStateMarkedForDeletion TestFailoverState = "MarkedForDeletion" + // TestFailoverStateNone - Test failover is not active. + TestFailoverStateNone TestFailoverState = "None" + // TestFailoverStateTestFailoverCleanupCompleting - Cleaning up test protected entities is in progress. TestFailoverStateTestFailoverCleanupCompleting TestFailoverState = "TestFailoverCleanupCompleting" - TestFailoverStateTestFailoverCleanupInitiated TestFailoverState = "TestFailoverCleanupInitiated" - TestFailoverStateTestFailoverCompleted TestFailoverState = "TestFailoverCompleted" - TestFailoverStateTestFailoverCompleting TestFailoverState = "TestFailoverCompleting" - TestFailoverStateTestFailoverCompletionFailed TestFailoverState = "TestFailoverCompletionFailed" - TestFailoverStateTestFailoverFailed TestFailoverState = "TestFailoverFailed" - TestFailoverStateTestFailoverInitiated TestFailoverState = "TestFailoverInitiated" + // TestFailoverStateTestFailoverCleanupInitiated - Test failover cleanup has been initiated. + TestFailoverStateTestFailoverCleanupInitiated TestFailoverState = "TestFailoverCleanupInitiated" + // TestFailoverStateTestFailoverCompleted - Test failover has been completed successfully. + TestFailoverStateTestFailoverCompleted TestFailoverState = "TestFailoverCompleted" + // TestFailoverStateTestFailoverCompleting - Preparing test protected entities is in progress. + TestFailoverStateTestFailoverCompleting TestFailoverState = "TestFailoverCompleting" + // TestFailoverStateTestFailoverCompletionFailed - Preparing test protected entities failed. + TestFailoverStateTestFailoverCompletionFailed TestFailoverState = "TestFailoverCompletionFailed" + // TestFailoverStateTestFailoverFailed - Test failover initiation failed.. + TestFailoverStateTestFailoverFailed TestFailoverState = "TestFailoverFailed" + // TestFailoverStateTestFailoverInitiated - Test failover has been initiated. + TestFailoverStateTestFailoverInitiated TestFailoverState = "TestFailoverInitiated" ) // PossibleTestFailoverStateValues returns the possible values for the TestFailoverState const type. @@ -332,9 +558,15 @@ func PossibleTestFailoverStateValues() []TestFailoverState { type VMNicSelection string const ( - VMNicSelectionNotSelected VMNicSelection = "NotSelected" - VMNicSelectionSelectedByDefault VMNicSelection = "SelectedByDefault" - VMNicSelectionSelectedByUser VMNicSelection = "SelectedByUser" + // VMNicSelectionNotSelected - Not Selected. + VMNicSelectionNotSelected VMNicSelection = "NotSelected" + // VMNicSelectionSelectedByDefault - Default selection by ASR. + VMNicSelectionSelectedByDefault VMNicSelection = "SelectedByDefault" + // VMNicSelectionSelectedByUser - Selected by user. + VMNicSelectionSelectedByUser VMNicSelection = "SelectedByUser" + // VMNicSelectionSelectedByUserOverride - NIC configuration overridden by user. Differs from SelectedByUser in the sense that + // the legacy SelectedByUser is used both for explicit modification by user and implicit approval of user if the settings + // are used for TFO/FO. SelectedByUserOverride implies user overriding at least one of the configurations. VMNicSelectionSelectedByUserOverride VMNicSelection = "SelectedByUserOverride" ) @@ -352,9 +584,12 @@ func PossibleVMNicSelectionValues() []VMNicSelection { type VMwareToAzureMigrateResyncState string const ( - VMwareToAzureMigrateResyncStateNone VMwareToAzureMigrateResyncState = "None" + // VMwareToAzureMigrateResyncStateNone - None state. + VMwareToAzureMigrateResyncStateNone VMwareToAzureMigrateResyncState = "None" + // VMwareToAzureMigrateResyncStatePreparedForResynchronization - Prepared for resynchronization state. VMwareToAzureMigrateResyncStatePreparedForResynchronization VMwareToAzureMigrateResyncState = "PreparedForResynchronization" - VMwareToAzureMigrateResyncStateStartedResynchronization VMwareToAzureMigrateResyncState = "StartedResynchronization" + // VMwareToAzureMigrateResyncStateStartedResynchronization - Started resynchronization state. + VMwareToAzureMigrateResyncStateStartedResynchronization VMwareToAzureMigrateResyncState = "StartedResynchronization" ) // PossibleVMwareToAzureMigrateResyncStateValues returns the possible values for the VMwareToAzureMigrateResyncState const type. @@ -366,60 +601,23 @@ func PossibleVMwareToAzureMigrateResyncStateValues() []VMwareToAzureMigrateResyn } } -// WorkflowObjectType - Gets or sets the object type. -type WorkflowObjectType string - -const ( - WorkflowObjectTypeAvsDiskPool WorkflowObjectType = "AvsDiskPool" - WorkflowObjectTypeDra WorkflowObjectType = "Dra" - WorkflowObjectTypeFabric WorkflowObjectType = "Fabric" - WorkflowObjectTypePolicy WorkflowObjectType = "Policy" - WorkflowObjectTypeProtectedItem WorkflowObjectType = "ProtectedItem" - WorkflowObjectTypeRecoveryPlan WorkflowObjectType = "RecoveryPlan" - WorkflowObjectTypeReplicationExtension WorkflowObjectType = "ReplicationExtension" - WorkflowObjectTypeVault WorkflowObjectType = "Vault" -) - -// PossibleWorkflowObjectTypeValues returns the possible values for the WorkflowObjectType const type. -func PossibleWorkflowObjectTypeValues() []WorkflowObjectType { - return []WorkflowObjectType{ - WorkflowObjectTypeAvsDiskPool, - WorkflowObjectTypeDra, - WorkflowObjectTypeFabric, - WorkflowObjectTypePolicy, - WorkflowObjectTypeProtectedItem, - WorkflowObjectTypeRecoveryPlan, - WorkflowObjectTypeReplicationExtension, - WorkflowObjectTypeVault, - } -} - -// WorkflowState - Gets or sets the workflow state. -type WorkflowState string +// VaultIdentityType - Gets or sets the identityType which can be either SystemAssigned or None. +type VaultIdentityType string const ( - WorkflowStateCancelled WorkflowState = "Cancelled" - WorkflowStateCancelling WorkflowState = "Cancelling" - WorkflowStateCompletedWithErrors WorkflowState = "CompletedWithErrors" - WorkflowStateCompletedWithInformation WorkflowState = "CompletedWithInformation" - WorkflowStateCompletedWithWarnings WorkflowState = "CompletedWithWarnings" - WorkflowStateFailed WorkflowState = "Failed" - WorkflowStatePending WorkflowState = "Pending" - WorkflowStateStarted WorkflowState = "Started" - WorkflowStateSucceeded WorkflowState = "Succeeded" + // VaultIdentityTypeNone - No identity. + VaultIdentityTypeNone VaultIdentityType = "None" + // VaultIdentityTypeSystemAssigned - System assigned identity. + VaultIdentityTypeSystemAssigned VaultIdentityType = "SystemAssigned" + // VaultIdentityTypeUserAssigned - User assigned identity. + VaultIdentityTypeUserAssigned VaultIdentityType = "UserAssigned" ) -// PossibleWorkflowStateValues returns the possible values for the WorkflowState const type. -func PossibleWorkflowStateValues() []WorkflowState { - return []WorkflowState{ - WorkflowStateCancelled, - WorkflowStateCancelling, - WorkflowStateCompletedWithErrors, - WorkflowStateCompletedWithInformation, - WorkflowStateCompletedWithWarnings, - WorkflowStateFailed, - WorkflowStatePending, - WorkflowStateStarted, - WorkflowStateSucceeded, +// PossibleVaultIdentityTypeValues returns the possible values for the VaultIdentityType const type. +func PossibleVaultIdentityTypeValues() []VaultIdentityType { + return []VaultIdentityType{ + VaultIdentityTypeNone, + VaultIdentityTypeSystemAssigned, + VaultIdentityTypeUserAssigned, } } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/deploymentpreflight_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/deploymentpreflight_client.go new file mode 100644 index 000000000000..5382109b1f40 --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/deploymentpreflight_client.go @@ -0,0 +1,112 @@ +// 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 armrecoveryservicesdatareplication + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// DeploymentPreflightClient contains the methods for the DeploymentPreflight group. +// Don't use this type directly, use NewDeploymentPreflightClient() instead. +type DeploymentPreflightClient struct { + internal *arm.Client + subscriptionID string +} + +// NewDeploymentPreflightClient creates a new instance of DeploymentPreflightClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewDeploymentPreflightClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DeploymentPreflightClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DeploymentPreflightClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Post - Performs resource deployment preflight validation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - deploymentID - Deployment Id. +// - options - DeploymentPreflightClientPostOptions contains the optional parameters for the DeploymentPreflightClient.Post +// method. +func (client *DeploymentPreflightClient) Post(ctx context.Context, resourceGroupName string, deploymentID string, options *DeploymentPreflightClientPostOptions) (DeploymentPreflightClientPostResponse, error) { + var err error + const operationName = "DeploymentPreflightClient.Post" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.postCreateRequest(ctx, resourceGroupName, deploymentID, options) + if err != nil { + return DeploymentPreflightClientPostResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentPreflightClientPostResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentPreflightClientPostResponse{}, err + } + resp, err := client.postHandleResponse(httpResp) + return resp, err +} + +// postCreateRequest creates the Post request. +func (client *DeploymentPreflightClient) postCreateRequest(ctx context.Context, resourceGroupName string, deploymentID string, options *DeploymentPreflightClientPostOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/deployments/{deploymentId}/preflight" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if deploymentID == "" { + return nil, errors.New("parameter deploymentID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentId}", url.PathEscape(deploymentID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.Body != nil { + if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} + +// postHandleResponse handles the Post response. +func (client *DeploymentPreflightClient) postHandleResponse(resp *http.Response) (DeploymentPreflightClientPostResponse, error) { + result := DeploymentPreflightClientPostResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentPreflightModel); err != nil { + return DeploymentPreflightClientPostResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/dra_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/dra_client_example_test.go deleted file mode 100644 index 2bdd8ac581b3..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/dra_client_example_test.go +++ /dev/null @@ -1,344 +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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Dra_Get.json -func ExampleDraClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDraClient().Get(ctx, "rgrecoveryservicesdatareplication", "wPR", "M", 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.DraModel = armrecoveryservicesdatareplication.DraModel{ - // Name: to.Ptr("ioxmwhzrzdilxivkvhpvzexl"), - // Type: to.Ptr("ptgmahzsyv"), - // ID: to.Ptr("anp"), - // Properties: &armrecoveryservicesdatareplication.DraModelProperties{ - // AuthenticationIdentity: &armrecoveryservicesdatareplication.IdentityModel{ - // AADAuthority: to.Ptr("bubwwbowfhdmujrt"), - // ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), - // Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), - // ObjectID: to.Ptr("khsiaqfbpuhp"), - // TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), - // }, - // CorrelationID: to.Ptr("t"), - // CustomProperties: &armrecoveryservicesdatareplication.DraModelCustomProperties{ - // InstanceType: to.Ptr("DraModelCustomProperties"), - // }, - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, - // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), - // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ - // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), - // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), - // Severity: to.Ptr("wqxxiuaqjyagq"), - // Source: to.Ptr("wevvftugwydzzw"), - // Summary: to.Ptr("djsmgrltruljo"), - // }}, - // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), - // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), - // Source: to.Ptr("iy"), - // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // IsResponsive: to.Ptr(true), - // LastHeartbeat: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.127Z"); return t}()), - // MachineID: to.Ptr("envzcoijbqhtrpncbjbhk"), - // MachineName: to.Ptr("y"), - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ResourceAccessIdentity: &armrecoveryservicesdatareplication.IdentityModel{ - // AADAuthority: to.Ptr("bubwwbowfhdmujrt"), - // ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), - // Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), - // ObjectID: to.Ptr("khsiaqfbpuhp"), - // TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), - // }, - // VersionNumber: to.Ptr("wnksfnisrhs"), - // }, - // SystemData: &armrecoveryservicesdatareplication.DraModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // CreatedBy: to.Ptr("fazidmklka"), - // CreatedByType: to.Ptr("obpndgkaeyklqzmpjh"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // LastModifiedBy: to.Ptr("cfoopkrisaroztncgss"), - // LastModifiedByType: to.Ptr("dysxbvohxhrpl"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Dra_Create.json -func ExampleDraClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDraClient().BeginCreate(ctx, "rgrecoveryservicesdatareplication", "wPR", "M", armrecoveryservicesdatareplication.DraModel{ - Properties: &armrecoveryservicesdatareplication.DraModelProperties{ - AuthenticationIdentity: &armrecoveryservicesdatareplication.IdentityModel{ - AADAuthority: to.Ptr("bubwwbowfhdmujrt"), - ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), - Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), - ObjectID: to.Ptr("khsiaqfbpuhp"), - TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), - }, - CustomProperties: &armrecoveryservicesdatareplication.DraModelCustomProperties{ - InstanceType: to.Ptr("DraModelCustomProperties"), - }, - MachineID: to.Ptr("envzcoijbqhtrpncbjbhk"), - MachineName: to.Ptr("y"), - ResourceAccessIdentity: &armrecoveryservicesdatareplication.IdentityModel{ - AADAuthority: to.Ptr("bubwwbowfhdmujrt"), - ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), - Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), - ObjectID: to.Ptr("khsiaqfbpuhp"), - TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), - }, - }, - }, 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.DraModel = armrecoveryservicesdatareplication.DraModel{ - // Name: to.Ptr("ioxmwhzrzdilxivkvhpvzexl"), - // Type: to.Ptr("ptgmahzsyv"), - // ID: to.Ptr("anp"), - // Properties: &armrecoveryservicesdatareplication.DraModelProperties{ - // AuthenticationIdentity: &armrecoveryservicesdatareplication.IdentityModel{ - // AADAuthority: to.Ptr("bubwwbowfhdmujrt"), - // ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), - // Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), - // ObjectID: to.Ptr("khsiaqfbpuhp"), - // TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), - // }, - // CorrelationID: to.Ptr("t"), - // CustomProperties: &armrecoveryservicesdatareplication.DraModelCustomProperties{ - // InstanceType: to.Ptr("DraModelCustomProperties"), - // }, - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, - // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), - // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ - // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), - // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), - // Severity: to.Ptr("wqxxiuaqjyagq"), - // Source: to.Ptr("wevvftugwydzzw"), - // Summary: to.Ptr("djsmgrltruljo"), - // }}, - // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), - // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), - // Source: to.Ptr("iy"), - // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // IsResponsive: to.Ptr(true), - // LastHeartbeat: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.127Z"); return t}()), - // MachineID: to.Ptr("envzcoijbqhtrpncbjbhk"), - // MachineName: to.Ptr("y"), - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ResourceAccessIdentity: &armrecoveryservicesdatareplication.IdentityModel{ - // AADAuthority: to.Ptr("bubwwbowfhdmujrt"), - // ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), - // Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), - // ObjectID: to.Ptr("khsiaqfbpuhp"), - // TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), - // }, - // VersionNumber: to.Ptr("wnksfnisrhs"), - // }, - // SystemData: &armrecoveryservicesdatareplication.DraModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // CreatedBy: to.Ptr("fazidmklka"), - // CreatedByType: to.Ptr("obpndgkaeyklqzmpjh"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // LastModifiedBy: to.Ptr("cfoopkrisaroztncgss"), - // LastModifiedByType: to.Ptr("dysxbvohxhrpl"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Dra_Delete.json -func ExampleDraClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDraClient().BeginDelete(ctx, "rgrecoveryservicesdatareplication", "wPR", "M", 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/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Dra_List.json -func ExampleDraClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDraClient().NewListPager("rgrecoveryservicesdatareplication", "wPR", 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.DraModelCollection = armrecoveryservicesdatareplication.DraModelCollection{ - // Value: []*armrecoveryservicesdatareplication.DraModel{ - // { - // Name: to.Ptr("ioxmwhzrzdilxivkvhpvzexl"), - // Type: to.Ptr("ptgmahzsyv"), - // ID: to.Ptr("anp"), - // Properties: &armrecoveryservicesdatareplication.DraModelProperties{ - // AuthenticationIdentity: &armrecoveryservicesdatareplication.IdentityModel{ - // AADAuthority: to.Ptr("bubwwbowfhdmujrt"), - // ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), - // Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), - // ObjectID: to.Ptr("khsiaqfbpuhp"), - // TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), - // }, - // CorrelationID: to.Ptr("t"), - // CustomProperties: &armrecoveryservicesdatareplication.DraModelCustomProperties{ - // InstanceType: to.Ptr("DraModelCustomProperties"), - // }, - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, - // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), - // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ - // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), - // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), - // Severity: to.Ptr("wqxxiuaqjyagq"), - // Source: to.Ptr("wevvftugwydzzw"), - // Summary: to.Ptr("djsmgrltruljo"), - // }}, - // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), - // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), - // Source: to.Ptr("iy"), - // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // IsResponsive: to.Ptr(true), - // LastHeartbeat: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.127Z"); return t}()), - // MachineID: to.Ptr("envzcoijbqhtrpncbjbhk"), - // MachineName: to.Ptr("y"), - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ResourceAccessIdentity: &armrecoveryservicesdatareplication.IdentityModel{ - // AADAuthority: to.Ptr("bubwwbowfhdmujrt"), - // ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), - // Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), - // ObjectID: to.Ptr("khsiaqfbpuhp"), - // TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), - // }, - // VersionNumber: to.Ptr("wnksfnisrhs"), - // }, - // SystemData: &armrecoveryservicesdatareplication.DraModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // CreatedBy: to.Ptr("fazidmklka"), - // CreatedByType: to.Ptr("obpndgkaeyklqzmpjh"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // LastModifiedBy: to.Ptr("cfoopkrisaroztncgss"), - // LastModifiedByType: to.Ptr("dysxbvohxhrpl"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/draoperationstatus_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/draoperationstatus_client.go deleted file mode 100644 index 781754ee35fa..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/draoperationstatus_client.go +++ /dev/null @@ -1,118 +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 armrecoveryservicesdatareplication - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// DraOperationStatusClient contains the methods for the DraOperationStatus group. -// Don't use this type directly, use NewDraOperationStatusClient() instead. -type DraOperationStatusClient struct { - internal *arm.Client - subscriptionID string -} - -// NewDraOperationStatusClient creates a new instance of DraOperationStatusClient with the specified values. -// - subscriptionID - The ID of the target subscription. The value must be an UUID. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewDraOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DraOperationStatusClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &DraOperationStatusClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Tracks the results of an asynchronous operation on the fabric agent. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-02-16-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - fabricName - The fabric name. -// - fabricAgentName - The fabric agent (Dra) name. -// - operationID - The ID of an ongoing async operation. -// - options - DraOperationStatusClientGetOptions contains the optional parameters for the DraOperationStatusClient.Get method. -func (client *DraOperationStatusClient) Get(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, operationID string, options *DraOperationStatusClientGetOptions) (DraOperationStatusClientGetResponse, error) { - var err error - const operationName = "DraOperationStatusClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, fabricName, fabricAgentName, operationID, options) - if err != nil { - return DraOperationStatusClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DraOperationStatusClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return DraOperationStatusClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *DraOperationStatusClient) getCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, operationID string, options *DraOperationStatusClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}/operations/{operationId}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if fabricName == "" { - return nil, errors.New("parameter fabricName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - if fabricAgentName == "" { - return nil, errors.New("parameter fabricAgentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricAgentName}", url.PathEscape(fabricAgentName)) - if operationID == "" { - return nil, errors.New("parameter operationID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *DraOperationStatusClient) getHandleResponse(resp *http.Response) (DraOperationStatusClientGetResponse, error) { - result := DraOperationStatusClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return DraOperationStatusClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/draoperationstatus_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/draoperationstatus_client_example_test.go deleted file mode 100644 index 8a445501bb63..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/draoperationstatus_client_example_test.go +++ /dev/null @@ -1,45 +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 armrecoveryservicesdatareplication_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/DraOperationStatus_Get.json -func ExampleDraOperationStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDraOperationStatusClient().Get(ctx, "rgrecoveryservicesdatareplication", "wPR", "M", "dadsqwcq", 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.OperationStatus = armrecoveryservicesdatareplication.OperationStatus{ - // Name: to.Ptr("wzdasptnwlxgobklayoqapjcgcf"), - // EndTime: to.Ptr("nauyrfh"), - // ID: to.Ptr("sf"), - // StartTime: to.Ptr("xuzwmfrhluafmwwsmzqxsytyehsh"), - // Status: to.Ptr("plbnngzfppdram"), - // } -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/emailconfiguration_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/emailconfiguration_client.go index 29623e9817c0..723a518eec26 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/emailconfiguration_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/emailconfiguration_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. @@ -46,7 +43,7 @@ func NewEmailConfigurationClient(subscriptionID string, credential azcore.TokenC // Create - Creates an alert configuration setting for the given vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - emailConfigurationName - The email configuration name. @@ -76,7 +73,7 @@ func (client *EmailConfigurationClient) Create(ctx context.Context, resourceGrou } // createCreateRequest creates the Create request. -func (client *EmailConfigurationClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, emailConfigurationName string, body EmailConfigurationModel, options *EmailConfigurationClientCreateOptions) (*policy.Request, error) { +func (client *EmailConfigurationClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, emailConfigurationName string, body EmailConfigurationModel, _ *EmailConfigurationClientCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -99,7 +96,7 @@ func (client *EmailConfigurationClient) createCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -120,7 +117,7 @@ func (client *EmailConfigurationClient) createHandleResponse(resp *http.Response // Get - Gets the details of the alert configuration setting. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - emailConfigurationName - The email configuration name. @@ -148,7 +145,7 @@ func (client *EmailConfigurationClient) Get(ctx context.Context, resourceGroupNa } // getCreateRequest creates the Get request. -func (client *EmailConfigurationClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, emailConfigurationName string, options *EmailConfigurationClientGetOptions) (*policy.Request, error) { +func (client *EmailConfigurationClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, emailConfigurationName string, _ *EmailConfigurationClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -171,7 +168,7 @@ func (client *EmailConfigurationClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -188,7 +185,7 @@ func (client *EmailConfigurationClient) getHandleResponse(resp *http.Response) ( // NewListPager - Gets the list of alert configuration settings for the given vault. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - options - EmailConfigurationClientListOptions contains the optional parameters for the EmailConfigurationClient.NewListPager @@ -217,7 +214,7 @@ func (client *EmailConfigurationClient) NewListPager(resourceGroupName string, v } // listCreateRequest creates the List request. -func (client *EmailConfigurationClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *EmailConfigurationClientListOptions) (*policy.Request, error) { +func (client *EmailConfigurationClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, _ *EmailConfigurationClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -236,7 +233,7 @@ func (client *EmailConfigurationClient) listCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -245,7 +242,7 @@ func (client *EmailConfigurationClient) listCreateRequest(ctx context.Context, r // listHandleResponse handles the List response. func (client *EmailConfigurationClient) listHandleResponse(resp *http.Response) (EmailConfigurationClientListResponse, error) { result := EmailConfigurationClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.EmailConfigurationModelCollection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.EmailConfigurationModelListResult); err != nil { return EmailConfigurationClientListResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/emailconfiguration_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/emailconfiguration_client_example_test.go deleted file mode 100644 index 5b8a05f0d56a..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/emailconfiguration_client_example_test.go +++ /dev/null @@ -1,151 +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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/EmailConfiguration_Get.json -func ExampleEmailConfigurationClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEmailConfigurationClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "0", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.EmailConfigurationModel = armrecoveryservicesdatareplication.EmailConfigurationModel{ - // Name: to.Ptr("ywjplnjzaeu"), - // Type: to.Ptr("bkaq"), - // ID: to.Ptr("bvbfy"), - // Properties: &armrecoveryservicesdatareplication.EmailConfigurationModelProperties{ - // CustomEmailAddresses: []*string{ - // to.Ptr("ketvbducyailcny")}, - // Locale: to.Ptr("vpnjxjvdqtebnucyxiyrjiko"), - // SendToOwners: to.Ptr(true), - // }, - // SystemData: &armrecoveryservicesdatareplication.EmailConfigurationModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), - // CreatedBy: to.Ptr("ewufpudzcjrljhmmzhfnxoqdqwnya"), - // CreatedByType: to.Ptr("zioqm"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), - // LastModifiedBy: to.Ptr("rx"), - // LastModifiedByType: to.Ptr("tqbvuqoakaaqij"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/EmailConfiguration_Create.json -func ExampleEmailConfigurationClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEmailConfigurationClient().Create(ctx, "rgrecoveryservicesdatareplication", "4", "0", armrecoveryservicesdatareplication.EmailConfigurationModel{ - Properties: &armrecoveryservicesdatareplication.EmailConfigurationModelProperties{ - CustomEmailAddresses: []*string{ - to.Ptr("ketvbducyailcny")}, - Locale: to.Ptr("vpnjxjvdqtebnucyxiyrjiko"), - SendToOwners: to.Ptr(true), - }, - }, 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.EmailConfigurationModel = armrecoveryservicesdatareplication.EmailConfigurationModel{ - // Name: to.Ptr("ywjplnjzaeu"), - // Type: to.Ptr("bkaq"), - // ID: to.Ptr("bvbfy"), - // Properties: &armrecoveryservicesdatareplication.EmailConfigurationModelProperties{ - // CustomEmailAddresses: []*string{ - // to.Ptr("ketvbducyailcny")}, - // Locale: to.Ptr("vpnjxjvdqtebnucyxiyrjiko"), - // SendToOwners: to.Ptr(true), - // }, - // SystemData: &armrecoveryservicesdatareplication.EmailConfigurationModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), - // CreatedBy: to.Ptr("ewufpudzcjrljhmmzhfnxoqdqwnya"), - // CreatedByType: to.Ptr("zioqm"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), - // LastModifiedBy: to.Ptr("rx"), - // LastModifiedByType: to.Ptr("tqbvuqoakaaqij"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/EmailConfiguration_List.json -func ExampleEmailConfigurationClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewEmailConfigurationClient().NewListPager("rgrecoveryservicesdatareplication", "4", 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.EmailConfigurationModelCollection = armrecoveryservicesdatareplication.EmailConfigurationModelCollection{ - // Value: []*armrecoveryservicesdatareplication.EmailConfigurationModel{ - // { - // Name: to.Ptr("ywjplnjzaeu"), - // Type: to.Ptr("bkaq"), - // ID: to.Ptr("bvbfy"), - // Properties: &armrecoveryservicesdatareplication.EmailConfigurationModelProperties{ - // CustomEmailAddresses: []*string{ - // to.Ptr("ketvbducyailcny")}, - // Locale: to.Ptr("vpnjxjvdqtebnucyxiyrjiko"), - // SendToOwners: to.Ptr(true), - // }, - // SystemData: &armrecoveryservicesdatareplication.EmailConfigurationModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), - // CreatedBy: to.Ptr("ewufpudzcjrljhmmzhfnxoqdqwnya"), - // CreatedByType: to.Ptr("zioqm"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), - // LastModifiedBy: to.Ptr("rx"), - // LastModifiedByType: to.Ptr("tqbvuqoakaaqij"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/event_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/event_client.go index 2e4d0ede5400..b17368eddc8a 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/event_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/event_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. @@ -17,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" + "strconv" "strings" ) @@ -46,7 +44,7 @@ func NewEventClient(subscriptionID string, credential azcore.TokenCredential, op // Get - Gets the details of the event. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - eventName - The event name. @@ -74,7 +72,7 @@ func (client *EventClient) Get(ctx context.Context, resourceGroupName string, va } // getCreateRequest creates the Get request. -func (client *EventClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, eventName string, options *EventClientGetOptions) (*policy.Request, error) { +func (client *EventClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, eventName string, _ *EventClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/events/{eventName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -97,7 +95,7 @@ func (client *EventClient) getCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -114,7 +112,7 @@ func (client *EventClient) getHandleResponse(resp *http.Response) (EventClientGe // NewListPager - Gets the list of events in the given vault. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - options - EventClientListOptions contains the optional parameters for the EventClient.NewListPager method. @@ -161,13 +159,16 @@ func (client *EventClient) listCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } + reqQP.Set("api-version", "2024-09-01") if options != nil && options.ContinuationToken != nil { reqQP.Set("continuationToken", *options.ContinuationToken) } - reqQP.Set("api-version", "2021-02-16-preview") + if options != nil && options.ODataOptions != nil { + reqQP.Set("odataOptions", *options.ODataOptions) + } + if options != nil && options.PageSize != nil { + reqQP.Set("pageSize", strconv.FormatInt(int64(*options.PageSize), 10)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -176,7 +177,7 @@ func (client *EventClient) listCreateRequest(ctx context.Context, resourceGroupN // listHandleResponse handles the List response. func (client *EventClient) listHandleResponse(resp *http.Response) (EventClientListResponse, error) { result := EventClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.EventModelCollection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.EventModelListResult); err != nil { return EventClientListResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/event_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/event_client_example_test.go deleted file mode 100644 index 27712dbc1d58..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/event_client_example_test.go +++ /dev/null @@ -1,183 +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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Event_Get.json -func ExampleEventClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEventClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "231CIG", 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.EventModel = armrecoveryservicesdatareplication.EventModel{ - // Name: to.Ptr("j"), - // Type: to.Ptr("lgk"), - // ID: to.Ptr("fgbppsytxctsrsxlfugyohhu"), - // Properties: &armrecoveryservicesdatareplication.EventModelProperties{ - // Description: to.Ptr("hkeiogebluvfpdgxogwesjmtbbok"), - // CorrelationID: to.Ptr("lwfsxforxnhvpmheujutjicflmxv"), - // CustomProperties: &armrecoveryservicesdatareplication.EventModelCustomProperties{ - // InstanceType: to.Ptr("EventModelCustomProperties"), - // }, - // EventName: to.Ptr("s"), - // EventType: to.Ptr("npumqmvspm"), - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, - // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), - // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ - // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), - // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), - // Severity: to.Ptr("wqxxiuaqjyagq"), - // Source: to.Ptr("wevvftugwydzzw"), - // Summary: to.Ptr("djsmgrltruljo"), - // }}, - // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), - // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), - // Source: to.Ptr("iy"), - // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // ResourceName: to.Ptr("yhpkowkbvtqnbiklnjzc"), - // ResourceType: to.Ptr("surgdzezskgregozynvlinfutyh"), - // Severity: to.Ptr("sjous"), - // TimeOfOccurrence: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.432Z"); return t}()), - // }, - // SystemData: &armrecoveryservicesdatareplication.EventModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.432Z"); return t}()), - // CreatedBy: to.Ptr("uske"), - // CreatedByType: to.Ptr("luzowppyxjalugkef"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.432Z"); return t}()), - // LastModifiedBy: to.Ptr("ufrixpmhben"), - // LastModifiedByType: to.Ptr("aubgraubkuaeipwzvbcgnlpseobx"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Event_List.json -func ExampleEventClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewEventClient().NewListPager("rgrecoveryservicesdatareplication", "4", &armrecoveryservicesdatareplication.EventClientListOptions{Filter: to.Ptr("wbglupjzvkirtgnnyasxom"), - ContinuationToken: to.Ptr("cxtufi"), - }) - 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.EventModelCollection = armrecoveryservicesdatareplication.EventModelCollection{ - // Value: []*armrecoveryservicesdatareplication.EventModel{ - // { - // Name: to.Ptr("j"), - // Type: to.Ptr("lgk"), - // ID: to.Ptr("fgbppsytxctsrsxlfugyohhu"), - // Properties: &armrecoveryservicesdatareplication.EventModelProperties{ - // Description: to.Ptr("hkeiogebluvfpdgxogwesjmtbbok"), - // CorrelationID: to.Ptr("lwfsxforxnhvpmheujutjicflmxv"), - // CustomProperties: &armrecoveryservicesdatareplication.EventModelCustomProperties{ - // InstanceType: to.Ptr("EventModelCustomProperties"), - // }, - // EventName: to.Ptr("s"), - // EventType: to.Ptr("npumqmvspm"), - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, - // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), - // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ - // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), - // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), - // Severity: to.Ptr("wqxxiuaqjyagq"), - // Source: to.Ptr("wevvftugwydzzw"), - // Summary: to.Ptr("djsmgrltruljo"), - // }}, - // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), - // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), - // Source: to.Ptr("iy"), - // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // ResourceName: to.Ptr("yhpkowkbvtqnbiklnjzc"), - // ResourceType: to.Ptr("surgdzezskgregozynvlinfutyh"), - // Severity: to.Ptr("sjous"), - // TimeOfOccurrence: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.432Z"); return t}()), - // }, - // SystemData: &armrecoveryservicesdatareplication.EventModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.432Z"); return t}()), - // CreatedBy: to.Ptr("uske"), - // CreatedByType: to.Ptr("luzowppyxjalugkef"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.432Z"); return t}()), - // LastModifiedBy: to.Ptr("ufrixpmhben"), - // LastModifiedByType: to.Ptr("aubgraubkuaeipwzvbcgnlpseobx"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabric_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabric_client.go index 26f1dd118309..24390ec01582 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabric_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabric_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. @@ -46,7 +43,7 @@ func NewFabricClient(subscriptionID string, credential azcore.TokenCredential, o // BeginCreate - Creates the fabric. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fabricName - The fabric name. // - body - Fabric properties. @@ -58,7 +55,7 @@ func (client *FabricClient) BeginCreate(ctx context.Context, resourceGroupName s return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FabricClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, Tracer: client.internal.Tracer(), }) return poller, err @@ -72,7 +69,7 @@ func (client *FabricClient) BeginCreate(ctx context.Context, resourceGroupName s // Create - Creates the fabric. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 func (client *FabricClient) create(ctx context.Context, resourceGroupName string, fabricName string, body FabricModel, options *FabricClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "FabricClient.BeginCreate" @@ -95,7 +92,7 @@ func (client *FabricClient) create(ctx context.Context, resourceGroupName string } // createCreateRequest creates the Create request. -func (client *FabricClient) createCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, body FabricModel, options *FabricClientBeginCreateOptions) (*policy.Request, error) { +func (client *FabricClient) createCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, body FabricModel, _ *FabricClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -114,7 +111,7 @@ func (client *FabricClient) createCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -126,7 +123,7 @@ func (client *FabricClient) createCreateRequest(ctx context.Context, resourceGro // BeginDelete - Removes the fabric. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fabricName - The fabric name. // - options - FabricClientBeginDeleteOptions contains the optional parameters for the FabricClient.BeginDelete method. @@ -151,7 +148,7 @@ func (client *FabricClient) BeginDelete(ctx context.Context, resourceGroupName s // Delete - Removes the fabric. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 func (client *FabricClient) deleteOperation(ctx context.Context, resourceGroupName string, fabricName string, options *FabricClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "FabricClient.BeginDelete" @@ -174,7 +171,7 @@ func (client *FabricClient) deleteOperation(ctx context.Context, resourceGroupNa } // deleteCreateRequest creates the Delete request. -func (client *FabricClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, options *FabricClientBeginDeleteOptions) (*policy.Request, error) { +func (client *FabricClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, _ *FabricClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -193,7 +190,7 @@ func (client *FabricClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -202,7 +199,7 @@ func (client *FabricClient) deleteCreateRequest(ctx context.Context, resourceGro // Get - Gets the details of the fabric. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fabricName - The fabric name. // - options - FabricClientGetOptions contains the optional parameters for the FabricClient.Get method. @@ -229,7 +226,7 @@ func (client *FabricClient) Get(ctx context.Context, resourceGroupName string, f } // getCreateRequest creates the Get request. -func (client *FabricClient) getCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, options *FabricClientGetOptions) (*policy.Request, error) { +func (client *FabricClient) getCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, _ *FabricClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -248,7 +245,7 @@ func (client *FabricClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -265,7 +262,7 @@ func (client *FabricClient) getHandleResponse(resp *http.Response) (FabricClient // NewListPager - Gets the list of fabrics in the given subscription and resource group. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - FabricClientListOptions contains the optional parameters for the FabricClient.NewListPager method. func (client *FabricClient) NewListPager(resourceGroupName string, options *FabricClientListOptions) *runtime.Pager[FabricClientListResponse] { @@ -307,10 +304,10 @@ func (client *FabricClient) listCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01") if options != nil && options.ContinuationToken != nil { reqQP.Set("continuationToken", *options.ContinuationToken) } - reqQP.Set("api-version", "2021-02-16-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -319,7 +316,7 @@ func (client *FabricClient) listCreateRequest(ctx context.Context, resourceGroup // listHandleResponse handles the List response. func (client *FabricClient) listHandleResponse(resp *http.Response) (FabricClientListResponse, error) { result := FabricClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.FabricModelCollection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.FabricModelListResult); err != nil { return FabricClientListResponse{}, err } return result, nil @@ -327,7 +324,7 @@ func (client *FabricClient) listHandleResponse(resp *http.Response) (FabricClien // NewListBySubscriptionPager - Gets the list of fabrics in the given subscription. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - options - FabricClientListBySubscriptionOptions contains the optional parameters for the FabricClient.NewListBySubscriptionPager // method. func (client *FabricClient) NewListBySubscriptionPager(options *FabricClientListBySubscriptionOptions) *runtime.Pager[FabricClientListBySubscriptionResponse] { @@ -354,7 +351,7 @@ func (client *FabricClient) NewListBySubscriptionPager(options *FabricClientList } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *FabricClient) listBySubscriptionCreateRequest(ctx context.Context, options *FabricClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *FabricClient) listBySubscriptionCreateRequest(ctx context.Context, _ *FabricClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationFabrics" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -365,10 +362,7 @@ func (client *FabricClient) listBySubscriptionCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - if options != nil && options.ContinuationToken != nil { - reqQP.Set("continuationToken", *options.ContinuationToken) - } - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -377,7 +371,7 @@ func (client *FabricClient) listBySubscriptionCreateRequest(ctx context.Context, // listBySubscriptionHandleResponse handles the ListBySubscription response. func (client *FabricClient) listBySubscriptionHandleResponse(resp *http.Response) (FabricClientListBySubscriptionResponse, error) { result := FabricClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.FabricModelCollection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.FabricModelListResult); err != nil { return FabricClientListBySubscriptionResponse{}, err } return result, nil @@ -386,7 +380,7 @@ func (client *FabricClient) listBySubscriptionHandleResponse(resp *http.Response // BeginUpdate - Performs update on the fabric. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fabricName - The fabric name. // - body - Fabric properties. @@ -412,7 +406,7 @@ func (client *FabricClient) BeginUpdate(ctx context.Context, resourceGroupName s // Update - Performs update on the fabric. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 func (client *FabricClient) update(ctx context.Context, resourceGroupName string, fabricName string, body FabricModelUpdate, options *FabricClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "FabricClient.BeginUpdate" @@ -435,7 +429,7 @@ func (client *FabricClient) update(ctx context.Context, resourceGroupName string } // updateCreateRequest creates the Update request. -func (client *FabricClient) updateCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, body FabricModelUpdate, options *FabricClientBeginUpdateOptions) (*policy.Request, error) { +func (client *FabricClient) updateCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, body FabricModelUpdate, _ *FabricClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -454,7 +448,7 @@ func (client *FabricClient) updateCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabric_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabric_client_example_test.go deleted file mode 100644 index def3033daaf4..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabric_client_example_test.go +++ /dev/null @@ -1,468 +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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_Get.json -func ExampleFabricClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFabricClient().Get(ctx, "rgrecoveryservicesdatareplication", "wPR", 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.FabricModel = armrecoveryservicesdatareplication.FabricModel{ - // Name: to.Ptr("rhojydcwjgvgexpdwswjib"), - // Type: to.Ptr("toipsryjyqchikyakeiuatshiu"), - // ID: to.Ptr("ycaxtshcmldt"), - // Location: to.Ptr("tqygutlpob"), - // Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.FabricModelCustomProperties{ - // InstanceType: to.Ptr("FabricModelCustomProperties"), - // }, - // Health: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, - // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), - // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ - // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), - // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), - // Severity: to.Ptr("wqxxiuaqjyagq"), - // Source: to.Ptr("wevvftugwydzzw"), - // Summary: to.Ptr("djsmgrltruljo"), - // }}, - // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), - // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), - // Source: to.Ptr("iy"), - // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("ilrfl"), - // ServiceResourceID: to.Ptr("xukigpdrbyyy"), - // }, - // SystemData: &armrecoveryservicesdatareplication.FabricModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), - // CreatedBy: to.Ptr("yhdmbqrsgimuucexvpas"), - // CreatedByType: to.Ptr("brnojz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), - // LastModifiedBy: to.Ptr("balecqnwu"), - // LastModifiedByType: to.Ptr("ukvqlncihf"), - // }, - // Tags: map[string]*string{ - // "key3917": to.Ptr("vgralu"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_Create.json -func ExampleFabricClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFabricClient().BeginCreate(ctx, "rgrecoveryservicesdatareplication", "wPR", armrecoveryservicesdatareplication.FabricModel{ - Location: to.Ptr("tqygutlpob"), - Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ - CustomProperties: &armrecoveryservicesdatareplication.FabricModelCustomProperties{ - InstanceType: to.Ptr("FabricModelCustomProperties"), - }, - }, - Tags: map[string]*string{ - "key3917": to.Ptr("vgralu"), - }, - }, 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.FabricModel = armrecoveryservicesdatareplication.FabricModel{ - // Name: to.Ptr("rhojydcwjgvgexpdwswjib"), - // Type: to.Ptr("toipsryjyqchikyakeiuatshiu"), - // ID: to.Ptr("ycaxtshcmldt"), - // Location: to.Ptr("tqygutlpob"), - // Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.FabricModelCustomProperties{ - // InstanceType: to.Ptr("FabricModelCustomProperties"), - // }, - // Health: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, - // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), - // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ - // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), - // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), - // Severity: to.Ptr("wqxxiuaqjyagq"), - // Source: to.Ptr("wevvftugwydzzw"), - // Summary: to.Ptr("djsmgrltruljo"), - // }}, - // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), - // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), - // Source: to.Ptr("iy"), - // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("ilrfl"), - // ServiceResourceID: to.Ptr("xukigpdrbyyy"), - // }, - // SystemData: &armrecoveryservicesdatareplication.FabricModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), - // CreatedBy: to.Ptr("yhdmbqrsgimuucexvpas"), - // CreatedByType: to.Ptr("brnojz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), - // LastModifiedBy: to.Ptr("balecqnwu"), - // LastModifiedByType: to.Ptr("ukvqlncihf"), - // }, - // Tags: map[string]*string{ - // "key3917": to.Ptr("vgralu"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_Update.json -func ExampleFabricClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFabricClient().BeginUpdate(ctx, "rgrecoveryservicesdatareplication", "wPR", armrecoveryservicesdatareplication.FabricModelUpdate{ - Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ - CustomProperties: &armrecoveryservicesdatareplication.FabricModelCustomProperties{ - InstanceType: to.Ptr("FabricModelCustomProperties"), - }, - }, - Tags: map[string]*string{ - "key6664": to.Ptr("def"), - }, - }, 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.FabricModel = armrecoveryservicesdatareplication.FabricModel{ - // Name: to.Ptr("rhojydcwjgvgexpdwswjib"), - // Type: to.Ptr("toipsryjyqchikyakeiuatshiu"), - // ID: to.Ptr("ycaxtshcmldt"), - // Location: to.Ptr("tqygutlpob"), - // Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.FabricModelCustomProperties{ - // InstanceType: to.Ptr("FabricModelCustomProperties"), - // }, - // Health: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, - // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), - // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ - // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), - // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), - // Severity: to.Ptr("wqxxiuaqjyagq"), - // Source: to.Ptr("wevvftugwydzzw"), - // Summary: to.Ptr("djsmgrltruljo"), - // }}, - // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), - // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), - // Source: to.Ptr("iy"), - // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("ilrfl"), - // ServiceResourceID: to.Ptr("xukigpdrbyyy"), - // }, - // SystemData: &armrecoveryservicesdatareplication.FabricModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), - // CreatedBy: to.Ptr("yhdmbqrsgimuucexvpas"), - // CreatedByType: to.Ptr("brnojz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), - // LastModifiedBy: to.Ptr("balecqnwu"), - // LastModifiedByType: to.Ptr("ukvqlncihf"), - // }, - // Tags: map[string]*string{ - // "key3917": to.Ptr("vgralu"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_Delete.json -func ExampleFabricClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFabricClient().BeginDelete(ctx, "rgrecoveryservicesdatareplication", "wPR", 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/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_ListBySubscription.json -func ExampleFabricClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewFabricClient().NewListBySubscriptionPager(&armrecoveryservicesdatareplication.FabricClientListBySubscriptionOptions{ContinuationToken: to.Ptr("rmgqrpzucsizbyjscxzockbiyg")}) - 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.FabricModelCollection = armrecoveryservicesdatareplication.FabricModelCollection{ - // Value: []*armrecoveryservicesdatareplication.FabricModel{ - // { - // Name: to.Ptr("rhojydcwjgvgexpdwswjib"), - // Type: to.Ptr("toipsryjyqchikyakeiuatshiu"), - // ID: to.Ptr("ycaxtshcmldt"), - // Location: to.Ptr("tqygutlpob"), - // Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.FabricModelCustomProperties{ - // InstanceType: to.Ptr("FabricModelCustomProperties"), - // }, - // Health: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, - // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), - // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ - // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), - // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), - // Severity: to.Ptr("wqxxiuaqjyagq"), - // Source: to.Ptr("wevvftugwydzzw"), - // Summary: to.Ptr("djsmgrltruljo"), - // }}, - // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), - // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), - // Source: to.Ptr("iy"), - // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("ilrfl"), - // ServiceResourceID: to.Ptr("xukigpdrbyyy"), - // }, - // SystemData: &armrecoveryservicesdatareplication.FabricModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), - // CreatedBy: to.Ptr("yhdmbqrsgimuucexvpas"), - // CreatedByType: to.Ptr("brnojz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), - // LastModifiedBy: to.Ptr("balecqnwu"), - // LastModifiedByType: to.Ptr("ukvqlncihf"), - // }, - // Tags: map[string]*string{ - // "key3917": to.Ptr("vgralu"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_List.json -func ExampleFabricClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewFabricClient().NewListPager("rgrecoveryservicesdatareplication", &armrecoveryservicesdatareplication.FabricClientListOptions{ContinuationToken: to.Ptr("mjzsxwwmtvd")}) - 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.FabricModelCollection = armrecoveryservicesdatareplication.FabricModelCollection{ - // Value: []*armrecoveryservicesdatareplication.FabricModel{ - // { - // Name: to.Ptr("rhojydcwjgvgexpdwswjib"), - // Type: to.Ptr("toipsryjyqchikyakeiuatshiu"), - // ID: to.Ptr("ycaxtshcmldt"), - // Location: to.Ptr("tqygutlpob"), - // Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.FabricModelCustomProperties{ - // InstanceType: to.Ptr("FabricModelCustomProperties"), - // }, - // Health: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, - // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), - // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ - // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), - // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), - // Severity: to.Ptr("wqxxiuaqjyagq"), - // Source: to.Ptr("wevvftugwydzzw"), - // Summary: to.Ptr("djsmgrltruljo"), - // }}, - // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), - // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), - // Source: to.Ptr("iy"), - // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("ilrfl"), - // ServiceResourceID: to.Ptr("xukigpdrbyyy"), - // }, - // SystemData: &armrecoveryservicesdatareplication.FabricModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), - // CreatedBy: to.Ptr("yhdmbqrsgimuucexvpas"), - // CreatedByType: to.Ptr("brnojz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), - // LastModifiedBy: to.Ptr("balecqnwu"), - // LastModifiedByType: to.Ptr("ukvqlncihf"), - // }, - // Tags: map[string]*string{ - // "key3917": to.Ptr("vgralu"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/dra_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricagent_client.go similarity index 68% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/dra_client.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricagent_client.go index 72dc6e811e53..0a1b075c106d 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/dra_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricagent_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. @@ -20,23 +17,23 @@ import ( "strings" ) -// DraClient contains the methods for the Dra group. -// Don't use this type directly, use NewDraClient() instead. -type DraClient struct { +// FabricAgentClient contains the methods for the FabricAgent group. +// Don't use this type directly, use NewFabricAgentClient() instead. +type FabricAgentClient struct { internal *arm.Client subscriptionID string } -// NewDraClient creates a new instance of DraClient with the specified values. +// NewFabricAgentClient creates a new instance of FabricAgentClient with the specified values. // - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. -func NewDraClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DraClient, error) { +func NewFabricAgentClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FabricAgentClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } - client := &DraClient{ + client := &FabricAgentClient{ subscriptionID: subscriptionID, internal: cl, } @@ -46,25 +43,25 @@ func NewDraClient(subscriptionID string, credential azcore.TokenCredential, opti // BeginCreate - Creates the fabric agent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fabricName - The fabric name. -// - fabricAgentName - The fabric agent (Dra) name. -// - body - Dra model. -// - options - DraClientBeginCreateOptions contains the optional parameters for the DraClient.BeginCreate method. -func (client *DraClient) BeginCreate(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, body DraModel, options *DraClientBeginCreateOptions) (*runtime.Poller[DraClientCreateResponse], error) { +// - fabricAgentName - The fabric agent name. +// - body - Fabric agent model. +// - options - FabricAgentClientBeginCreateOptions contains the optional parameters for the FabricAgentClient.BeginCreate method. +func (client *FabricAgentClient) BeginCreate(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, body FabricAgentModel, options *FabricAgentClientBeginCreateOptions) (*runtime.Poller[FabricAgentClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.create(ctx, resourceGroupName, fabricName, fabricAgentName, body, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DraClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FabricAgentClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DraClientCreateResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FabricAgentClientCreateResponse]{ Tracer: client.internal.Tracer(), }) } @@ -73,10 +70,10 @@ func (client *DraClient) BeginCreate(ctx context.Context, resourceGroupName stri // Create - Creates the fabric agent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview -func (client *DraClient) create(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, body DraModel, options *DraClientBeginCreateOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *FabricAgentClient) create(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, body FabricAgentModel, options *FabricAgentClientBeginCreateOptions) (*http.Response, error) { var err error - const operationName = "DraClient.BeginCreate" + const operationName = "FabricAgentClient.BeginCreate" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() @@ -96,7 +93,7 @@ func (client *DraClient) create(ctx context.Context, resourceGroupName string, f } // createCreateRequest creates the Create request. -func (client *DraClient) createCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, body DraModel, options *DraClientBeginCreateOptions) (*policy.Request, error) { +func (client *FabricAgentClient) createCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, body FabricAgentModel, _ *FabricAgentClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -119,7 +116,7 @@ func (client *DraClient) createCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -128,39 +125,39 @@ func (client *DraClient) createCreateRequest(ctx context.Context, resourceGroupN return req, nil } -// BeginDelete - Deletes the fabric agent. +// BeginDelete - Deletes fabric agent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fabricName - The fabric name. -// - fabricAgentName - The fabric agent (Dra) name. -// - options - DraClientBeginDeleteOptions contains the optional parameters for the DraClient.BeginDelete method. -func (client *DraClient) BeginDelete(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *DraClientBeginDeleteOptions) (*runtime.Poller[DraClientDeleteResponse], error) { +// - fabricAgentName - The fabric agent name. +// - options - FabricAgentClientBeginDeleteOptions contains the optional parameters for the FabricAgentClient.BeginDelete method. +func (client *FabricAgentClient) BeginDelete(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *FabricAgentClientBeginDeleteOptions) (*runtime.Poller[FabricAgentClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, fabricName, fabricAgentName, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DraClientDeleteResponse]{ + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FabricAgentClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DraClientDeleteResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FabricAgentClientDeleteResponse]{ Tracer: client.internal.Tracer(), }) } } -// Delete - Deletes the fabric agent. +// Delete - Deletes fabric agent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview -func (client *DraClient) deleteOperation(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *DraClientBeginDeleteOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *FabricAgentClient) deleteOperation(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *FabricAgentClientBeginDeleteOptions) (*http.Response, error) { var err error - const operationName = "DraClient.BeginDelete" + const operationName = "FabricAgentClient.BeginDelete" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() @@ -180,7 +177,7 @@ func (client *DraClient) deleteOperation(ctx context.Context, resourceGroupName } // deleteCreateRequest creates the Delete request. -func (client *DraClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *DraClientBeginDeleteOptions) (*policy.Request, error) { +func (client *FabricAgentClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, _ *FabricAgentClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -203,7 +200,7 @@ func (client *DraClient) deleteCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -212,35 +209,35 @@ func (client *DraClient) deleteCreateRequest(ctx context.Context, resourceGroupN // Get - Gets the details of the fabric agent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fabricName - The fabric name. -// - fabricAgentName - The fabric agent (Dra) name. -// - options - DraClientGetOptions contains the optional parameters for the DraClient.Get method. -func (client *DraClient) Get(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *DraClientGetOptions) (DraClientGetResponse, error) { +// - fabricAgentName - The fabric agent name. +// - options - FabricAgentClientGetOptions contains the optional parameters for the FabricAgentClient.Get method. +func (client *FabricAgentClient) Get(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *FabricAgentClientGetOptions) (FabricAgentClientGetResponse, error) { var err error - const operationName = "DraClient.Get" + const operationName = "FabricAgentClient.Get" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, fabricName, fabricAgentName, options) if err != nil { - return DraClientGetResponse{}, err + return FabricAgentClientGetResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return DraClientGetResponse{}, err + return FabricAgentClientGetResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return DraClientGetResponse{}, err + return FabricAgentClientGetResponse{}, err } resp, err := client.getHandleResponse(httpResp) return resp, err } // getCreateRequest creates the Get request. -func (client *DraClient) getCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *DraClientGetOptions) (*policy.Request, error) { +func (client *FabricAgentClient) getCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, _ *FabricAgentClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -263,34 +260,34 @@ func (client *DraClient) getCreateRequest(ctx context.Context, resourceGroupName return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // getHandleResponse handles the Get response. -func (client *DraClient) getHandleResponse(resp *http.Response) (DraClientGetResponse, error) { - result := DraClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DraModel); err != nil { - return DraClientGetResponse{}, err +func (client *FabricAgentClient) getHandleResponse(resp *http.Response) (FabricAgentClientGetResponse, error) { + result := FabricAgentClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FabricAgentModel); err != nil { + return FabricAgentClientGetResponse{}, err } return result, nil } // NewListPager - Gets the list of fabric agents in the given fabric. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fabricName - The fabric name. -// - options - DraClientListOptions contains the optional parameters for the DraClient.NewListPager method. -func (client *DraClient) NewListPager(resourceGroupName string, fabricName string, options *DraClientListOptions) *runtime.Pager[DraClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[DraClientListResponse]{ - More: func(page DraClientListResponse) bool { +// - options - FabricAgentClientListOptions contains the optional parameters for the FabricAgentClient.NewListPager method. +func (client *FabricAgentClient) NewListPager(resourceGroupName string, fabricName string, options *FabricAgentClientListOptions) *runtime.Pager[FabricAgentClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[FabricAgentClientListResponse]{ + More: func(page FabricAgentClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *DraClientListResponse) (DraClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DraClient.NewListPager") + Fetcher: func(ctx context.Context, page *FabricAgentClientListResponse) (FabricAgentClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "FabricAgentClient.NewListPager") nextLink := "" if page != nil { nextLink = *page.NextLink @@ -299,7 +296,7 @@ func (client *DraClient) NewListPager(resourceGroupName string, fabricName strin return client.listCreateRequest(ctx, resourceGroupName, fabricName, options) }, nil) if err != nil { - return DraClientListResponse{}, err + return FabricAgentClientListResponse{}, err } return client.listHandleResponse(resp) }, @@ -308,7 +305,7 @@ func (client *DraClient) NewListPager(resourceGroupName string, fabricName strin } // listCreateRequest creates the List request. -func (client *DraClient) listCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, options *DraClientListOptions) (*policy.Request, error) { +func (client *FabricAgentClient) listCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, _ *FabricAgentClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -327,17 +324,17 @@ func (client *DraClient) listCreateRequest(ctx context.Context, resourceGroupNam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // listHandleResponse handles the List response. -func (client *DraClient) listHandleResponse(resp *http.Response) (DraClientListResponse, error) { - result := DraClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DraModelCollection); err != nil { - return DraClientListResponse{}, err +func (client *FabricAgentClient) listHandleResponse(resp *http.Response) (FabricAgentClientListResponse, error) { + result := FabricAgentClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FabricAgentModelListResult); err != nil { + return FabricAgentClientListResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricoperationsstatus_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricoperationsstatus_client_example_test.go deleted file mode 100644 index aa16c991ae06..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricoperationsstatus_client_example_test.go +++ /dev/null @@ -1,45 +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 armrecoveryservicesdatareplication_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/FabricOperationsStatus_Get.json -func ExampleFabricOperationsStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFabricOperationsStatusClient().Get(ctx, "rgrecoveryservicesdatareplication", "wPR", "dvfwerv", 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.OperationStatus = armrecoveryservicesdatareplication.OperationStatus{ - // Name: to.Ptr("wzdasptnwlxgobklayoqapjcgcf"), - // EndTime: to.Ptr("nauyrfh"), - // ID: to.Ptr("sf"), - // StartTime: to.Ptr("xuzwmfrhluafmwwsmzqxsytyehsh"), - // Status: to.Ptr("plbnngzfppdram"), - // } -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/azuresiterecoverymanagementserviceapi_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/azuresiterecoverymanagementserviceapi_server.go deleted file mode 100644 index 0ee5620aab6e..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/azuresiterecoverymanagementserviceapi_server.go +++ /dev/null @@ -1,156 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// AzureSiteRecoveryManagementServiceAPIServer is a fake server for instances of the armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClient type. -type AzureSiteRecoveryManagementServiceAPIServer struct { - // CheckNameAvailability is the fake for method AzureSiteRecoveryManagementServiceAPIClient.CheckNameAvailability - // HTTP status codes to indicate success: http.StatusOK - CheckNameAvailability func(ctx context.Context, location string, options *armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityResponse], errResp azfake.ErrorResponder) - - // DeploymentPreflight is the fake for method AzureSiteRecoveryManagementServiceAPIClient.DeploymentPreflight - // HTTP status codes to indicate success: http.StatusOK - DeploymentPreflight func(ctx context.Context, resourceGroupName string, deploymentID string, options *armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightResponse], errResp azfake.ErrorResponder) -} - -// NewAzureSiteRecoveryManagementServiceAPIServerTransport creates a new instance of AzureSiteRecoveryManagementServiceAPIServerTransport with the provided implementation. -// The returned AzureSiteRecoveryManagementServiceAPIServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAzureSiteRecoveryManagementServiceAPIServerTransport(srv *AzureSiteRecoveryManagementServiceAPIServer) *AzureSiteRecoveryManagementServiceAPIServerTransport { - return &AzureSiteRecoveryManagementServiceAPIServerTransport{srv: srv} -} - -// AzureSiteRecoveryManagementServiceAPIServerTransport connects instances of armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClient to instances of AzureSiteRecoveryManagementServiceAPIServer. -// Don't use this type directly, use NewAzureSiteRecoveryManagementServiceAPIServerTransport instead. -type AzureSiteRecoveryManagementServiceAPIServerTransport struct { - srv *AzureSiteRecoveryManagementServiceAPIServer -} - -// Do implements the policy.Transporter interface for AzureSiteRecoveryManagementServiceAPIServerTransport. -func (a *AzureSiteRecoveryManagementServiceAPIServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "AzureSiteRecoveryManagementServiceAPIClient.CheckNameAvailability": - resp, err = a.dispatchCheckNameAvailability(req) - case "AzureSiteRecoveryManagementServiceAPIClient.DeploymentPreflight": - resp, err = a.dispatchDeploymentPreflight(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AzureSiteRecoveryManagementServiceAPIServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { - if a.srv.CheckNameAvailability == nil { - return nil, &nonRetriableError{errors.New("fake for method CheckNameAvailability not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/checkNameAvailability` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.CheckNameAvailabilityModel](req) - if err != nil { - return nil, err - } - locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) - if err != nil { - return nil, err - } - var options *armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityOptions - if !reflect.ValueOf(body).IsZero() { - options = &armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityOptions{ - Body: &body, - } - } - respr, errRespr := a.srv.CheckNameAvailability(req.Context(), locationParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CheckNameAvailabilityResponseModel, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AzureSiteRecoveryManagementServiceAPIServerTransport) dispatchDeploymentPreflight(req *http.Request) (*http.Response, error) { - if a.srv.DeploymentPreflight == nil { - return nil, &nonRetriableError{errors.New("fake for method DeploymentPreflight not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/deployments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/preflight` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.DeploymentPreflightModel](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - deploymentIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("deploymentId")]) - if err != nil { - return nil, err - } - var options *armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightOptions - if !reflect.ValueOf(body).IsZero() { - options = &armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightOptions{ - Body: &body, - } - } - respr, errRespr := a.srv.DeploymentPreflight(req.Context(), resourceGroupNameParam, deploymentIDParam, options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DeploymentPreflightModel, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/checknameavailability_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/checknameavailability_server.go new file mode 100644 index 000000000000..0ae7d8e944d0 --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/checknameavailability_server.go @@ -0,0 +1,129 @@ +// 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 ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "net/http" + "net/url" + "reflect" + "regexp" +) + +// CheckNameAvailabilityServer is a fake server for instances of the armrecoveryservicesdatareplication.CheckNameAvailabilityClient type. +type CheckNameAvailabilityServer struct { + // Post is the fake for method CheckNameAvailabilityClient.Post + // HTTP status codes to indicate success: http.StatusOK + Post func(ctx context.Context, location string, options *armrecoveryservicesdatareplication.CheckNameAvailabilityClientPostOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.CheckNameAvailabilityClientPostResponse], errResp azfake.ErrorResponder) +} + +// NewCheckNameAvailabilityServerTransport creates a new instance of CheckNameAvailabilityServerTransport with the provided implementation. +// The returned CheckNameAvailabilityServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.CheckNameAvailabilityClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewCheckNameAvailabilityServerTransport(srv *CheckNameAvailabilityServer) *CheckNameAvailabilityServerTransport { + return &CheckNameAvailabilityServerTransport{srv: srv} +} + +// CheckNameAvailabilityServerTransport connects instances of armrecoveryservicesdatareplication.CheckNameAvailabilityClient to instances of CheckNameAvailabilityServer. +// Don't use this type directly, use NewCheckNameAvailabilityServerTransport instead. +type CheckNameAvailabilityServerTransport struct { + srv *CheckNameAvailabilityServer +} + +// Do implements the policy.Transporter interface for CheckNameAvailabilityServerTransport. +func (c *CheckNameAvailabilityServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return c.dispatchToMethodFake(req, method) +} + +func (c *CheckNameAvailabilityServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if checkNameAvailabilityServerTransportInterceptor != nil { + res.resp, res.err, intercepted = checkNameAvailabilityServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CheckNameAvailabilityClient.Post": + res.resp, res.err = c.dispatchPost(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 (c *CheckNameAvailabilityServerTransport) dispatchPost(req *http.Request) (*http.Response, error) { + if c.srv.Post == nil { + return nil, &nonRetriableError{errors.New("fake for method Post not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/checkNameAvailability` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.CheckNameAvailabilityModel](req) + if err != nil { + return nil, err + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + var options *armrecoveryservicesdatareplication.CheckNameAvailabilityClientPostOptions + if !reflect.ValueOf(body).IsZero() { + options = &armrecoveryservicesdatareplication.CheckNameAvailabilityClientPostOptions{ + Body: &body, + } + } + respr, errRespr := c.srv.Post(req.Context(), locationParam, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CheckNameAvailabilityResponseModel, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to CheckNameAvailabilityServerTransport +var checkNameAvailabilityServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/deploymentpreflight_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/deploymentpreflight_server.go new file mode 100644 index 000000000000..30f82ebe955f --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/deploymentpreflight_server.go @@ -0,0 +1,133 @@ +// 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 ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "net/http" + "net/url" + "reflect" + "regexp" +) + +// DeploymentPreflightServer is a fake server for instances of the armrecoveryservicesdatareplication.DeploymentPreflightClient type. +type DeploymentPreflightServer struct { + // Post is the fake for method DeploymentPreflightClient.Post + // HTTP status codes to indicate success: http.StatusOK + Post func(ctx context.Context, resourceGroupName string, deploymentID string, options *armrecoveryservicesdatareplication.DeploymentPreflightClientPostOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.DeploymentPreflightClientPostResponse], errResp azfake.ErrorResponder) +} + +// NewDeploymentPreflightServerTransport creates a new instance of DeploymentPreflightServerTransport with the provided implementation. +// The returned DeploymentPreflightServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.DeploymentPreflightClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewDeploymentPreflightServerTransport(srv *DeploymentPreflightServer) *DeploymentPreflightServerTransport { + return &DeploymentPreflightServerTransport{srv: srv} +} + +// DeploymentPreflightServerTransport connects instances of armrecoveryservicesdatareplication.DeploymentPreflightClient to instances of DeploymentPreflightServer. +// Don't use this type directly, use NewDeploymentPreflightServerTransport instead. +type DeploymentPreflightServerTransport struct { + srv *DeploymentPreflightServer +} + +// Do implements the policy.Transporter interface for DeploymentPreflightServerTransport. +func (d *DeploymentPreflightServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return d.dispatchToMethodFake(req, method) +} + +func (d *DeploymentPreflightServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if deploymentPreflightServerTransportInterceptor != nil { + res.resp, res.err, intercepted = deploymentPreflightServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DeploymentPreflightClient.Post": + res.resp, res.err = d.dispatchPost(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 (d *DeploymentPreflightServerTransport) dispatchPost(req *http.Request) (*http.Response, error) { + if d.srv.Post == nil { + return nil, &nonRetriableError{errors.New("fake for method Post not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/deployments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/preflight` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.DeploymentPreflightModel](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + deploymentIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("deploymentId")]) + if err != nil { + return nil, err + } + var options *armrecoveryservicesdatareplication.DeploymentPreflightClientPostOptions + if !reflect.ValueOf(body).IsZero() { + options = &armrecoveryservicesdatareplication.DeploymentPreflightClientPostOptions{ + Body: &body, + } + } + respr, errRespr := d.srv.Post(req.Context(), resourceGroupNameParam, deploymentIDParam, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DeploymentPreflightModel, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to DeploymentPreflightServerTransport +var deploymentPreflightServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/draoperationstatus_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/draoperationstatus_server.go deleted file mode 100644 index a75730929104..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/draoperationstatus_server.go +++ /dev/null @@ -1,108 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" - "net/http" - "net/url" - "regexp" -) - -// DraOperationStatusServer is a fake server for instances of the armrecoveryservicesdatareplication.DraOperationStatusClient type. -type DraOperationStatusServer struct { - // Get is the fake for method DraOperationStatusClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, operationID string, options *armrecoveryservicesdatareplication.DraOperationStatusClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.DraOperationStatusClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewDraOperationStatusServerTransport creates a new instance of DraOperationStatusServerTransport with the provided implementation. -// The returned DraOperationStatusServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.DraOperationStatusClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewDraOperationStatusServerTransport(srv *DraOperationStatusServer) *DraOperationStatusServerTransport { - return &DraOperationStatusServerTransport{srv: srv} -} - -// DraOperationStatusServerTransport connects instances of armrecoveryservicesdatareplication.DraOperationStatusClient to instances of DraOperationStatusServer. -// Don't use this type directly, use NewDraOperationStatusServerTransport instead. -type DraOperationStatusServerTransport struct { - srv *DraOperationStatusServer -} - -// Do implements the policy.Transporter interface for DraOperationStatusServerTransport. -func (d *DraOperationStatusServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "DraOperationStatusClient.Get": - resp, err = d.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (d *DraOperationStatusServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if d.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fabricAgents/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) - if err != nil { - return nil, err - } - fabricAgentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricAgentName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, fabricNameParam, fabricAgentNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/emailconfiguration_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/emailconfiguration_server.go index f83de718be7b..79634b7965c4 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/emailconfiguration_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/emailconfiguration_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. @@ -62,25 +59,44 @@ func (e *EmailConfigurationServerTransport) Do(req *http.Request) (*http.Respons return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return e.dispatchToMethodFake(req, method) +} - switch method { - case "EmailConfigurationClient.Create": - resp, err = e.dispatchCreate(req) - case "EmailConfigurationClient.Get": - resp, err = e.dispatchGet(req) - case "EmailConfigurationClient.NewListPager": - resp, err = e.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (e *EmailConfigurationServerTransport) 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 emailConfigurationServerTransportInterceptor != nil { + res.resp, res.err, intercepted = emailConfigurationServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "EmailConfigurationClient.Create": + res.resp, res.err = e.dispatchCreate(req) + case "EmailConfigurationClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "EmailConfigurationClient.NewListPager": + res.resp, res.err = e.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 (e *EmailConfigurationServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { @@ -201,3 +217,9 @@ func (e *EmailConfigurationServerTransport) dispatchNewListPager(req *http.Reque } return resp, nil } + +// set this to conditionally intercept incoming requests to EmailConfigurationServerTransport +var emailConfigurationServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/event_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/event_server.go index d90d1ea812b1..71a5f3fa8824 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/event_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/event_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. @@ -20,6 +17,7 @@ import ( "net/http" "net/url" "regexp" + "strconv" ) // EventServer is a fake server for instances of the armrecoveryservicesdatareplication.EventClient type. @@ -58,23 +56,42 @@ func (e *EventServerTransport) 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 e.dispatchToMethodFake(req, method) +} - switch method { - case "EventClient.Get": - resp, err = e.dispatchGet(req) - case "EventClient.NewListPager": - resp, err = e.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (e *EventServerTransport) 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 eventServerTransportInterceptor != nil { + res.resp, res.err, intercepted = eventServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "EventClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "EventClient.NewListPager": + res.resp, res.err = e.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 (e *EventServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -131,25 +148,40 @@ func (e *EventServerTransport) dispatchNewListPager(req *http.Request) (*http.Re if err != nil { return nil, err } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + oDataOptionsUnescaped, err := url.QueryUnescape(qp.Get("odataOptions")) if err != nil { return nil, err } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + oDataOptionsParam := getOptional(oDataOptionsUnescaped) + continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) if err != nil { return nil, err } - filterParam := getOptional(filterUnescaped) - continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) + continuationTokenParam := getOptional(continuationTokenUnescaped) + pageSizeUnescaped, err := url.QueryUnescape(qp.Get("pageSize")) + if err != nil { + return nil, err + } + pageSizeParam, err := parseOptional(pageSizeUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) if err != nil { return nil, err } - continuationTokenParam := getOptional(continuationTokenUnescaped) var options *armrecoveryservicesdatareplication.EventClientListOptions - if filterParam != nil || continuationTokenParam != nil { + if oDataOptionsParam != nil || continuationTokenParam != nil || pageSizeParam != nil { options = &armrecoveryservicesdatareplication.EventClientListOptions{ - Filter: filterParam, + ODataOptions: oDataOptionsParam, ContinuationToken: continuationTokenParam, + PageSize: pageSizeParam, } } resp := e.srv.NewListPager(resourceGroupNameParam, vaultNameParam, options) @@ -172,3 +204,9 @@ func (e *EventServerTransport) dispatchNewListPager(req *http.Request) (*http.Re } return resp, nil } + +// set this to conditionally intercept incoming requests to EventServerTransport +var eventServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabric_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabric_server.go index 5796316ad798..5e795ebe4894 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabric_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabric_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. @@ -29,7 +26,7 @@ type FabricServer struct { BeginCreate func(ctx context.Context, resourceGroupName string, fabricName string, body armrecoveryservicesdatareplication.FabricModel, options *armrecoveryservicesdatareplication.FabricClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.FabricClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method FabricClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, fabricName string, options *armrecoveryservicesdatareplication.FabricClientBeginDeleteOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.FabricClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method FabricClient.Get @@ -82,31 +79,50 @@ func (f *FabricServerTransport) 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 f.dispatchToMethodFake(req, method) +} - switch method { - case "FabricClient.BeginCreate": - resp, err = f.dispatchBeginCreate(req) - case "FabricClient.BeginDelete": - resp, err = f.dispatchBeginDelete(req) - case "FabricClient.Get": - resp, err = f.dispatchGet(req) - case "FabricClient.NewListPager": - resp, err = f.dispatchNewListPager(req) - case "FabricClient.NewListBySubscriptionPager": - resp, err = f.dispatchNewListBySubscriptionPager(req) - case "FabricClient.BeginUpdate": - resp, err = f.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (f *FabricServerTransport) 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 fabricServerTransportInterceptor != nil { + res.resp, res.err, intercepted = fabricServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "FabricClient.BeginCreate": + res.resp, res.err = f.dispatchBeginCreate(req) + case "FabricClient.BeginDelete": + res.resp, res.err = f.dispatchBeginDelete(req) + case "FabricClient.Get": + res.resp, res.err = f.dispatchGet(req) + case "FabricClient.NewListPager": + res.resp, res.err = f.dispatchNewListPager(req) + case "FabricClient.NewListBySubscriptionPager": + res.resp, res.err = f.dispatchNewListBySubscriptionPager(req) + case "FabricClient.BeginUpdate": + res.resp, res.err = f.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (f *FabricServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -190,9 +206,9 @@ func (f *FabricServerTransport) dispatchBeginDelete(req *http.Request) (*http.Re return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { f.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { f.beginDelete.remove(req) @@ -295,19 +311,7 @@ func (f *FabricServerTransport) dispatchNewListBySubscriptionPager(req *http.Req if matches == nil || len(matches) < 1 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - qp := req.URL.Query() - continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) - if err != nil { - return nil, err - } - continuationTokenParam := getOptional(continuationTokenUnescaped) - var options *armrecoveryservicesdatareplication.FabricClientListBySubscriptionOptions - if continuationTokenParam != nil { - options = &armrecoveryservicesdatareplication.FabricClientListBySubscriptionOptions{ - ContinuationToken: continuationTokenParam, - } - } - resp := f.srv.NewListBySubscriptionPager(options) + resp := f.srv.NewListBySubscriptionPager(nil) newListBySubscriptionPager = &resp f.newListBySubscriptionPager.add(req, newListBySubscriptionPager) server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armrecoveryservicesdatareplication.FabricClientListBySubscriptionResponse, createLink func() string) { @@ -375,3 +379,9 @@ func (f *FabricServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Re return resp, nil } + +// set this to conditionally intercept incoming requests to FabricServerTransport +var fabricServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/dra_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabricagent_server.go similarity index 60% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/dra_server.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabricagent_server.go index a143f61daa2e..db026dee3997 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/dra_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabricagent_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. @@ -22,82 +19,101 @@ import ( "regexp" ) -// DraServer is a fake server for instances of the armrecoveryservicesdatareplication.DraClient type. -type DraServer struct { - // BeginCreate is the fake for method DraClient.BeginCreate +// FabricAgentServer is a fake server for instances of the armrecoveryservicesdatareplication.FabricAgentClient type. +type FabricAgentServer struct { + // BeginCreate is the fake for method FabricAgentClient.BeginCreate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, body armrecoveryservicesdatareplication.DraModel, options *armrecoveryservicesdatareplication.DraClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.DraClientCreateResponse], errResp azfake.ErrorResponder) + BeginCreate func(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, body armrecoveryservicesdatareplication.FabricAgentModel, options *armrecoveryservicesdatareplication.FabricAgentClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.FabricAgentClientCreateResponse], errResp azfake.ErrorResponder) - // BeginDelete is the fake for method DraClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *armrecoveryservicesdatareplication.DraClientBeginDeleteOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.DraClientDeleteResponse], errResp azfake.ErrorResponder) + // BeginDelete is the fake for method FabricAgentClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *armrecoveryservicesdatareplication.FabricAgentClientBeginDeleteOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.FabricAgentClientDeleteResponse], errResp azfake.ErrorResponder) - // Get is the fake for method DraClient.Get + // Get is the fake for method FabricAgentClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *armrecoveryservicesdatareplication.DraClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.DraClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *armrecoveryservicesdatareplication.FabricAgentClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.FabricAgentClientGetResponse], errResp azfake.ErrorResponder) - // NewListPager is the fake for method DraClient.NewListPager + // NewListPager is the fake for method FabricAgentClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, fabricName string, options *armrecoveryservicesdatareplication.DraClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesdatareplication.DraClientListResponse]) + NewListPager func(resourceGroupName string, fabricName string, options *armrecoveryservicesdatareplication.FabricAgentClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesdatareplication.FabricAgentClientListResponse]) } -// NewDraServerTransport creates a new instance of DraServerTransport with the provided implementation. -// The returned DraServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.DraClient via the +// NewFabricAgentServerTransport creates a new instance of FabricAgentServerTransport with the provided implementation. +// The returned FabricAgentServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.FabricAgentClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewDraServerTransport(srv *DraServer) *DraServerTransport { - return &DraServerTransport{ +func NewFabricAgentServerTransport(srv *FabricAgentServer) *FabricAgentServerTransport { + return &FabricAgentServerTransport{ srv: srv, - beginCreate: newTracker[azfake.PollerResponder[armrecoveryservicesdatareplication.DraClientCreateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armrecoveryservicesdatareplication.DraClientDeleteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesdatareplication.DraClientListResponse]](), + beginCreate: newTracker[azfake.PollerResponder[armrecoveryservicesdatareplication.FabricAgentClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armrecoveryservicesdatareplication.FabricAgentClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesdatareplication.FabricAgentClientListResponse]](), } } -// DraServerTransport connects instances of armrecoveryservicesdatareplication.DraClient to instances of DraServer. -// Don't use this type directly, use NewDraServerTransport instead. -type DraServerTransport struct { - srv *DraServer - beginCreate *tracker[azfake.PollerResponder[armrecoveryservicesdatareplication.DraClientCreateResponse]] - beginDelete *tracker[azfake.PollerResponder[armrecoveryservicesdatareplication.DraClientDeleteResponse]] - newListPager *tracker[azfake.PagerResponder[armrecoveryservicesdatareplication.DraClientListResponse]] +// FabricAgentServerTransport connects instances of armrecoveryservicesdatareplication.FabricAgentClient to instances of FabricAgentServer. +// Don't use this type directly, use NewFabricAgentServerTransport instead. +type FabricAgentServerTransport struct { + srv *FabricAgentServer + beginCreate *tracker[azfake.PollerResponder[armrecoveryservicesdatareplication.FabricAgentClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armrecoveryservicesdatareplication.FabricAgentClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armrecoveryservicesdatareplication.FabricAgentClientListResponse]] } -// Do implements the policy.Transporter interface for DraServerTransport. -func (d *DraServerTransport) Do(req *http.Request) (*http.Response, error) { +// Do implements the policy.Transporter interface for FabricAgentServerTransport. +func (f *FabricAgentServerTransport) Do(req *http.Request) (*http.Response, error) { rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) method, ok := rawMethod.(string) if !ok { return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return f.dispatchToMethodFake(req, method) +} - switch method { - case "DraClient.BeginCreate": - resp, err = d.dispatchBeginCreate(req) - case "DraClient.BeginDelete": - resp, err = d.dispatchBeginDelete(req) - case "DraClient.Get": - resp, err = d.dispatchGet(req) - case "DraClient.NewListPager": - resp, err = d.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (f *FabricAgentServerTransport) 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 fabricAgentServerTransportInterceptor != nil { + res.resp, res.err, intercepted = fabricAgentServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "FabricAgentClient.BeginCreate": + res.resp, res.err = f.dispatchBeginCreate(req) + case "FabricAgentClient.BeginDelete": + res.resp, res.err = f.dispatchBeginDelete(req) + case "FabricAgentClient.Get": + res.resp, res.err = f.dispatchGet(req) + case "FabricAgentClient.NewListPager": + res.resp, res.err = f.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 (d *DraServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { - if d.srv.BeginCreate == nil { +func (f *FabricAgentServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if f.srv.BeginCreate == nil { return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} } - beginCreate := d.beginCreate.get(req) + beginCreate := f.beginCreate.get(req) if beginCreate == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fabricAgents/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) @@ -105,7 +121,7 @@ func (d *DraServerTransport) dispatchBeginCreate(req *http.Request) (*http.Respo if matches == nil || len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.DraModel](req) + body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.FabricAgentModel](req) if err != nil { return nil, err } @@ -121,12 +137,12 @@ func (d *DraServerTransport) dispatchBeginCreate(req *http.Request) (*http.Respo if err != nil { return nil, err } - respr, errRespr := d.srv.BeginCreate(req.Context(), resourceGroupNameParam, fabricNameParam, fabricAgentNameParam, body, nil) + respr, errRespr := f.srv.BeginCreate(req.Context(), resourceGroupNameParam, fabricNameParam, fabricAgentNameParam, body, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } beginCreate = &respr - d.beginCreate.add(req, beginCreate) + f.beginCreate.add(req, beginCreate) } resp, err := server.PollerResponderNext(beginCreate, req) @@ -135,21 +151,21 @@ func (d *DraServerTransport) dispatchBeginCreate(req *http.Request) (*http.Respo } if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - d.beginCreate.remove(req) + f.beginCreate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} } if !server.PollerResponderMore(beginCreate) { - d.beginCreate.remove(req) + f.beginCreate.remove(req) } return resp, nil } -func (d *DraServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if d.srv.BeginDelete == nil { +func (f *FabricAgentServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if f.srv.BeginDelete == nil { return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} } - beginDelete := d.beginDelete.get(req) + beginDelete := f.beginDelete.get(req) if beginDelete == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fabricAgents/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) @@ -169,12 +185,12 @@ func (d *DraServerTransport) dispatchBeginDelete(req *http.Request) (*http.Respo if err != nil { return nil, err } - respr, errRespr := d.srv.BeginDelete(req.Context(), resourceGroupNameParam, fabricNameParam, fabricAgentNameParam, nil) + respr, errRespr := f.srv.BeginDelete(req.Context(), resourceGroupNameParam, fabricNameParam, fabricAgentNameParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } beginDelete = &respr - d.beginDelete.add(req, beginDelete) + f.beginDelete.add(req, beginDelete) } resp, err := server.PollerResponderNext(beginDelete, req) @@ -182,19 +198,19 @@ func (d *DraServerTransport) dispatchBeginDelete(req *http.Request) (*http.Respo return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { - d.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + f.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { - d.beginDelete.remove(req) + f.beginDelete.remove(req) } return resp, nil } -func (d *DraServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if d.srv.Get == nil { +func (f *FabricAgentServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if f.srv.Get == nil { return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} } const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fabricAgents/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` @@ -215,7 +231,7 @@ func (d *DraServerTransport) dispatchGet(req *http.Request) (*http.Response, err if err != nil { return nil, err } - respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, fabricNameParam, fabricAgentNameParam, nil) + respr, errRespr := f.srv.Get(req.Context(), resourceGroupNameParam, fabricNameParam, fabricAgentNameParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -223,18 +239,18 @@ func (d *DraServerTransport) dispatchGet(req *http.Request) (*http.Response, err if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DraModel, req) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).FabricAgentModel, req) if err != nil { return nil, err } return resp, nil } -func (d *DraServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if d.srv.NewListPager == nil { +func (f *FabricAgentServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if f.srv.NewListPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} } - newListPager := d.newListPager.get(req) + newListPager := f.newListPager.get(req) if newListPager == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fabricAgents` regex := regexp.MustCompile(regexStr) @@ -250,10 +266,10 @@ func (d *DraServerTransport) dispatchNewListPager(req *http.Request) (*http.Resp if err != nil { return nil, err } - resp := d.srv.NewListPager(resourceGroupNameParam, fabricNameParam, nil) + resp := f.srv.NewListPager(resourceGroupNameParam, fabricNameParam, nil) newListPager = &resp - d.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesdatareplication.DraClientListResponse, createLink func() string) { + f.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesdatareplication.FabricAgentClientListResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } @@ -262,11 +278,17 @@ func (d *DraServerTransport) dispatchNewListPager(req *http.Request) (*http.Resp return nil, err } if !contains([]int{http.StatusOK}, resp.StatusCode) { - d.newListPager.remove(req) + f.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } if !server.PagerResponderMore(newListPager) { - d.newListPager.remove(req) + f.newListPager.remove(req) } return resp, nil } + +// set this to conditionally intercept incoming requests to FabricAgentServerTransport +var fabricAgentServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabricoperationsstatus_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabricoperationsstatus_server.go deleted file mode 100644 index 0dfc5a817303..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabricoperationsstatus_server.go +++ /dev/null @@ -1,104 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" - "net/http" - "net/url" - "regexp" -) - -// FabricOperationsStatusServer is a fake server for instances of the armrecoveryservicesdatareplication.FabricOperationsStatusClient type. -type FabricOperationsStatusServer struct { - // Get is the fake for method FabricOperationsStatusClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, fabricName string, operationID string, options *armrecoveryservicesdatareplication.FabricOperationsStatusClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.FabricOperationsStatusClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewFabricOperationsStatusServerTransport creates a new instance of FabricOperationsStatusServerTransport with the provided implementation. -// The returned FabricOperationsStatusServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.FabricOperationsStatusClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewFabricOperationsStatusServerTransport(srv *FabricOperationsStatusServer) *FabricOperationsStatusServerTransport { - return &FabricOperationsStatusServerTransport{srv: srv} -} - -// FabricOperationsStatusServerTransport connects instances of armrecoveryservicesdatareplication.FabricOperationsStatusClient to instances of FabricOperationsStatusServer. -// Don't use this type directly, use NewFabricOperationsStatusServerTransport instead. -type FabricOperationsStatusServerTransport struct { - srv *FabricOperationsStatusServer -} - -// Do implements the policy.Transporter interface for FabricOperationsStatusServerTransport. -func (f *FabricOperationsStatusServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "FabricOperationsStatusClient.Get": - resp, err = f.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (f *FabricOperationsStatusServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if f.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := f.srv.Get(req.Context(), resourceGroupNameParam, fabricNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/internal.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/internal.go index 7d2f89ba4bb2..c614f8d5643a 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/internal.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/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. @@ -15,6 +12,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/workflow_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/job_server.go similarity index 54% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/workflow_server.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/job_server.go index 5231a3fc89a7..035c778774d7 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/workflow_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/job_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. @@ -20,65 +17,85 @@ import ( "net/http" "net/url" "regexp" + "strconv" ) -// WorkflowServer is a fake server for instances of the armrecoveryservicesdatareplication.WorkflowClient type. -type WorkflowServer struct { - // Get is the fake for method WorkflowClient.Get +// JobServer is a fake server for instances of the armrecoveryservicesdatareplication.JobClient type. +type JobServer struct { + // Get is the fake for method JobClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, vaultName string, jobName string, options *armrecoveryservicesdatareplication.WorkflowClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.WorkflowClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, resourceGroupName string, vaultName string, jobName string, options *armrecoveryservicesdatareplication.JobClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.JobClientGetResponse], errResp azfake.ErrorResponder) - // NewListPager is the fake for method WorkflowClient.NewListPager + // NewListPager is the fake for method JobClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, vaultName string, options *armrecoveryservicesdatareplication.WorkflowClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesdatareplication.WorkflowClientListResponse]) + NewListPager func(resourceGroupName string, vaultName string, options *armrecoveryservicesdatareplication.JobClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesdatareplication.JobClientListResponse]) } -// NewWorkflowServerTransport creates a new instance of WorkflowServerTransport with the provided implementation. -// The returned WorkflowServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.WorkflowClient via the +// NewJobServerTransport creates a new instance of JobServerTransport with the provided implementation. +// The returned JobServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.JobClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewWorkflowServerTransport(srv *WorkflowServer) *WorkflowServerTransport { - return &WorkflowServerTransport{ +func NewJobServerTransport(srv *JobServer) *JobServerTransport { + return &JobServerTransport{ srv: srv, - newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesdatareplication.WorkflowClientListResponse]](), + newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesdatareplication.JobClientListResponse]](), } } -// WorkflowServerTransport connects instances of armrecoveryservicesdatareplication.WorkflowClient to instances of WorkflowServer. -// Don't use this type directly, use NewWorkflowServerTransport instead. -type WorkflowServerTransport struct { - srv *WorkflowServer - newListPager *tracker[azfake.PagerResponder[armrecoveryservicesdatareplication.WorkflowClientListResponse]] +// JobServerTransport connects instances of armrecoveryservicesdatareplication.JobClient to instances of JobServer. +// Don't use this type directly, use NewJobServerTransport instead. +type JobServerTransport struct { + srv *JobServer + newListPager *tracker[azfake.PagerResponder[armrecoveryservicesdatareplication.JobClientListResponse]] } -// Do implements the policy.Transporter interface for WorkflowServerTransport. -func (w *WorkflowServerTransport) Do(req *http.Request) (*http.Response, error) { +// Do implements the policy.Transporter interface for JobServerTransport. +func (j *JobServerTransport) Do(req *http.Request) (*http.Response, error) { rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) method, ok := rawMethod.(string) if !ok { return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return j.dispatchToMethodFake(req, method) +} - switch method { - case "WorkflowClient.Get": - resp, err = w.dispatchGet(req) - case "WorkflowClient.NewListPager": - resp, err = w.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (j *JobServerTransport) 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 jobServerTransportInterceptor != nil { + res.resp, res.err, intercepted = jobServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "JobClient.Get": + res.resp, res.err = j.dispatchGet(req) + case "JobClient.NewListPager": + res.resp, res.err = j.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 (w *WorkflowServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if w.srv.Get == nil { +func (j *JobServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if j.srv.Get == nil { return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} } const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/jobs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` @@ -99,7 +116,7 @@ func (w *WorkflowServerTransport) dispatchGet(req *http.Request) (*http.Response if err != nil { return nil, err } - respr, errRespr := w.srv.Get(req.Context(), resourceGroupNameParam, vaultNameParam, jobNameParam, nil) + respr, errRespr := j.srv.Get(req.Context(), resourceGroupNameParam, vaultNameParam, jobNameParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -107,18 +124,18 @@ func (w *WorkflowServerTransport) dispatchGet(req *http.Request) (*http.Response if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).WorkflowModel, req) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).JobModel, req) if err != nil { return nil, err } return resp, nil } -func (w *WorkflowServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if w.srv.NewListPager == nil { +func (j *JobServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if j.srv.NewListPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} } - newListPager := w.newListPager.get(req) + newListPager := j.newListPager.get(req) if newListPager == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/jobs` regex := regexp.MustCompile(regexStr) @@ -131,31 +148,46 @@ func (w *WorkflowServerTransport) dispatchNewListPager(req *http.Request) (*http if err != nil { return nil, err } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + oDataOptionsUnescaped, err := url.QueryUnescape(qp.Get("odataOptions")) if err != nil { return nil, err } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + oDataOptionsParam := getOptional(oDataOptionsUnescaped) + continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) if err != nil { return nil, err } - filterParam := getOptional(filterUnescaped) - continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) + continuationTokenParam := getOptional(continuationTokenUnescaped) + pageSizeUnescaped, err := url.QueryUnescape(qp.Get("pageSize")) if err != nil { return nil, err } - continuationTokenParam := getOptional(continuationTokenUnescaped) - var options *armrecoveryservicesdatareplication.WorkflowClientListOptions - if filterParam != nil || continuationTokenParam != nil { - options = &armrecoveryservicesdatareplication.WorkflowClientListOptions{ - Filter: filterParam, + pageSizeParam, err := parseOptional(pageSizeUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + var options *armrecoveryservicesdatareplication.JobClientListOptions + if oDataOptionsParam != nil || continuationTokenParam != nil || pageSizeParam != nil { + options = &armrecoveryservicesdatareplication.JobClientListOptions{ + ODataOptions: oDataOptionsParam, ContinuationToken: continuationTokenParam, + PageSize: pageSizeParam, } } - resp := w.srv.NewListPager(resourceGroupNameParam, vaultNameParam, options) + resp := j.srv.NewListPager(resourceGroupNameParam, vaultNameParam, options) newListPager = &resp - w.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesdatareplication.WorkflowClientListResponse, createLink func() string) { + j.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesdatareplication.JobClientListResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } @@ -164,11 +196,17 @@ func (w *WorkflowServerTransport) dispatchNewListPager(req *http.Request) (*http return nil, err } if !contains([]int{http.StatusOK}, resp.StatusCode) { - w.newListPager.remove(req) + j.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } if !server.PagerResponderMore(newListPager) { - w.newListPager.remove(req) + j.newListPager.remove(req) } return resp, nil } + +// set this to conditionally intercept incoming requests to JobServerTransport +var jobServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/locationbasedoperationresults_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/locationbasedoperationresults_server.go new file mode 100644 index 000000000000..986601d56302 --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/locationbasedoperationresults_server.go @@ -0,0 +1,126 @@ +// 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 ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "net/http" + "net/url" + "regexp" +) + +// LocationBasedOperationResultsServer is a fake server for instances of the armrecoveryservicesdatareplication.LocationBasedOperationResultsClient type. +type LocationBasedOperationResultsServer struct { + // Get is the fake for method LocationBasedOperationResultsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, location string, operationID string, options *armrecoveryservicesdatareplication.LocationBasedOperationResultsClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.LocationBasedOperationResultsClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewLocationBasedOperationResultsServerTransport creates a new instance of LocationBasedOperationResultsServerTransport with the provided implementation. +// The returned LocationBasedOperationResultsServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.LocationBasedOperationResultsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewLocationBasedOperationResultsServerTransport(srv *LocationBasedOperationResultsServer) *LocationBasedOperationResultsServerTransport { + return &LocationBasedOperationResultsServerTransport{srv: srv} +} + +// LocationBasedOperationResultsServerTransport connects instances of armrecoveryservicesdatareplication.LocationBasedOperationResultsClient to instances of LocationBasedOperationResultsServer. +// Don't use this type directly, use NewLocationBasedOperationResultsServerTransport instead. +type LocationBasedOperationResultsServerTransport struct { + srv *LocationBasedOperationResultsServer +} + +// Do implements the policy.Transporter interface for LocationBasedOperationResultsServerTransport. +func (l *LocationBasedOperationResultsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return l.dispatchToMethodFake(req, method) +} + +func (l *LocationBasedOperationResultsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if locationBasedOperationResultsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = locationBasedOperationResultsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "LocationBasedOperationResultsClient.Get": + res.resp, res.err = l.dispatchGet(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 *LocationBasedOperationResultsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if l.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operationResults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) + if err != nil { + return nil, err + } + respr, errRespr := l.srv.Get(req.Context(), resourceGroupNameParam, locationParam, operationIDParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to LocationBasedOperationResultsServerTransport +var locationBasedOperationResultsServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/operationresults_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/operationresults_server.go new file mode 100644 index 000000000000..1c7d9bb67ff6 --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/operationresults_server.go @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "net/http" + "net/url" + "regexp" +) + +// OperationResultsServer is a fake server for instances of the armrecoveryservicesdatareplication.OperationResultsClient type. +type OperationResultsServer struct { + // Get is the fake for method OperationResultsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, operationID string, options *armrecoveryservicesdatareplication.OperationResultsClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.OperationResultsClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewOperationResultsServerTransport creates a new instance of OperationResultsServerTransport with the provided implementation. +// The returned OperationResultsServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.OperationResultsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewOperationResultsServerTransport(srv *OperationResultsServer) *OperationResultsServerTransport { + return &OperationResultsServerTransport{srv: srv} +} + +// OperationResultsServerTransport connects instances of armrecoveryservicesdatareplication.OperationResultsClient to instances of OperationResultsServer. +// Don't use this type directly, use NewOperationResultsServerTransport instead. +type OperationResultsServerTransport struct { + srv *OperationResultsServer +} + +// Do implements the policy.Transporter interface for OperationResultsServerTransport. +func (o *OperationResultsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return o.dispatchToMethodFake(req, method) +} + +func (o *OperationResultsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if operationResultsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationResultsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationResultsClient.Get": + res.resp, res.err = o.dispatchGet(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 (o *OperationResultsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if o.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/operationResults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/{operationId}` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) + if err != nil { + return nil, err + } + respr, errRespr := o.srv.Get(req.Context(), resourceGroupNameParam, operationIDParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to OperationResultsServerTransport +var operationResultsServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/operations_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/operations_server.go index 920f9da41db7..6b2baf7bca5b 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/operations_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/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. @@ -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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/policy_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/policy_server.go index fed6a22b77d5..f2aaa53ba0e1 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/policy_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/policy_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. @@ -29,7 +26,7 @@ type PolicyServer struct { BeginCreate func(ctx context.Context, resourceGroupName string, vaultName string, policyName string, body armrecoveryservicesdatareplication.PolicyModel, options *armrecoveryservicesdatareplication.PolicyClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.PolicyClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method PolicyClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, vaultName string, policyName string, options *armrecoveryservicesdatareplication.PolicyClientBeginDeleteOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.PolicyClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method PolicyClient.Get @@ -70,27 +67,46 @@ func (p *PolicyServerTransport) 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 p.dispatchToMethodFake(req, method) +} - switch method { - case "PolicyClient.BeginCreate": - resp, err = p.dispatchBeginCreate(req) - case "PolicyClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "PolicyClient.Get": - resp, err = p.dispatchGet(req) - case "PolicyClient.NewListPager": - resp, err = p.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (p *PolicyServerTransport) 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 policyServerTransportInterceptor != nil { + res.resp, res.err, intercepted = policyServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PolicyClient.BeginCreate": + res.resp, res.err = p.dispatchBeginCreate(req) + case "PolicyClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "PolicyClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PolicyClient.NewListPager": + res.resp, res.err = p.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 (p *PolicyServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -182,9 +198,9 @@ func (p *PolicyServerTransport) dispatchBeginDelete(req *http.Request) (*http.Re return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { p.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { p.beginDelete.remove(req) @@ -270,3 +286,9 @@ func (p *PolicyServerTransport) dispatchNewListPager(req *http.Request) (*http.R } return resp, nil } + +// set this to conditionally intercept incoming requests to PolicyServerTransport +var policyServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/policyoperationstatus_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/policyoperationstatus_server.go deleted file mode 100644 index 6f4cd781837c..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/policyoperationstatus_server.go +++ /dev/null @@ -1,108 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" - "net/http" - "net/url" - "regexp" -) - -// PolicyOperationStatusServer is a fake server for instances of the armrecoveryservicesdatareplication.PolicyOperationStatusClient type. -type PolicyOperationStatusServer struct { - // Get is the fake for method PolicyOperationStatusClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, vaultName string, policyName string, operationID string, options *armrecoveryservicesdatareplication.PolicyOperationStatusClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.PolicyOperationStatusClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewPolicyOperationStatusServerTransport creates a new instance of PolicyOperationStatusServerTransport with the provided implementation. -// The returned PolicyOperationStatusServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.PolicyOperationStatusClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewPolicyOperationStatusServerTransport(srv *PolicyOperationStatusServer) *PolicyOperationStatusServerTransport { - return &PolicyOperationStatusServerTransport{srv: srv} -} - -// PolicyOperationStatusServerTransport connects instances of armrecoveryservicesdatareplication.PolicyOperationStatusClient to instances of PolicyOperationStatusServer. -// Don't use this type directly, use NewPolicyOperationStatusServerTransport instead. -type PolicyOperationStatusServerTransport struct { - srv *PolicyOperationStatusServer -} - -// Do implements the policy.Transporter interface for PolicyOperationStatusServerTransport. -func (p *PolicyOperationStatusServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "PolicyOperationStatusClient.Get": - resp, err = p.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *PolicyOperationStatusServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicationPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - policyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("policyName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, vaultNameParam, policyNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/privateendpointconnectionproxies_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/privateendpointconnectionproxies_server.go new file mode 100644 index 000000000000..e387c14f5b84 --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/privateendpointconnectionproxies_server.go @@ -0,0 +1,328 @@ +// 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 ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "net/http" + "net/url" + "regexp" +) + +// PrivateEndpointConnectionProxiesServer is a fake server for instances of the armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClient type. +type PrivateEndpointConnectionProxiesServer struct { + // Create is the fake for method PrivateEndpointConnectionProxiesClient.Create + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + Create func(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, body armrecoveryservicesdatareplication.PrivateEndpointConnectionProxy, options *armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientCreateOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method PrivateEndpointConnectionProxiesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, options *armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientBeginDeleteOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method PrivateEndpointConnectionProxiesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, options *armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method PrivateEndpointConnectionProxiesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, vaultName string, options *armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientListResponse]) + + // Validate is the fake for method PrivateEndpointConnectionProxiesClient.Validate + // HTTP status codes to indicate success: http.StatusOK + Validate func(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, body armrecoveryservicesdatareplication.PrivateEndpointConnectionProxy, options *armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientValidateOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientValidateResponse], errResp azfake.ErrorResponder) +} + +// NewPrivateEndpointConnectionProxiesServerTransport creates a new instance of PrivateEndpointConnectionProxiesServerTransport with the provided implementation. +// The returned PrivateEndpointConnectionProxiesServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPrivateEndpointConnectionProxiesServerTransport(srv *PrivateEndpointConnectionProxiesServer) *PrivateEndpointConnectionProxiesServerTransport { + return &PrivateEndpointConnectionProxiesServerTransport{ + srv: srv, + beginDelete: newTracker[azfake.PollerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientListResponse]](), + } +} + +// PrivateEndpointConnectionProxiesServerTransport connects instances of armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClient to instances of PrivateEndpointConnectionProxiesServer. +// Don't use this type directly, use NewPrivateEndpointConnectionProxiesServerTransport instead. +type PrivateEndpointConnectionProxiesServerTransport struct { + srv *PrivateEndpointConnectionProxiesServer + beginDelete *tracker[azfake.PollerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientListResponse]] +} + +// Do implements the policy.Transporter interface for PrivateEndpointConnectionProxiesServerTransport. +func (p *PrivateEndpointConnectionProxiesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return p.dispatchToMethodFake(req, method) +} + +func (p *PrivateEndpointConnectionProxiesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if privateEndpointConnectionProxiesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateEndpointConnectionProxiesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateEndpointConnectionProxiesClient.Create": + res.resp, res.err = p.dispatchCreate(req) + case "PrivateEndpointConnectionProxiesClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "PrivateEndpointConnectionProxiesClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PrivateEndpointConnectionProxiesClient.NewListPager": + res.resp, res.err = p.dispatchNewListPager(req) + case "PrivateEndpointConnectionProxiesClient.Validate": + res.resp, res.err = p.dispatchValidate(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 (p *PrivateEndpointConnectionProxiesServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { + if p.srv.Create == nil { + return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnectionProxies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxy](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionProxyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionProxyName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Create(req.Context(), resourceGroupNameParam, vaultNameParam, privateEndpointConnectionProxyNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnectionProxy, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PrivateEndpointConnectionProxiesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if p.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := p.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnectionProxies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionProxyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionProxyName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, vaultNameParam, privateEndpointConnectionProxyNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + p.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + p.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + p.beginDelete.remove(req) + } + + return resp, nil +} + +func (p *PrivateEndpointConnectionProxiesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnectionProxies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionProxyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionProxyName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, vaultNameParam, privateEndpointConnectionProxyNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnectionProxy, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PrivateEndpointConnectionProxiesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := p.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnectionProxies` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + resp := p.srv.NewListPager(resourceGroupNameParam, vaultNameParam, nil) + newListPager = &resp + p.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + p.newListPager.remove(req) + } + return resp, nil +} + +func (p *PrivateEndpointConnectionProxiesServerTransport) dispatchValidate(req *http.Request) (*http.Response, error) { + if p.srv.Validate == nil { + return nil, &nonRetriableError{errors.New("fake for method Validate not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnectionProxies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/validate` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxy](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionProxyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionProxyName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Validate(req.Context(), resourceGroupNameParam, vaultNameParam, privateEndpointConnectionProxyNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnectionProxy, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to PrivateEndpointConnectionProxiesServerTransport +var privateEndpointConnectionProxiesServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/privateendpointconnections_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/privateendpointconnections_server.go new file mode 100644 index 000000000000..e2ca1a026e09 --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/privateendpointconnections_server.go @@ -0,0 +1,281 @@ +// 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 ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "net/http" + "net/url" + "regexp" +) + +// PrivateEndpointConnectionsServer is a fake server for instances of the armrecoveryservicesdatareplication.PrivateEndpointConnectionsClient type. +type PrivateEndpointConnectionsServer struct { + // BeginDelete is the fake for method PrivateEndpointConnectionsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, options *armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method PrivateEndpointConnectionsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, options *armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method PrivateEndpointConnectionsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, vaultName string, options *armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientListResponse]) + + // Update is the fake for method PrivateEndpointConnectionsClient.Update + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + Update func(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, body armrecoveryservicesdatareplication.PrivateEndpointConnection, options *armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientUpdateOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewPrivateEndpointConnectionsServerTransport creates a new instance of PrivateEndpointConnectionsServerTransport with the provided implementation. +// The returned PrivateEndpointConnectionsServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.PrivateEndpointConnectionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPrivateEndpointConnectionsServerTransport(srv *PrivateEndpointConnectionsServer) *PrivateEndpointConnectionsServerTransport { + return &PrivateEndpointConnectionsServerTransport{ + srv: srv, + beginDelete: newTracker[azfake.PollerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientListResponse]](), + } +} + +// PrivateEndpointConnectionsServerTransport connects instances of armrecoveryservicesdatareplication.PrivateEndpointConnectionsClient to instances of PrivateEndpointConnectionsServer. +// Don't use this type directly, use NewPrivateEndpointConnectionsServerTransport instead. +type PrivateEndpointConnectionsServerTransport struct { + srv *PrivateEndpointConnectionsServer + beginDelete *tracker[azfake.PollerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientListResponse]] +} + +// Do implements the policy.Transporter interface for PrivateEndpointConnectionsServerTransport. +func (p *PrivateEndpointConnectionsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return p.dispatchToMethodFake(req, method) +} + +func (p *PrivateEndpointConnectionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if privateEndpointConnectionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateEndpointConnectionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateEndpointConnectionsClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "PrivateEndpointConnectionsClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PrivateEndpointConnectionsClient.NewListPager": + res.resp, res.err = p.dispatchNewListPager(req) + case "PrivateEndpointConnectionsClient.Update": + res.resp, res.err = p.dispatchUpdate(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 (p *PrivateEndpointConnectionsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if p.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := p.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, vaultNameParam, privateEndpointConnectionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + p.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + p.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + p.beginDelete.remove(req) + } + + return resp, nil +} + +func (p *PrivateEndpointConnectionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, vaultNameParam, privateEndpointConnectionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnection, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PrivateEndpointConnectionsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := p.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + resp := p.srv.NewListPager(resourceGroupNameParam, vaultNameParam, nil) + newListPager = &resp + p.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + p.newListPager.remove(req) + } + return resp, nil +} + +func (p *PrivateEndpointConnectionsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if p.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.PrivateEndpointConnection](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Update(req.Context(), resourceGroupNameParam, vaultNameParam, privateEndpointConnectionNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnection, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to PrivateEndpointConnectionsServerTransport +var privateEndpointConnectionsServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/privatelinkresources_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/privatelinkresources_server.go new file mode 100644 index 000000000000..78e4f76e57f6 --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/privatelinkresources_server.go @@ -0,0 +1,178 @@ +// 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 ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "net/http" + "net/url" + "regexp" +) + +// PrivateLinkResourcesServer is a fake server for instances of the armrecoveryservicesdatareplication.PrivateLinkResourcesClient type. +type PrivateLinkResourcesServer struct { + // Get is the fake for method PrivateLinkResourcesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, vaultName string, privateLinkResourceName string, options *armrecoveryservicesdatareplication.PrivateLinkResourcesClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.PrivateLinkResourcesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method PrivateLinkResourcesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, vaultName string, options *armrecoveryservicesdatareplication.PrivateLinkResourcesClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesdatareplication.PrivateLinkResourcesClientListResponse]) +} + +// NewPrivateLinkResourcesServerTransport creates a new instance of PrivateLinkResourcesServerTransport with the provided implementation. +// The returned PrivateLinkResourcesServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.PrivateLinkResourcesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPrivateLinkResourcesServerTransport(srv *PrivateLinkResourcesServer) *PrivateLinkResourcesServerTransport { + return &PrivateLinkResourcesServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesdatareplication.PrivateLinkResourcesClientListResponse]](), + } +} + +// PrivateLinkResourcesServerTransport connects instances of armrecoveryservicesdatareplication.PrivateLinkResourcesClient to instances of PrivateLinkResourcesServer. +// Don't use this type directly, use NewPrivateLinkResourcesServerTransport instead. +type PrivateLinkResourcesServerTransport struct { + srv *PrivateLinkResourcesServer + newListPager *tracker[azfake.PagerResponder[armrecoveryservicesdatareplication.PrivateLinkResourcesClientListResponse]] +} + +// Do implements the policy.Transporter interface for PrivateLinkResourcesServerTransport. +func (p *PrivateLinkResourcesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return p.dispatchToMethodFake(req, method) +} + +func (p *PrivateLinkResourcesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if privateLinkResourcesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateLinkResourcesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateLinkResourcesClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PrivateLinkResourcesClient.NewListPager": + res.resp, res.err = p.dispatchNewListPager(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 (p *PrivateLinkResourcesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + privateLinkResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateLinkResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, vaultNameParam, privateLinkResourceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateLinkResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PrivateLinkResourcesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := p.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + resp := p.srv.NewListPager(resourceGroupNameParam, vaultNameParam, nil) + newListPager = &resp + p.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesdatareplication.PrivateLinkResourcesClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + p.newListPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to PrivateLinkResourcesServerTransport +var privateLinkResourcesServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/protecteditem_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/protecteditem_server.go index b68a8e66bd14..cd77fa0a97d8 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/protecteditem_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/protecteditem_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. @@ -19,7 +16,6 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" "net/http" "net/url" - "reflect" "regexp" "strconv" ) @@ -31,7 +27,7 @@ type ProtectedItemServer struct { BeginCreate func(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, body armrecoveryservicesdatareplication.ProtectedItemModel, options *armrecoveryservicesdatareplication.ProtectedItemClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method ProtectedItemClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, options *armrecoveryservicesdatareplication.ProtectedItemClientBeginDeleteOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method ProtectedItemClient.Get @@ -44,7 +40,11 @@ type ProtectedItemServer struct { // BeginPlannedFailover is the fake for method ProtectedItemClient.BeginPlannedFailover // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginPlannedFailover func(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, options *armrecoveryservicesdatareplication.ProtectedItemClientBeginPlannedFailoverOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientPlannedFailoverResponse], errResp azfake.ErrorResponder) + BeginPlannedFailover func(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, body armrecoveryservicesdatareplication.PlannedFailoverModel, options *armrecoveryservicesdatareplication.ProtectedItemClientBeginPlannedFailoverOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientPlannedFailoverResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method ProtectedItemClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, body armrecoveryservicesdatareplication.ProtectedItemModelUpdate, options *armrecoveryservicesdatareplication.ProtectedItemClientBeginUpdateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientUpdateResponse], errResp azfake.ErrorResponder) } // NewProtectedItemServerTransport creates a new instance of ProtectedItemServerTransport with the provided implementation. @@ -57,6 +57,7 @@ func NewProtectedItemServerTransport(srv *ProtectedItemServer) *ProtectedItemSer beginDelete: newTracker[azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientDeleteResponse]](), newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesdatareplication.ProtectedItemClientListResponse]](), beginPlannedFailover: newTracker[azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientPlannedFailoverResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientUpdateResponse]](), } } @@ -68,6 +69,7 @@ type ProtectedItemServerTransport struct { beginDelete *tracker[azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientDeleteResponse]] newListPager *tracker[azfake.PagerResponder[armrecoveryservicesdatareplication.ProtectedItemClientListResponse]] beginPlannedFailover *tracker[azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientPlannedFailoverResponse]] + beginUpdate *tracker[azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientUpdateResponse]] } // Do implements the policy.Transporter interface for ProtectedItemServerTransport. @@ -78,29 +80,50 @@ func (p *ProtectedItemServerTransport) Do(req *http.Request) (*http.Response, er return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return p.dispatchToMethodFake(req, method) +} - switch method { - case "ProtectedItemClient.BeginCreate": - resp, err = p.dispatchBeginCreate(req) - case "ProtectedItemClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "ProtectedItemClient.Get": - resp, err = p.dispatchGet(req) - case "ProtectedItemClient.NewListPager": - resp, err = p.dispatchNewListPager(req) - case "ProtectedItemClient.BeginPlannedFailover": - resp, err = p.dispatchBeginPlannedFailover(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (p *ProtectedItemServerTransport) 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 protectedItemServerTransportInterceptor != nil { + res.resp, res.err, intercepted = protectedItemServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ProtectedItemClient.BeginCreate": + res.resp, res.err = p.dispatchBeginCreate(req) + case "ProtectedItemClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "ProtectedItemClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "ProtectedItemClient.NewListPager": + res.resp, res.err = p.dispatchNewListPager(req) + case "ProtectedItemClient.BeginPlannedFailover": + res.resp, res.err = p.dispatchBeginPlannedFailover(req) + case "ProtectedItemClient.BeginUpdate": + res.resp, res.err = p.dispatchBeginUpdate(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 (p *ProtectedItemServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -172,19 +195,19 @@ func (p *ProtectedItemServerTransport) dispatchBeginDelete(req *http.Request) (* if err != nil { return nil, err } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + forceDeleteUnescaped, err := url.QueryUnescape(qp.Get("forceDelete")) if err != nil { return nil, err } - protectedItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("protectedItemName")]) + forceDeleteParam, err := parseOptional(forceDeleteUnescaped, strconv.ParseBool) if err != nil { return nil, err } - forceDeleteUnescaped, err := url.QueryUnescape(qp.Get("forceDelete")) + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) if err != nil { return nil, err } - forceDeleteParam, err := parseOptional(forceDeleteUnescaped, strconv.ParseBool) + protectedItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("protectedItemName")]) if err != nil { return nil, err } @@ -207,9 +230,9 @@ func (p *ProtectedItemServerTransport) dispatchBeginDelete(req *http.Request) (* return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { p.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { p.beginDelete.remove(req) @@ -267,15 +290,48 @@ func (p *ProtectedItemServerTransport) dispatchNewListPager(req *http.Request) ( if matches == nil || len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } + qp := req.URL.Query() resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) if err != nil { return nil, err } + oDataOptionsUnescaped, err := url.QueryUnescape(qp.Get("odataOptions")) + if err != nil { + return nil, err + } + oDataOptionsParam := getOptional(oDataOptionsUnescaped) + continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) + if err != nil { + return nil, err + } + continuationTokenParam := getOptional(continuationTokenUnescaped) + pageSizeUnescaped, err := url.QueryUnescape(qp.Get("pageSize")) + if err != nil { + return nil, err + } + pageSizeParam, err := parseOptional(pageSizeUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) if err != nil { return nil, err } - resp := p.srv.NewListPager(resourceGroupNameParam, vaultNameParam, nil) + var options *armrecoveryservicesdatareplication.ProtectedItemClientListOptions + if oDataOptionsParam != nil || continuationTokenParam != nil || pageSizeParam != nil { + options = &armrecoveryservicesdatareplication.ProtectedItemClientListOptions{ + ODataOptions: oDataOptionsParam, + ContinuationToken: continuationTokenParam, + PageSize: pageSizeParam, + } + } + resp := p.srv.NewListPager(resourceGroupNameParam, vaultNameParam, options) newListPager = &resp p.newListPager.add(req, newListPager) server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesdatareplication.ProtectedItemClientListResponse, createLink func() string) { @@ -324,13 +380,7 @@ func (p *ProtectedItemServerTransport) dispatchBeginPlannedFailover(req *http.Re if err != nil { return nil, err } - var options *armrecoveryservicesdatareplication.ProtectedItemClientBeginPlannedFailoverOptions - if !reflect.ValueOf(body).IsZero() { - options = &armrecoveryservicesdatareplication.ProtectedItemClientBeginPlannedFailoverOptions{ - Body: &body, - } - } - respr, errRespr := p.srv.BeginPlannedFailover(req.Context(), resourceGroupNameParam, vaultNameParam, protectedItemNameParam, options) + respr, errRespr := p.srv.BeginPlannedFailover(req.Context(), resourceGroupNameParam, vaultNameParam, protectedItemNameParam, body, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -353,3 +403,61 @@ func (p *ProtectedItemServerTransport) dispatchBeginPlannedFailover(req *http.Re return resp, nil } + +func (p *ProtectedItemServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if p.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := p.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectedItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.ProtectedItemModelUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + protectedItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("protectedItemName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginUpdate(req.Context(), resourceGroupNameParam, vaultNameParam, protectedItemNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + p.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + p.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + p.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to ProtectedItemServerTransport +var protectedItemServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/protecteditemoperationstatus_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/protecteditemoperationstatus_server.go deleted file mode 100644 index 3065e3dcc190..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/protecteditemoperationstatus_server.go +++ /dev/null @@ -1,108 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" - "net/http" - "net/url" - "regexp" -) - -// ProtectedItemOperationStatusServer is a fake server for instances of the armrecoveryservicesdatareplication.ProtectedItemOperationStatusClient type. -type ProtectedItemOperationStatusServer struct { - // Get is the fake for method ProtectedItemOperationStatusClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, operationID string, options *armrecoveryservicesdatareplication.ProtectedItemOperationStatusClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.ProtectedItemOperationStatusClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewProtectedItemOperationStatusServerTransport creates a new instance of ProtectedItemOperationStatusServerTransport with the provided implementation. -// The returned ProtectedItemOperationStatusServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.ProtectedItemOperationStatusClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewProtectedItemOperationStatusServerTransport(srv *ProtectedItemOperationStatusServer) *ProtectedItemOperationStatusServerTransport { - return &ProtectedItemOperationStatusServerTransport{srv: srv} -} - -// ProtectedItemOperationStatusServerTransport connects instances of armrecoveryservicesdatareplication.ProtectedItemOperationStatusClient to instances of ProtectedItemOperationStatusServer. -// Don't use this type directly, use NewProtectedItemOperationStatusServerTransport instead. -type ProtectedItemOperationStatusServerTransport struct { - srv *ProtectedItemOperationStatusServer -} - -// Do implements the policy.Transporter interface for ProtectedItemOperationStatusServerTransport. -func (p *ProtectedItemOperationStatusServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ProtectedItemOperationStatusClient.Get": - resp, err = p.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *ProtectedItemOperationStatusServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectedItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - protectedItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("protectedItemName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, vaultNameParam, protectedItemNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/recoverypoints_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/recoverypoint_server.go similarity index 63% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/recoverypoints_server.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/recoverypoint_server.go index ec18f4d60e6d..09180566a33b 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/recoverypoints_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/recoverypoint_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. @@ -22,62 +19,81 @@ import ( "regexp" ) -// RecoveryPointsServer is a fake server for instances of the armrecoveryservicesdatareplication.RecoveryPointsClient type. -type RecoveryPointsServer struct { - // Get is the fake for method RecoveryPointsClient.Get +// RecoveryPointServer is a fake server for instances of the armrecoveryservicesdatareplication.RecoveryPointClient type. +type RecoveryPointServer struct { + // Get is the fake for method RecoveryPointClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, recoveryPointName string, options *armrecoveryservicesdatareplication.RecoveryPointsClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.RecoveryPointsClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, recoveryPointName string, options *armrecoveryservicesdatareplication.RecoveryPointClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.RecoveryPointClientGetResponse], errResp azfake.ErrorResponder) - // NewListPager is the fake for method RecoveryPointsClient.NewListPager + // NewListPager is the fake for method RecoveryPointClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, vaultName string, protectedItemName string, options *armrecoveryservicesdatareplication.RecoveryPointsClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesdatareplication.RecoveryPointsClientListResponse]) + NewListPager func(resourceGroupName string, vaultName string, protectedItemName string, options *armrecoveryservicesdatareplication.RecoveryPointClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesdatareplication.RecoveryPointClientListResponse]) } -// NewRecoveryPointsServerTransport creates a new instance of RecoveryPointsServerTransport with the provided implementation. -// The returned RecoveryPointsServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.RecoveryPointsClient via the +// NewRecoveryPointServerTransport creates a new instance of RecoveryPointServerTransport with the provided implementation. +// The returned RecoveryPointServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.RecoveryPointClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewRecoveryPointsServerTransport(srv *RecoveryPointsServer) *RecoveryPointsServerTransport { - return &RecoveryPointsServerTransport{ +func NewRecoveryPointServerTransport(srv *RecoveryPointServer) *RecoveryPointServerTransport { + return &RecoveryPointServerTransport{ srv: srv, - newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesdatareplication.RecoveryPointsClientListResponse]](), + newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesdatareplication.RecoveryPointClientListResponse]](), } } -// RecoveryPointsServerTransport connects instances of armrecoveryservicesdatareplication.RecoveryPointsClient to instances of RecoveryPointsServer. -// Don't use this type directly, use NewRecoveryPointsServerTransport instead. -type RecoveryPointsServerTransport struct { - srv *RecoveryPointsServer - newListPager *tracker[azfake.PagerResponder[armrecoveryservicesdatareplication.RecoveryPointsClientListResponse]] +// RecoveryPointServerTransport connects instances of armrecoveryservicesdatareplication.RecoveryPointClient to instances of RecoveryPointServer. +// Don't use this type directly, use NewRecoveryPointServerTransport instead. +type RecoveryPointServerTransport struct { + srv *RecoveryPointServer + newListPager *tracker[azfake.PagerResponder[armrecoveryservicesdatareplication.RecoveryPointClientListResponse]] } -// Do implements the policy.Transporter interface for RecoveryPointsServerTransport. -func (r *RecoveryPointsServerTransport) Do(req *http.Request) (*http.Response, error) { +// Do implements the policy.Transporter interface for RecoveryPointServerTransport. +func (r *RecoveryPointServerTransport) Do(req *http.Request) (*http.Response, error) { rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) method, ok := rawMethod.(string) if !ok { return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return r.dispatchToMethodFake(req, method) +} - switch method { - case "RecoveryPointsClient.Get": - resp, err = r.dispatchGet(req) - case "RecoveryPointsClient.NewListPager": - resp, err = r.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (r *RecoveryPointServerTransport) 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 recoveryPointServerTransportInterceptor != nil { + res.resp, res.err, intercepted = recoveryPointServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "RecoveryPointClient.Get": + res.resp, res.err = r.dispatchGet(req) + case "RecoveryPointClient.NewListPager": + res.resp, res.err = r.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 (r *RecoveryPointsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { +func (r *RecoveryPointServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { if r.srv.Get == nil { return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} } @@ -118,7 +134,7 @@ func (r *RecoveryPointsServerTransport) dispatchGet(req *http.Request) (*http.Re return resp, nil } -func (r *RecoveryPointsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { +func (r *RecoveryPointServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { if r.srv.NewListPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} } @@ -145,7 +161,7 @@ func (r *RecoveryPointsServerTransport) dispatchNewListPager(req *http.Request) resp := r.srv.NewListPager(resourceGroupNameParam, vaultNameParam, protectedItemNameParam, nil) newListPager = &resp r.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesdatareplication.RecoveryPointsClientListResponse, createLink func() string) { + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesdatareplication.RecoveryPointClientListResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } @@ -162,3 +178,9 @@ func (r *RecoveryPointsServerTransport) dispatchNewListPager(req *http.Request) } return resp, nil } + +// set this to conditionally intercept incoming requests to RecoveryPointServerTransport +var recoveryPointServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/replicationextension_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/replicationextension_server.go index ef034f78cc16..517af7a3fa67 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/replicationextension_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/replicationextension_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. @@ -29,7 +26,7 @@ type ReplicationExtensionServer struct { BeginCreate func(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, body armrecoveryservicesdatareplication.ReplicationExtensionModel, options *armrecoveryservicesdatareplication.ReplicationExtensionClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.ReplicationExtensionClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method ReplicationExtensionClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, options *armrecoveryservicesdatareplication.ReplicationExtensionClientBeginDeleteOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.ReplicationExtensionClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method ReplicationExtensionClient.Get @@ -70,27 +67,46 @@ func (r *ReplicationExtensionServerTransport) Do(req *http.Request) (*http.Respo return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return r.dispatchToMethodFake(req, method) +} - switch method { - case "ReplicationExtensionClient.BeginCreate": - resp, err = r.dispatchBeginCreate(req) - case "ReplicationExtensionClient.BeginDelete": - resp, err = r.dispatchBeginDelete(req) - case "ReplicationExtensionClient.Get": - resp, err = r.dispatchGet(req) - case "ReplicationExtensionClient.NewListPager": - resp, err = r.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (r *ReplicationExtensionServerTransport) 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 replicationExtensionServerTransportInterceptor != nil { + res.resp, res.err, intercepted = replicationExtensionServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ReplicationExtensionClient.BeginCreate": + res.resp, res.err = r.dispatchBeginCreate(req) + case "ReplicationExtensionClient.BeginDelete": + res.resp, res.err = r.dispatchBeginDelete(req) + case "ReplicationExtensionClient.Get": + res.resp, res.err = r.dispatchGet(req) + case "ReplicationExtensionClient.NewListPager": + res.resp, res.err = r.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 (r *ReplicationExtensionServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -182,9 +198,9 @@ func (r *ReplicationExtensionServerTransport) dispatchBeginDelete(req *http.Requ return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { r.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { r.beginDelete.remove(req) @@ -270,3 +286,9 @@ func (r *ReplicationExtensionServerTransport) dispatchNewListPager(req *http.Req } return resp, nil } + +// set this to conditionally intercept incoming requests to ReplicationExtensionServerTransport +var replicationExtensionServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/replicationextensionoperationstatus_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/replicationextensionoperationstatus_server.go deleted file mode 100644 index 7c20722dafe9..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/replicationextensionoperationstatus_server.go +++ /dev/null @@ -1,108 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" - "net/http" - "net/url" - "regexp" -) - -// ReplicationExtensionOperationStatusServer is a fake server for instances of the armrecoveryservicesdatareplication.ReplicationExtensionOperationStatusClient type. -type ReplicationExtensionOperationStatusServer struct { - // Get is the fake for method ReplicationExtensionOperationStatusClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, operationID string, options *armrecoveryservicesdatareplication.ReplicationExtensionOperationStatusClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.ReplicationExtensionOperationStatusClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewReplicationExtensionOperationStatusServerTransport creates a new instance of ReplicationExtensionOperationStatusServerTransport with the provided implementation. -// The returned ReplicationExtensionOperationStatusServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.ReplicationExtensionOperationStatusClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewReplicationExtensionOperationStatusServerTransport(srv *ReplicationExtensionOperationStatusServer) *ReplicationExtensionOperationStatusServerTransport { - return &ReplicationExtensionOperationStatusServerTransport{srv: srv} -} - -// ReplicationExtensionOperationStatusServerTransport connects instances of armrecoveryservicesdatareplication.ReplicationExtensionOperationStatusClient to instances of ReplicationExtensionOperationStatusServer. -// Don't use this type directly, use NewReplicationExtensionOperationStatusServerTransport instead. -type ReplicationExtensionOperationStatusServerTransport struct { - srv *ReplicationExtensionOperationStatusServer -} - -// Do implements the policy.Transporter interface for ReplicationExtensionOperationStatusServerTransport. -func (r *ReplicationExtensionOperationStatusServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "ReplicationExtensionOperationStatusClient.Get": - resp, err = r.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (r *ReplicationExtensionOperationStatusServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if r.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicationExtensions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - replicationExtensionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("replicationExtensionName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.Get(req.Context(), resourceGroupNameParam, vaultNameParam, replicationExtensionNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/server_factory.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/server_factory.go index 0f5380690e21..032ffefc222c 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/server_factory.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/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,25 +16,59 @@ import ( // ServerFactory is a fake server for instances of the armrecoveryservicesdatareplication.ClientFactory type. type ServerFactory struct { - AzureSiteRecoveryManagementServiceAPIServer AzureSiteRecoveryManagementServiceAPIServer - DraServer DraServer - DraOperationStatusServer DraOperationStatusServer - EmailConfigurationServer EmailConfigurationServer - EventServer EventServer - FabricServer FabricServer - FabricOperationsStatusServer FabricOperationsStatusServer - OperationsServer OperationsServer - PolicyServer PolicyServer - PolicyOperationStatusServer PolicyOperationStatusServer - ProtectedItemServer ProtectedItemServer - ProtectedItemOperationStatusServer ProtectedItemOperationStatusServer - RecoveryPointsServer RecoveryPointsServer - ReplicationExtensionServer ReplicationExtensionServer - ReplicationExtensionOperationStatusServer ReplicationExtensionOperationStatusServer - VaultServer VaultServer - VaultOperationStatusServer VaultOperationStatusServer - WorkflowServer WorkflowServer - WorkflowOperationStatusServer WorkflowOperationStatusServer + // CheckNameAvailabilityServer contains the fakes for client CheckNameAvailabilityClient + CheckNameAvailabilityServer CheckNameAvailabilityServer + + // DeploymentPreflightServer contains the fakes for client DeploymentPreflightClient + DeploymentPreflightServer DeploymentPreflightServer + + // EmailConfigurationServer contains the fakes for client EmailConfigurationClient + EmailConfigurationServer EmailConfigurationServer + + // EventServer contains the fakes for client EventClient + EventServer EventServer + + // FabricAgentServer contains the fakes for client FabricAgentClient + FabricAgentServer FabricAgentServer + + // FabricServer contains the fakes for client FabricClient + FabricServer FabricServer + + // JobServer contains the fakes for client JobClient + JobServer JobServer + + // LocationBasedOperationResultsServer contains the fakes for client LocationBasedOperationResultsClient + LocationBasedOperationResultsServer LocationBasedOperationResultsServer + + // OperationResultsServer contains the fakes for client OperationResultsClient + OperationResultsServer OperationResultsServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // PolicyServer contains the fakes for client PolicyClient + PolicyServer PolicyServer + + // PrivateEndpointConnectionProxiesServer contains the fakes for client PrivateEndpointConnectionProxiesClient + PrivateEndpointConnectionProxiesServer PrivateEndpointConnectionProxiesServer + + // PrivateEndpointConnectionsServer contains the fakes for client PrivateEndpointConnectionsClient + PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer + + // PrivateLinkResourcesServer contains the fakes for client PrivateLinkResourcesClient + PrivateLinkResourcesServer PrivateLinkResourcesServer + + // ProtectedItemServer contains the fakes for client ProtectedItemClient + ProtectedItemServer ProtectedItemServer + + // RecoveryPointServer contains the fakes for client RecoveryPointClient + RecoveryPointServer RecoveryPointServer + + // ReplicationExtensionServer contains the fakes for client ReplicationExtensionClient + ReplicationExtensionServer ReplicationExtensionServer + + // VaultServer contains the fakes for client VaultClient + VaultServer VaultServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -52,27 +83,26 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { // ServerFactoryTransport connects instances of armrecoveryservicesdatareplication.ClientFactory to instances of ServerFactory. // Don't use this type directly, use NewServerFactoryTransport instead. type ServerFactoryTransport struct { - srv *ServerFactory - trMu sync.Mutex - trAzureSiteRecoveryManagementServiceAPIServer *AzureSiteRecoveryManagementServiceAPIServerTransport - trDraServer *DraServerTransport - trDraOperationStatusServer *DraOperationStatusServerTransport - trEmailConfigurationServer *EmailConfigurationServerTransport - trEventServer *EventServerTransport - trFabricServer *FabricServerTransport - trFabricOperationsStatusServer *FabricOperationsStatusServerTransport - trOperationsServer *OperationsServerTransport - trPolicyServer *PolicyServerTransport - trPolicyOperationStatusServer *PolicyOperationStatusServerTransport - trProtectedItemServer *ProtectedItemServerTransport - trProtectedItemOperationStatusServer *ProtectedItemOperationStatusServerTransport - trRecoveryPointsServer *RecoveryPointsServerTransport - trReplicationExtensionServer *ReplicationExtensionServerTransport - trReplicationExtensionOperationStatusServer *ReplicationExtensionOperationStatusServerTransport - trVaultServer *VaultServerTransport - trVaultOperationStatusServer *VaultOperationStatusServerTransport - trWorkflowServer *WorkflowServerTransport - trWorkflowOperationStatusServer *WorkflowOperationStatusServerTransport + srv *ServerFactory + trMu sync.Mutex + trCheckNameAvailabilityServer *CheckNameAvailabilityServerTransport + trDeploymentPreflightServer *DeploymentPreflightServerTransport + trEmailConfigurationServer *EmailConfigurationServerTransport + trEventServer *EventServerTransport + trFabricAgentServer *FabricAgentServerTransport + trFabricServer *FabricServerTransport + trJobServer *JobServerTransport + trLocationBasedOperationResultsServer *LocationBasedOperationResultsServerTransport + trOperationResultsServer *OperationResultsServerTransport + trOperationsServer *OperationsServerTransport + trPolicyServer *PolicyServerTransport + trPrivateEndpointConnectionProxiesServer *PrivateEndpointConnectionProxiesServerTransport + trPrivateEndpointConnectionsServer *PrivateEndpointConnectionsServerTransport + trPrivateLinkResourcesServer *PrivateLinkResourcesServerTransport + trProtectedItemServer *ProtectedItemServerTransport + trRecoveryPointServer *RecoveryPointServerTransport + trReplicationExtensionServer *ReplicationExtensionServerTransport + trVaultServer *VaultServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -88,19 +118,16 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { var err error switch client { - case "AzureSiteRecoveryManagementServiceAPIClient": - initServer(s, &s.trAzureSiteRecoveryManagementServiceAPIServer, func() *AzureSiteRecoveryManagementServiceAPIServerTransport { - return NewAzureSiteRecoveryManagementServiceAPIServerTransport(&s.srv.AzureSiteRecoveryManagementServiceAPIServer) + case "CheckNameAvailabilityClient": + initServer(s, &s.trCheckNameAvailabilityServer, func() *CheckNameAvailabilityServerTransport { + return NewCheckNameAvailabilityServerTransport(&s.srv.CheckNameAvailabilityServer) }) - resp, err = s.trAzureSiteRecoveryManagementServiceAPIServer.Do(req) - case "DraClient": - initServer(s, &s.trDraServer, func() *DraServerTransport { return NewDraServerTransport(&s.srv.DraServer) }) - resp, err = s.trDraServer.Do(req) - case "DraOperationStatusClient": - initServer(s, &s.trDraOperationStatusServer, func() *DraOperationStatusServerTransport { - return NewDraOperationStatusServerTransport(&s.srv.DraOperationStatusServer) + resp, err = s.trCheckNameAvailabilityServer.Do(req) + case "DeploymentPreflightClient": + initServer(s, &s.trDeploymentPreflightServer, func() *DeploymentPreflightServerTransport { + return NewDeploymentPreflightServerTransport(&s.srv.DeploymentPreflightServer) }) - resp, err = s.trDraOperationStatusServer.Do(req) + resp, err = s.trDeploymentPreflightServer.Do(req) case "EmailConfigurationClient": initServer(s, &s.trEmailConfigurationServer, func() *EmailConfigurationServerTransport { return NewEmailConfigurationServerTransport(&s.srv.EmailConfigurationServer) @@ -109,66 +136,64 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { case "EventClient": initServer(s, &s.trEventServer, func() *EventServerTransport { return NewEventServerTransport(&s.srv.EventServer) }) resp, err = s.trEventServer.Do(req) + case "FabricAgentClient": + initServer(s, &s.trFabricAgentServer, func() *FabricAgentServerTransport { return NewFabricAgentServerTransport(&s.srv.FabricAgentServer) }) + resp, err = s.trFabricAgentServer.Do(req) case "FabricClient": initServer(s, &s.trFabricServer, func() *FabricServerTransport { return NewFabricServerTransport(&s.srv.FabricServer) }) resp, err = s.trFabricServer.Do(req) - case "FabricOperationsStatusClient": - initServer(s, &s.trFabricOperationsStatusServer, func() *FabricOperationsStatusServerTransport { - return NewFabricOperationsStatusServerTransport(&s.srv.FabricOperationsStatusServer) + case "JobClient": + initServer(s, &s.trJobServer, func() *JobServerTransport { return NewJobServerTransport(&s.srv.JobServer) }) + resp, err = s.trJobServer.Do(req) + case "LocationBasedOperationResultsClient": + initServer(s, &s.trLocationBasedOperationResultsServer, func() *LocationBasedOperationResultsServerTransport { + return NewLocationBasedOperationResultsServerTransport(&s.srv.LocationBasedOperationResultsServer) + }) + resp, err = s.trLocationBasedOperationResultsServer.Do(req) + case "OperationResultsClient": + initServer(s, &s.trOperationResultsServer, func() *OperationResultsServerTransport { + return NewOperationResultsServerTransport(&s.srv.OperationResultsServer) }) - resp, err = s.trFabricOperationsStatusServer.Do(req) + resp, err = s.trOperationResultsServer.Do(req) case "OperationsClient": initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) resp, err = s.trOperationsServer.Do(req) case "PolicyClient": initServer(s, &s.trPolicyServer, func() *PolicyServerTransport { return NewPolicyServerTransport(&s.srv.PolicyServer) }) resp, err = s.trPolicyServer.Do(req) - case "PolicyOperationStatusClient": - initServer(s, &s.trPolicyOperationStatusServer, func() *PolicyOperationStatusServerTransport { - return NewPolicyOperationStatusServerTransport(&s.srv.PolicyOperationStatusServer) + case "PrivateEndpointConnectionProxiesClient": + initServer(s, &s.trPrivateEndpointConnectionProxiesServer, func() *PrivateEndpointConnectionProxiesServerTransport { + return NewPrivateEndpointConnectionProxiesServerTransport(&s.srv.PrivateEndpointConnectionProxiesServer) }) - resp, err = s.trPolicyOperationStatusServer.Do(req) + resp, err = s.trPrivateEndpointConnectionProxiesServer.Do(req) + case "PrivateEndpointConnectionsClient": + initServer(s, &s.trPrivateEndpointConnectionsServer, func() *PrivateEndpointConnectionsServerTransport { + return NewPrivateEndpointConnectionsServerTransport(&s.srv.PrivateEndpointConnectionsServer) + }) + resp, err = s.trPrivateEndpointConnectionsServer.Do(req) + case "PrivateLinkResourcesClient": + initServer(s, &s.trPrivateLinkResourcesServer, func() *PrivateLinkResourcesServerTransport { + return NewPrivateLinkResourcesServerTransport(&s.srv.PrivateLinkResourcesServer) + }) + resp, err = s.trPrivateLinkResourcesServer.Do(req) case "ProtectedItemClient": initServer(s, &s.trProtectedItemServer, func() *ProtectedItemServerTransport { return NewProtectedItemServerTransport(&s.srv.ProtectedItemServer) }) resp, err = s.trProtectedItemServer.Do(req) - case "ProtectedItemOperationStatusClient": - initServer(s, &s.trProtectedItemOperationStatusServer, func() *ProtectedItemOperationStatusServerTransport { - return NewProtectedItemOperationStatusServerTransport(&s.srv.ProtectedItemOperationStatusServer) - }) - resp, err = s.trProtectedItemOperationStatusServer.Do(req) - case "RecoveryPointsClient": - initServer(s, &s.trRecoveryPointsServer, func() *RecoveryPointsServerTransport { - return NewRecoveryPointsServerTransport(&s.srv.RecoveryPointsServer) + case "RecoveryPointClient": + initServer(s, &s.trRecoveryPointServer, func() *RecoveryPointServerTransport { + return NewRecoveryPointServerTransport(&s.srv.RecoveryPointServer) }) - resp, err = s.trRecoveryPointsServer.Do(req) + resp, err = s.trRecoveryPointServer.Do(req) case "ReplicationExtensionClient": initServer(s, &s.trReplicationExtensionServer, func() *ReplicationExtensionServerTransport { return NewReplicationExtensionServerTransport(&s.srv.ReplicationExtensionServer) }) resp, err = s.trReplicationExtensionServer.Do(req) - case "ReplicationExtensionOperationStatusClient": - initServer(s, &s.trReplicationExtensionOperationStatusServer, func() *ReplicationExtensionOperationStatusServerTransport { - return NewReplicationExtensionOperationStatusServerTransport(&s.srv.ReplicationExtensionOperationStatusServer) - }) - resp, err = s.trReplicationExtensionOperationStatusServer.Do(req) case "VaultClient": initServer(s, &s.trVaultServer, func() *VaultServerTransport { return NewVaultServerTransport(&s.srv.VaultServer) }) resp, err = s.trVaultServer.Do(req) - case "VaultOperationStatusClient": - initServer(s, &s.trVaultOperationStatusServer, func() *VaultOperationStatusServerTransport { - return NewVaultOperationStatusServerTransport(&s.srv.VaultOperationStatusServer) - }) - resp, err = s.trVaultOperationStatusServer.Do(req) - case "WorkflowClient": - initServer(s, &s.trWorkflowServer, func() *WorkflowServerTransport { return NewWorkflowServerTransport(&s.srv.WorkflowServer) }) - resp, err = s.trWorkflowServer.Do(req) - case "WorkflowOperationStatusClient": - initServer(s, &s.trWorkflowOperationStatusServer, func() *WorkflowOperationStatusServerTransport { - return NewWorkflowOperationStatusServerTransport(&s.srv.WorkflowOperationStatusServer) - }) - resp, err = s.trWorkflowOperationStatusServer.Do(req) default: err = fmt.Errorf("unhandled client %s", client) } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/time_rfc3339.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/time_rfc3339.go deleted file mode 100644 index b0535a7b63e6..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/vault_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/vault_server.go index 632d5724589f..2d42359425f2 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/vault_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/vault_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. @@ -29,7 +26,7 @@ type VaultServer struct { BeginCreate func(ctx context.Context, resourceGroupName string, vaultName string, body armrecoveryservicesdatareplication.VaultModel, options *armrecoveryservicesdatareplication.VaultClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.VaultClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method VaultClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, vaultName string, options *armrecoveryservicesdatareplication.VaultClientBeginDeleteOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.VaultClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method VaultClient.Get @@ -82,31 +79,50 @@ func (v *VaultServerTransport) 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 v.dispatchToMethodFake(req, method) +} - switch method { - case "VaultClient.BeginCreate": - resp, err = v.dispatchBeginCreate(req) - case "VaultClient.BeginDelete": - resp, err = v.dispatchBeginDelete(req) - case "VaultClient.Get": - resp, err = v.dispatchGet(req) - case "VaultClient.NewListPager": - resp, err = v.dispatchNewListPager(req) - case "VaultClient.NewListBySubscriptionPager": - resp, err = v.dispatchNewListBySubscriptionPager(req) - case "VaultClient.BeginUpdate": - resp, err = v.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (v *VaultServerTransport) 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 vaultServerTransportInterceptor != nil { + res.resp, res.err, intercepted = vaultServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "VaultClient.BeginCreate": + res.resp, res.err = v.dispatchBeginCreate(req) + case "VaultClient.BeginDelete": + res.resp, res.err = v.dispatchBeginDelete(req) + case "VaultClient.Get": + res.resp, res.err = v.dispatchGet(req) + case "VaultClient.NewListPager": + res.resp, res.err = v.dispatchNewListPager(req) + case "VaultClient.NewListBySubscriptionPager": + res.resp, res.err = v.dispatchNewListBySubscriptionPager(req) + case "VaultClient.BeginUpdate": + res.resp, res.err = v.dispatchBeginUpdate(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 (v *VaultServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -190,9 +206,9 @@ func (v *VaultServerTransport) dispatchBeginDelete(req *http.Request) (*http.Res return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { v.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { v.beginDelete.remove(req) @@ -295,19 +311,7 @@ func (v *VaultServerTransport) dispatchNewListBySubscriptionPager(req *http.Requ if matches == nil || len(matches) < 1 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - qp := req.URL.Query() - continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) - if err != nil { - return nil, err - } - continuationTokenParam := getOptional(continuationTokenUnescaped) - var options *armrecoveryservicesdatareplication.VaultClientListBySubscriptionOptions - if continuationTokenParam != nil { - options = &armrecoveryservicesdatareplication.VaultClientListBySubscriptionOptions{ - ContinuationToken: continuationTokenParam, - } - } - resp := v.srv.NewListBySubscriptionPager(options) + resp := v.srv.NewListBySubscriptionPager(nil) newListBySubscriptionPager = &resp v.newListBySubscriptionPager.add(req, newListBySubscriptionPager) server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armrecoveryservicesdatareplication.VaultClientListBySubscriptionResponse, createLink func() string) { @@ -375,3 +379,9 @@ func (v *VaultServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Res return resp, nil } + +// set this to conditionally intercept incoming requests to VaultServerTransport +var vaultServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/vaultoperationstatus_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/vaultoperationstatus_server.go deleted file mode 100644 index 510518d046ea..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/vaultoperationstatus_server.go +++ /dev/null @@ -1,104 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" - "net/http" - "net/url" - "regexp" -) - -// VaultOperationStatusServer is a fake server for instances of the armrecoveryservicesdatareplication.VaultOperationStatusClient type. -type VaultOperationStatusServer struct { - // Get is the fake for method VaultOperationStatusClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, vaultName string, operationID string, options *armrecoveryservicesdatareplication.VaultOperationStatusClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.VaultOperationStatusClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewVaultOperationStatusServerTransport creates a new instance of VaultOperationStatusServerTransport with the provided implementation. -// The returned VaultOperationStatusServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.VaultOperationStatusClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewVaultOperationStatusServerTransport(srv *VaultOperationStatusServer) *VaultOperationStatusServerTransport { - return &VaultOperationStatusServerTransport{srv: srv} -} - -// VaultOperationStatusServerTransport connects instances of armrecoveryservicesdatareplication.VaultOperationStatusClient to instances of VaultOperationStatusServer. -// Don't use this type directly, use NewVaultOperationStatusServerTransport instead. -type VaultOperationStatusServerTransport struct { - srv *VaultOperationStatusServer -} - -// Do implements the policy.Transporter interface for VaultOperationStatusServerTransport. -func (v *VaultOperationStatusServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "VaultOperationStatusClient.Get": - resp, err = v.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (v *VaultOperationStatusServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if v.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := v.srv.Get(req.Context(), resourceGroupNameParam, vaultNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/workflowoperationstatus_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/workflowoperationstatus_server.go deleted file mode 100644 index f5a3d46502dd..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/workflowoperationstatus_server.go +++ /dev/null @@ -1,108 +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 ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" - "net/http" - "net/url" - "regexp" -) - -// WorkflowOperationStatusServer is a fake server for instances of the armrecoveryservicesdatareplication.WorkflowOperationStatusClient type. -type WorkflowOperationStatusServer struct { - // Get is the fake for method WorkflowOperationStatusClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, vaultName string, jobName string, operationID string, options *armrecoveryservicesdatareplication.WorkflowOperationStatusClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.WorkflowOperationStatusClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewWorkflowOperationStatusServerTransport creates a new instance of WorkflowOperationStatusServerTransport with the provided implementation. -// The returned WorkflowOperationStatusServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.WorkflowOperationStatusClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewWorkflowOperationStatusServerTransport(srv *WorkflowOperationStatusServer) *WorkflowOperationStatusServerTransport { - return &WorkflowOperationStatusServerTransport{srv: srv} -} - -// WorkflowOperationStatusServerTransport connects instances of armrecoveryservicesdatareplication.WorkflowOperationStatusClient to instances of WorkflowOperationStatusServer. -// Don't use this type directly, use NewWorkflowOperationStatusServerTransport instead. -type WorkflowOperationStatusServerTransport struct { - srv *WorkflowOperationStatusServer -} - -// Do implements the policy.Transporter interface for WorkflowOperationStatusServerTransport. -func (w *WorkflowOperationStatusServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "WorkflowOperationStatusClient.Get": - resp, err = w.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (w *WorkflowOperationStatusServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if w.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/jobs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - jobNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("jobName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := w.srv.Get(req.Context(), resourceGroupNameParam, vaultNameParam, jobNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/go.mod b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/go.mod index dd0dca1016df..2c6402e9d105 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/go.mod +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdat 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 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.2 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.36.0 // indirect golang.org/x/net v0.38.0 // indirect - golang.org/x/sys v0.31.0 // indirect golang.org/x/text v0.23.0 // indirect ) diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/go.sum b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/go.sum index 4bacf756f06c..4de695d9e23a 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/go.sum +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/go.sum @@ -1,44 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 h1:DSDNVxqkoXJiko6x8a90zidoYqnYYa6c1MTzDKzKkTo= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1/go.mod h1:zGqV2R4Cr/k8Uye5w+dgQ06WJtEcbQG/8J7BB6hnCr4= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 h1:F0gBpfdPLGsw+nsgk6aqqkZS1jiixa5WwFe3fk/T3Ys= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2/go.mod h1:SqINnQ9lVVdRlyC8cd1lCI0SdX4n2paeABd2K8ggfnE= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2 h1:yz1bePFlP5Vws5+8ez6T3HWXPmwOK7Yvq8QxDBD3SKY= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2/go.mod h1:Pa9ZNPuoNu/GztvBSKk9J1cDJW6vk/n0zLtV4mgd8N8= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= -github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 h1:oygO0locgZJe7PpYPXT5A29ZkwJaPqcva7BVeemZOZs= -github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= -github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= -github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8= -github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6 h1:IsMZxCuZqKuao2vNdfD82fjjgPLfyHLpR41Z88viRWs= -github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6/go.mod h1:3VeWNIJaW+O5xpRQbPp0Ybqu1vJd/pm7s2F473HRrkw= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E= -github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= -golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= -golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/interfaces.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/interfaces.go index 5cb38b340968..2bac05979fc9 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/interfaces.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/interfaces.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. @@ -8,24 +5,24 @@ package armrecoveryservicesdatareplication -// DraModelCustomPropertiesClassification provides polymorphic access to related types. -// Call the interface's GetDraModelCustomProperties() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *DraModelCustomProperties, *VMwareDraModelCustomProperties -type DraModelCustomPropertiesClassification interface { - // GetDraModelCustomProperties returns the DraModelCustomProperties content of the underlying type. - GetDraModelCustomProperties() *DraModelCustomProperties -} - // EventModelCustomPropertiesClassification provides polymorphic access to related types. // Call the interface's GetEventModelCustomProperties() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: -// - *EventModelCustomProperties, *HyperVToAzStackHCIEventModelCustomProperties +// - *EventModelCustomProperties, *HyperVToAzStackHCIEventModelCustomProperties, *VMwareToAzStackHCIEventModelCustomProperties type EventModelCustomPropertiesClassification interface { // GetEventModelCustomProperties returns the EventModelCustomProperties content of the underlying type. GetEventModelCustomProperties() *EventModelCustomProperties } +// FabricAgentModelCustomPropertiesClassification provides polymorphic access to related types. +// Call the interface's GetFabricAgentModelCustomProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *FabricAgentModelCustomProperties, *VMwareFabricAgentModelCustomProperties +type FabricAgentModelCustomPropertiesClassification interface { + // GetFabricAgentModelCustomProperties returns the FabricAgentModelCustomProperties content of the underlying type. + GetFabricAgentModelCustomProperties() *FabricAgentModelCustomProperties +} + // FabricModelCustomPropertiesClassification provides polymorphic access to related types. // Call the interface's GetFabricModelCustomProperties() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -35,6 +32,15 @@ type FabricModelCustomPropertiesClassification interface { GetFabricModelCustomProperties() *FabricModelCustomProperties } +// JobModelCustomPropertiesClassification provides polymorphic access to related types. +// Call the interface's GetJobModelCustomProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *FailoverJobModelCustomProperties, *JobModelCustomProperties, *TestFailoverCleanupJobModelCustomProperties, *TestFailoverJobModelCustomProperties +type JobModelCustomPropertiesClassification interface { + // GetJobModelCustomProperties returns the JobModelCustomProperties content of the underlying type. + GetJobModelCustomProperties() *JobModelCustomProperties +} + // PlannedFailoverModelCustomPropertiesClassification provides polymorphic access to related types. // Call the interface's GetPlannedFailoverModelCustomProperties() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -62,10 +68,19 @@ type ProtectedItemModelCustomPropertiesClassification interface { GetProtectedItemModelCustomProperties() *ProtectedItemModelCustomProperties } +// ProtectedItemModelCustomPropertiesUpdateClassification provides polymorphic access to related types. +// Call the interface's GetProtectedItemModelCustomPropertiesUpdate() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate, *ProtectedItemModelCustomPropertiesUpdate, *VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate +type ProtectedItemModelCustomPropertiesUpdateClassification interface { + // GetProtectedItemModelCustomPropertiesUpdate returns the ProtectedItemModelCustomPropertiesUpdate content of the underlying type. + GetProtectedItemModelCustomPropertiesUpdate() *ProtectedItemModelCustomPropertiesUpdate +} + // RecoveryPointModelCustomPropertiesClassification provides polymorphic access to related types. // Call the interface's GetRecoveryPointModelCustomProperties() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: -// - *HyperVToAzStackHCIRecoveryPointModelCustomProperties, *RecoveryPointModelCustomProperties +// - *HyperVToAzStackHCIRecoveryPointModelCustomProperties, *RecoveryPointModelCustomProperties, *VMwareToAzStackHCIRecoveryPointModelCustomProperties type RecoveryPointModelCustomPropertiesClassification interface { // GetRecoveryPointModelCustomProperties returns the RecoveryPointModelCustomProperties content of the underlying type. GetRecoveryPointModelCustomProperties() *RecoveryPointModelCustomProperties @@ -79,13 +94,3 @@ type ReplicationExtensionModelCustomPropertiesClassification interface { // GetReplicationExtensionModelCustomProperties returns the ReplicationExtensionModelCustomProperties content of the underlying type. GetReplicationExtensionModelCustomProperties() *ReplicationExtensionModelCustomProperties } - -// WorkflowModelCustomPropertiesClassification provides polymorphic access to related types. -// Call the interface's GetWorkflowModelCustomProperties() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *FailoverWorkflowModelCustomProperties, *TestFailoverCleanupWorkflowModelCustomProperties, *TestFailoverWorkflowModelCustomProperties, -// - *WorkflowModelCustomProperties -type WorkflowModelCustomPropertiesClassification interface { - // GetWorkflowModelCustomProperties returns the WorkflowModelCustomProperties content of the underlying type. - GetWorkflowModelCustomProperties() *WorkflowModelCustomProperties -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflow_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/job_client.go similarity index 64% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflow_client.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/job_client.go index 65bfc24d57d1..5df4aac33b52 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflow_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/job_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. @@ -17,26 +14,27 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" + "strconv" "strings" ) -// WorkflowClient contains the methods for the Workflow group. -// Don't use this type directly, use NewWorkflowClient() instead. -type WorkflowClient struct { +// JobClient contains the methods for the Job group. +// Don't use this type directly, use NewJobClient() instead. +type JobClient struct { internal *arm.Client subscriptionID string } -// NewWorkflowClient creates a new instance of WorkflowClient with the specified values. +// NewJobClient creates a new instance of JobClient with the specified values. // - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. -func NewWorkflowClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkflowClient, error) { +func NewJobClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*JobClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } - client := &WorkflowClient{ + client := &JobClient{ subscriptionID: subscriptionID, internal: cl, } @@ -46,35 +44,35 @@ func NewWorkflowClient(subscriptionID string, credential azcore.TokenCredential, // Get - Gets the details of the job. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. -// - jobName - The job (workflow) name. -// - options - WorkflowClientGetOptions contains the optional parameters for the WorkflowClient.Get method. -func (client *WorkflowClient) Get(ctx context.Context, resourceGroupName string, vaultName string, jobName string, options *WorkflowClientGetOptions) (WorkflowClientGetResponse, error) { +// - jobName - The job name. +// - options - JobClientGetOptions contains the optional parameters for the JobClient.Get method. +func (client *JobClient) Get(ctx context.Context, resourceGroupName string, vaultName string, jobName string, options *JobClientGetOptions) (JobClientGetResponse, error) { var err error - const operationName = "WorkflowClient.Get" + const operationName = "JobClient.Get" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, jobName, options) if err != nil { - return WorkflowClientGetResponse{}, err + return JobClientGetResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return WorkflowClientGetResponse{}, err + return JobClientGetResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return WorkflowClientGetResponse{}, err + return JobClientGetResponse{}, err } resp, err := client.getHandleResponse(httpResp) return resp, err } // getCreateRequest creates the Get request. -func (client *WorkflowClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, jobName string, options *WorkflowClientGetOptions) (*policy.Request, error) { +func (client *JobClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, jobName string, _ *JobClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs/{jobName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -97,34 +95,34 @@ func (client *WorkflowClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // getHandleResponse handles the Get response. -func (client *WorkflowClient) getHandleResponse(resp *http.Response) (WorkflowClientGetResponse, error) { - result := WorkflowClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowModel); err != nil { - return WorkflowClientGetResponse{}, err +func (client *JobClient) getHandleResponse(resp *http.Response) (JobClientGetResponse, error) { + result := JobClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.JobModel); err != nil { + return JobClientGetResponse{}, err } return result, nil } // NewListPager - Gets the list of jobs in the given vault. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. -// - options - WorkflowClientListOptions contains the optional parameters for the WorkflowClient.NewListPager method. -func (client *WorkflowClient) NewListPager(resourceGroupName string, vaultName string, options *WorkflowClientListOptions) *runtime.Pager[WorkflowClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[WorkflowClientListResponse]{ - More: func(page WorkflowClientListResponse) bool { +// - options - JobClientListOptions contains the optional parameters for the JobClient.NewListPager method. +func (client *JobClient) NewListPager(resourceGroupName string, vaultName string, options *JobClientListOptions) *runtime.Pager[JobClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[JobClientListResponse]{ + More: func(page JobClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *WorkflowClientListResponse) (WorkflowClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "WorkflowClient.NewListPager") + Fetcher: func(ctx context.Context, page *JobClientListResponse) (JobClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "JobClient.NewListPager") nextLink := "" if page != nil { nextLink = *page.NextLink @@ -133,7 +131,7 @@ func (client *WorkflowClient) NewListPager(resourceGroupName string, vaultName s return client.listCreateRequest(ctx, resourceGroupName, vaultName, options) }, nil) if err != nil { - return WorkflowClientListResponse{}, err + return JobClientListResponse{}, err } return client.listHandleResponse(resp) }, @@ -142,7 +140,7 @@ func (client *WorkflowClient) NewListPager(resourceGroupName string, vaultName s } // listCreateRequest creates the List request. -func (client *WorkflowClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *WorkflowClientListOptions) (*policy.Request, error) { +func (client *JobClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *JobClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -161,23 +159,26 @@ func (client *WorkflowClient) listCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } + reqQP.Set("api-version", "2024-09-01") if options != nil && options.ContinuationToken != nil { reqQP.Set("continuationToken", *options.ContinuationToken) } - reqQP.Set("api-version", "2021-02-16-preview") + if options != nil && options.ODataOptions != nil { + reqQP.Set("odataOptions", *options.ODataOptions) + } + if options != nil && options.PageSize != nil { + reqQP.Set("pageSize", strconv.FormatInt(int64(*options.PageSize), 10)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // listHandleResponse handles the List response. -func (client *WorkflowClient) listHandleResponse(resp *http.Response) (WorkflowClientListResponse, error) { - result := WorkflowClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowModelCollection); err != nil { - return WorkflowClientListResponse{}, err +func (client *JobClient) listHandleResponse(resp *http.Response) (JobClientListResponse, error) { + result := JobClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.JobModelListResult); err != nil { + return JobClientListResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricoperationsstatus_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/locationbasedoperationresults_client.go similarity index 56% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricoperationsstatus_client.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/locationbasedoperationresults_client.go index 5040d6ee8038..f83514a06180 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricoperationsstatus_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/locationbasedoperationresults_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. @@ -20,63 +17,63 @@ import ( "strings" ) -// FabricOperationsStatusClient contains the methods for the FabricOperationsStatus group. -// Don't use this type directly, use NewFabricOperationsStatusClient() instead. -type FabricOperationsStatusClient struct { +// LocationBasedOperationResultsClient contains the methods for the LocationBasedOperationResults group. +// Don't use this type directly, use NewLocationBasedOperationResultsClient() instead. +type LocationBasedOperationResultsClient struct { internal *arm.Client subscriptionID string } -// NewFabricOperationsStatusClient creates a new instance of FabricOperationsStatusClient with the specified values. +// NewLocationBasedOperationResultsClient creates a new instance of LocationBasedOperationResultsClient with the specified values. // - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. -func NewFabricOperationsStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FabricOperationsStatusClient, error) { +func NewLocationBasedOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LocationBasedOperationResultsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } - client := &FabricOperationsStatusClient{ + client := &LocationBasedOperationResultsClient{ subscriptionID: subscriptionID, internal: cl, } return client, nil } -// Get - Tracks the results of an asynchronous operation on the fabric. +// Get - Gets the location based operation result. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - fabricName - The fabric name. +// - location - The name of the Azure region. // - operationID - The ID of an ongoing async operation. -// - options - FabricOperationsStatusClientGetOptions contains the optional parameters for the FabricOperationsStatusClient.Get +// - options - LocationBasedOperationResultsClientGetOptions contains the optional parameters for the LocationBasedOperationResultsClient.Get // method. -func (client *FabricOperationsStatusClient) Get(ctx context.Context, resourceGroupName string, fabricName string, operationID string, options *FabricOperationsStatusClientGetOptions) (FabricOperationsStatusClientGetResponse, error) { +func (client *LocationBasedOperationResultsClient) Get(ctx context.Context, resourceGroupName string, location string, operationID string, options *LocationBasedOperationResultsClientGetOptions) (LocationBasedOperationResultsClientGetResponse, error) { var err error - const operationName = "FabricOperationsStatusClient.Get" + const operationName = "LocationBasedOperationResultsClient.Get" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, fabricName, operationID, options) + req, err := client.getCreateRequest(ctx, resourceGroupName, location, operationID, options) if err != nil { - return FabricOperationsStatusClientGetResponse{}, err + return LocationBasedOperationResultsClientGetResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return FabricOperationsStatusClientGetResponse{}, err + return LocationBasedOperationResultsClientGetResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return FabricOperationsStatusClientGetResponse{}, err + return LocationBasedOperationResultsClientGetResponse{}, err } resp, err := client.getHandleResponse(httpResp) return resp, err } // getCreateRequest creates the Get request. -func (client *FabricOperationsStatusClient) getCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, operationID string, options *FabricOperationsStatusClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/operations/{operationId}" +func (client *LocationBasedOperationResultsClient) getCreateRequest(ctx context.Context, resourceGroupName string, location string, operationID string, _ *LocationBasedOperationResultsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/locations/{location}/operationResults/{operationId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -85,10 +82,10 @@ func (client *FabricOperationsStatusClient) getCreateRequest(ctx context.Context return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if fabricName == "" { - return nil, errors.New("parameter fabricName cannot be empty") + if location == "" { + return nil, errors.New("parameter location cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) if operationID == "" { return nil, errors.New("parameter operationID cannot be empty") } @@ -98,17 +95,17 @@ func (client *FabricOperationsStatusClient) getCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // getHandleResponse handles the Get response. -func (client *FabricOperationsStatusClient) getHandleResponse(resp *http.Response) (FabricOperationsStatusClientGetResponse, error) { - result := FabricOperationsStatusClientGetResponse{} +func (client *LocationBasedOperationResultsClient) getHandleResponse(resp *http.Response) (LocationBasedOperationResultsClientGetResponse, error) { + result := LocationBasedOperationResultsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return FabricOperationsStatusClientGetResponse{}, err + return LocationBasedOperationResultsClientGetResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/models.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/models.go index 0efe2449ce05..aa46ef4e1d0e 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/models.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/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. @@ -33,7 +30,7 @@ type AzStackHCIFabricModelCustomProperties struct { // REQUIRED; AzStackHCI cluster properties. Cluster *AzStackHCIClusterProperties - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for FabricModelCustomProperties. InstanceType *string // REQUIRED; Gets or sets the Migration solution ARM Id. @@ -80,6 +77,24 @@ type CheckNameAvailabilityResponseModel struct { Reason *string } +// ConnectionDetails - Private endpoint connection details at member level. +type ConnectionDetails struct { + // Gets or sets group id. + GroupID *string + + // Gets or sets id. + ID *string + + // Gets or sets link identifier. + LinkIdentifier *string + + // Gets or sets member name. + MemberName *string + + // Gets or sets private IP address. + PrivateIPAddress *string +} + // DeploymentPreflightModel - Deployment preflight model. type DeploymentPreflightModel struct { // Gets or sets the list of resources. @@ -97,127 +112,50 @@ type DeploymentPreflightResource struct { // Gets or sets the resource name. Name *string - // Gets or sets the resource type. - Type *string -} - -// DraModel - Dra model. -type DraModel struct { - // REQUIRED; Dra model properties. - Properties *DraModelProperties - - // READ-ONLY; Gets or sets the Id of the resource. - ID *string - - // READ-ONLY; Gets or sets the name of the resource. - Name *string - - // READ-ONLY - SystemData *DraModelSystemData + // Gets or sets the properties of the resource. + Properties any - // READ-ONLY; Gets or sets the type of the resource. + // Gets or sets the resource type. Type *string } -// DraModelCollection - Dra model collection. -type DraModelCollection struct { - // Gets or sets the value of next link. - NextLink *string - - // Gets or sets the list of Dras. - Value []*DraModel -} - -// DraModelCustomProperties - Dra model custom properties. -type DraModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. - InstanceType *string -} - -// GetDraModelCustomProperties implements the DraModelCustomPropertiesClassification interface for type DraModelCustomProperties. -func (d *DraModelCustomProperties) GetDraModelCustomProperties() *DraModelCustomProperties { return d } - -// DraModelProperties - Dra model properties. -type DraModelProperties struct { - // REQUIRED; Identity model. - AuthenticationIdentity *IdentityModel - - // REQUIRED; Dra model custom properties. - CustomProperties DraModelCustomPropertiesClassification - - // REQUIRED; Gets or sets the machine Id where Dra is running. - MachineID *string - - // REQUIRED; Gets or sets the machine name where Dra is running. - MachineName *string - - // REQUIRED; Identity model. - ResourceAccessIdentity *IdentityModel - - // READ-ONLY; Gets or sets the Dra correlation Id. - CorrelationID *string - - // READ-ONLY; Gets or sets the list of health errors. - HealthErrors []*HealthErrorModel - - // READ-ONLY; Gets or sets a value indicating whether Dra is responsive. - IsResponsive *bool - - // READ-ONLY; Gets or sets the time when last heartbeat was sent by the Dra. - LastHeartbeat *time.Time - - // READ-ONLY; Gets or sets the provisioning state of the Dra. - ProvisioningState *ProvisioningState - - // READ-ONLY; Gets or sets the Dra version. - VersionNumber *string -} - -type DraModelSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time - - // Gets or sets identity that created the resource. - CreatedBy *string - - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string +// DiskControllerInputs - Disk controller. +type DiskControllerInputs struct { + // REQUIRED; Gets or sets the controller ID. + ControllerID *int32 - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time - - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string + // REQUIRED; Gets or sets the controller Location. + ControllerLocation *int32 - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string + // REQUIRED; Gets or sets the controller name (IDE,SCSI). + ControllerName *string } // EmailConfigurationModel - Email configuration model. type EmailConfigurationModel struct { - // REQUIRED; Email configuration model properties. + // The resource-specific properties for this resource. Properties *EmailConfigurationModelProperties - // READ-ONLY; Gets or sets the Id of the resource. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; Gets or sets the name of the resource. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY - SystemData *EmailConfigurationModelSystemData + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; Gets or sets the type of the resource. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// EmailConfigurationModelCollection - Email configuration model collection. -type EmailConfigurationModelCollection struct { - // Gets or sets the value of next link. - NextLink *string - - // Gets or sets the list of email configurations. +// EmailConfigurationModelListResult - The response of a EmailConfigurationModel list operation. +type EmailConfigurationModelListResult struct { + // REQUIRED; The EmailConfigurationModel items on this page Value []*EmailConfigurationModel + + // The link to the next page of items + NextLink *string } // EmailConfigurationModelProperties - Email configuration model properties. @@ -230,26 +168,9 @@ type EmailConfigurationModelProperties struct { // Gets or sets the locale for the email notification. Locale *string -} - -type EmailConfigurationModelSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time - - // Gets or sets identity that created the resource. - CreatedBy *string - - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string - - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time - - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string + // READ-ONLY; Gets or sets the provisioning state of the email configuration. + ProvisioningState *ProvisioningState } // ErrorModel - Error model. @@ -278,34 +199,25 @@ type ErrorModel struct { // EventModel - Event model. type EventModel struct { - // REQUIRED; Event model properties. + // The resource-specific properties for this resource. Properties *EventModelProperties - // READ-ONLY; Gets or sets the Id of the resource. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; Gets or sets the name of the resource. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY - SystemData *EventModelSystemData + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; Gets or sets the type of the resource. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// EventModelCollection - Event model collection. -type EventModelCollection struct { - // Gets or sets the value of next link. - NextLink *string - - // Gets or sets the list of events. - Value []*EventModel -} - // EventModelCustomProperties - Event model custom properties. type EventModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for EventModelCustomProperties. InstanceType *string } @@ -314,6 +226,15 @@ func (e *EventModelCustomProperties) GetEventModelCustomProperties() *EventModel return e } +// EventModelListResult - The response of a EventModel list operation. +type EventModelListResult struct { + // REQUIRED; The EventModel items on this page + Value []*EventModel + + // The link to the next page of items + NextLink *string +} + // EventModelProperties - Event model properties. type EventModelProperties struct { // REQUIRED; Event model custom properties. @@ -334,6 +255,9 @@ type EventModelProperties struct { // READ-ONLY; Gets or sets the errors associated with this event. HealthErrors []*HealthErrorModel + // READ-ONLY; Gets or sets the provisioning state of the event. + ProvisioningState *ProvisioningState + // READ-ONLY; Gets or sets the resource name. ResourceName *string @@ -347,62 +271,107 @@ type EventModelProperties struct { TimeOfOccurrence *time.Time } -type EventModelSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time +// FabricAgentModel - Fabric agent model. +type FabricAgentModel struct { + // The resource-specific properties for this resource. + Properties *FabricAgentModelProperties - // Gets or sets identity that created the resource. - CreatedBy *string + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string + // READ-ONLY; The name of the resource + Name *string - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// FabricAgentModelCustomProperties - Fabric agent model custom properties. +type FabricAgentModelCustomProperties struct { + // REQUIRED; Discriminator property for FabricAgentModelCustomProperties. + InstanceType *string +} + +// GetFabricAgentModelCustomProperties implements the FabricAgentModelCustomPropertiesClassification interface for type FabricAgentModelCustomProperties. +func (f *FabricAgentModelCustomProperties) GetFabricAgentModelCustomProperties() *FabricAgentModelCustomProperties { + return f +} + +// FabricAgentModelListResult - The response of a FabricAgentModel list operation. +type FabricAgentModelListResult struct { + // REQUIRED; The FabricAgentModel items on this page + Value []*FabricAgentModel + + // The link to the next page of items + NextLink *string +} + +// FabricAgentModelProperties - Fabric agent model properties. +type FabricAgentModelProperties struct { + // REQUIRED; Identity model. + AuthenticationIdentity *IdentityModel + + // REQUIRED; Fabric agent model custom properties. + CustomProperties FabricAgentModelCustomPropertiesClassification + + // REQUIRED; Gets or sets the machine Id where fabric agent is running. + MachineID *string + + // REQUIRED; Gets or sets the machine name where fabric agent is running. + MachineName *string + + // REQUIRED; Identity model. + ResourceAccessIdentity *IdentityModel + + // READ-ONLY; Gets or sets the fabric agent correlation Id. + CorrelationID *string - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string + // READ-ONLY; Gets or sets the list of health errors. + HealthErrors []*HealthErrorModel + + // READ-ONLY; Gets or sets a value indicating whether the fabric agent is responsive. + IsResponsive *bool + + // READ-ONLY; Gets or sets the time when last heartbeat was sent by the fabric agent. + LastHeartbeat *time.Time + + // READ-ONLY; Gets or sets the provisioning state of the fabric agent. + ProvisioningState *ProvisioningState + + // READ-ONLY; Gets or sets the fabric agent version. + VersionNumber *string } // FabricModel - Fabric model. type FabricModel struct { - // REQUIRED; Gets or sets the location of the fabric. + // REQUIRED; The geo-location where the resource lives Location *string - // REQUIRED; Fabric model properties. + // The resource-specific properties for this resource. Properties *FabricModelProperties - // Gets or sets the resource tags. + // Resource tags. Tags map[string]*string - // READ-ONLY; Gets or sets the Id of the resource. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; Gets or sets the name of the resource. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY - SystemData *FabricModelSystemData + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; Gets or sets the type of the resource. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// FabricModelCollection - Fabric model collection. -type FabricModelCollection struct { - // Gets or sets the value of next link. - NextLink *string - - // Gets or sets the list of fabrics. - Value []*FabricModel -} - // FabricModelCustomProperties - Fabric model custom properties. type FabricModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for FabricModelCustomProperties. InstanceType *string } @@ -411,6 +380,15 @@ func (f *FabricModelCustomProperties) GetFabricModelCustomProperties() *FabricMo return f } +// FabricModelListResult - The response of a FabricModel list operation. +type FabricModelListResult struct { + // REQUIRED; The FabricModel items on this page + Value []*FabricModel + + // The link to the next page of items + NextLink *string +} + // FabricModelProperties - Fabric model properties. type FabricModelProperties struct { // REQUIRED; Fabric model custom properties. @@ -432,27 +410,7 @@ type FabricModelProperties struct { ServiceResourceID *string } -type FabricModelSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time - - // Gets or sets identity that created the resource. - CreatedBy *string - - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string - - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time - - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string - - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string -} - -// FabricModelUpdate - Fabric model for update. +// FabricModelUpdate - Fabric model update. type FabricModelUpdate struct { // Fabric model properties. Properties *FabricModelProperties @@ -466,31 +424,31 @@ type FabricModelUpdate struct { // READ-ONLY; Gets or sets the name of the resource. Name *string - // READ-ONLY - SystemData *FabricModelUpdateSystemData + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData // READ-ONLY; Gets or sets the type of the resource. Type *string } -type FabricModelUpdateSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time - - // Gets or sets identity that created the resource. - CreatedBy *string - - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string +// FailoverJobModelCustomProperties - Failover job model custom properties. +type FailoverJobModelCustomProperties struct { + // REQUIRED; Discriminator property for JobModelCustomProperties. + InstanceType *string - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time + // READ-ONLY; Gets or sets any custom properties of the affected object. + AffectedObjectDetails *JobModelCustomPropertiesAffectedObjectDetails - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string + // READ-ONLY; Gets or sets the failed over protected item details. + ProtectedItemDetails []*FailoverProtectedItemProperties +} - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string +// GetJobModelCustomProperties implements the JobModelCustomPropertiesClassification interface for type FailoverJobModelCustomProperties. +func (f *FailoverJobModelCustomProperties) GetJobModelCustomProperties() *JobModelCustomProperties { + return &JobModelCustomProperties{ + AffectedObjectDetails: f.AffectedObjectDetails, + InstanceType: f.InstanceType, + } } // FailoverProtectedItemProperties - Failover properties of the protected item. @@ -517,24 +475,25 @@ type FailoverProtectedItemProperties struct { VMName *string } -// FailoverWorkflowModelCustomProperties - Failover workflow model custom properties. -type FailoverWorkflowModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. - InstanceType *string +// GroupConnectivityInformation - Represents of a connection's group information. +type GroupConnectivityInformation struct { + // Gets or sets customer visible FQDNs. + CustomerVisibleFqdns []*string - // READ-ONLY; Gets or sets any custom properties of the affected object. - AffectedObjectDetails map[string]*string + // Gets or sets group id. + GroupID *string - // READ-ONLY; Gets or sets the failed over protected item details. - ProtectedItemDetails []*FailoverProtectedItemProperties -} + // Gets or sets Internal Fqdn. + InternalFqdn *string -// GetWorkflowModelCustomProperties implements the WorkflowModelCustomPropertiesClassification interface for type FailoverWorkflowModelCustomProperties. -func (f *FailoverWorkflowModelCustomProperties) GetWorkflowModelCustomProperties() *WorkflowModelCustomProperties { - return &WorkflowModelCustomProperties{ - AffectedObjectDetails: f.AffectedObjectDetails, - InstanceType: f.InstanceType, - } + // Gets or sets member name. + MemberName *string + + // Gets or sets the private link service arm region. + PrivateLinkServiceArmRegion *string + + // Gets or sets the redirect map id. + RedirectMapID *string } // HealthErrorModel - Health error model. @@ -589,7 +548,7 @@ type HyperVMigrateFabricModelCustomProperties struct { // REQUIRED; Gets or sets the ARM Id of the HyperV site. HyperVSiteID *string - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for FabricModelCustomProperties. InstanceType *string // REQUIRED; Gets or sets the migration solution ARM Id. @@ -626,6 +585,21 @@ type HyperVToAzStackHCIDiskInput struct { // REQUIRED; Gets or sets a value indicating whether disk is os disk. IsOsDisk *bool + // Gets or sets a value of disk block size. + DiskBlockSize *int64 + + // Disk controller. + DiskController *DiskControllerInputs + + // Gets or sets a value of disk identifier. + DiskIdentifier *string + + // Gets or sets a value of disk logical sector size. + DiskLogicalSectorSize *int64 + + // Gets or sets a value of disk physical sector size. + DiskPhysicalSectorSize *int64 + // Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard disk. IsDynamic *bool @@ -637,7 +611,7 @@ type HyperVToAzStackHCIDiskInput struct { // provider specific details for events of type DataContract.HealthEvents.HealthEventType.ProtectedItemHealth and // DataContract.HealthEvents.HealthEventType.AgentHealth. type HyperVToAzStackHCIEventModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for EventModelCustomProperties. InstanceType *string // READ-ONLY; Gets or sets the friendly name of the source which has raised this health event. @@ -671,10 +645,16 @@ type HyperVToAzStackHCINicInput struct { // REQUIRED; Gets or sets the selection type of the NIC. SelectionTypeForFailover *VMNicSelection - // REQUIRED; Gets or sets the target network Id within AzStackHCI Cluster. + // Gets or sets a value indicating whether mac address migration is enabled. + IsMacMigrationEnabled *bool + + // Gets or sets a value indicating whether static ip migration is enabled. + IsStaticIPMigrationEnabled *bool + + // Gets or sets the target network Id within AzStackHCI Cluster. TargetNetworkID *string - // REQUIRED; Gets or sets the target test network Id within AzStackHCI Cluster. + // Gets or sets the target test network Id within AzStackHCI Cluster. TestNetworkID *string // READ-ONLY; Gets or sets the network name. @@ -683,7 +663,7 @@ type HyperVToAzStackHCINicInput struct { // HyperVToAzStackHCIPlannedFailoverModelCustomProperties - HyperV to AzStackHCI planned failover model custom properties. type HyperVToAzStackHCIPlannedFailoverModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for PlannedFailoverModelCustomProperties. InstanceType *string // REQUIRED; Gets or sets a value indicating whether VM needs to be shut down. @@ -706,7 +686,7 @@ type HyperVToAzStackHCIPolicyModelCustomProperties struct { // REQUIRED; Gets or sets the crash consistent snapshot frequency (in minutes). CrashConsistentFrequencyInMinutes *int32 - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for PolicyModelCustomProperties. InstanceType *string // REQUIRED; Gets or sets the duration in minutes until which the recovery points need to be stored. @@ -725,6 +705,15 @@ type HyperVToAzStackHCIProtectedDiskProperties struct { // READ-ONLY; Gets or sets the disk capacity in bytes. CapacityInBytes *int64 + // READ-ONLY; Gets or sets a value of disk block size. + DiskBlockSize *int64 + + // READ-ONLY; Gets or sets a value of disk logical sector size. + DiskLogicalSectorSize *int64 + + // READ-ONLY; Gets or sets a value of disk physical sector size. + DiskPhysicalSectorSize *int64 + // READ-ONLY; Gets or sets the disk type. DiskType *string @@ -770,7 +759,7 @@ type HyperVToAzStackHCIProtectedItemModelCustomProperties struct { // REQUIRED; Gets or sets the hypervisor generation of the virtual machine. HyperVGeneration *string - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for ProtectedItemModelCustomProperties. InstanceType *string // REQUIRED; Gets or sets the list of VM NIC to replicate. @@ -779,8 +768,8 @@ type HyperVToAzStackHCIProtectedItemModelCustomProperties struct { // REQUIRED; Gets or sets the Run As account Id. RunAsAccountID *string - // REQUIRED; Gets or sets the source DRA name. - SourceDraName *string + // REQUIRED; Gets or sets the source fabric agent name. + SourceFabricAgentName *string // REQUIRED; Gets or sets the target storage container ARM Id. StorageContainerID *string @@ -788,8 +777,8 @@ type HyperVToAzStackHCIProtectedItemModelCustomProperties struct { // REQUIRED; Gets or sets the Target Arc Cluster Custom Location ARM Id. TargetArcClusterCustomLocationID *string - // REQUIRED; Gets or sets the target DRA name. - TargetDraName *string + // REQUIRED; Gets or sets the target fabric agent name. + TargetFabricAgentName *string // REQUIRED; Gets or sets the Target HCI Cluster ARM Id. TargetHciClusterID *string @@ -889,6 +878,38 @@ func (h *HyperVToAzStackHCIProtectedItemModelCustomProperties) GetProtectedItemM } } +// HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate - HyperV to AzStackHCI Protected item model custom properties. +type HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate struct { + // REQUIRED; Discriminator property for ProtectedItemModelCustomPropertiesUpdate. + InstanceType *string + + // Protected item dynamic memory config. + DynamicMemoryConfig *ProtectedItemDynamicMemoryConfig + + // Gets or sets a value indicating whether memory is dynamical. + IsDynamicRAM *bool + + // Gets or sets the list of VM NIC to replicate. + NicsToInclude []*HyperVToAzStackHCINicInput + + // Gets or sets the type of the OS. + OSType *string + + // Gets or sets the target CPU cores. + TargetCPUCores *int32 + + // Gets or sets the target memory in mega-bytes. + TargetMemoryInMegaBytes *int32 +} + +// GetProtectedItemModelCustomPropertiesUpdate implements the ProtectedItemModelCustomPropertiesUpdateClassification interface +// for type HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate. +func (h *HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate) GetProtectedItemModelCustomPropertiesUpdate() *ProtectedItemModelCustomPropertiesUpdate { + return &ProtectedItemModelCustomPropertiesUpdate{ + InstanceType: h.InstanceType, + } +} + // HyperVToAzStackHCIProtectedNicProperties - HyperVToAzStackHCI NIC properties. type HyperVToAzStackHCIProtectedNicProperties struct { // READ-ONLY; Gets or sets the NIC mac address. @@ -912,7 +933,7 @@ type HyperVToAzStackHCIProtectedNicProperties struct { // HyperVToAzStackHCIRecoveryPointModelCustomProperties - HyperV to AzStackHCI recovery point model custom properties. type HyperVToAzStackHCIRecoveryPointModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for RecoveryPointModelCustomProperties. InstanceType *string // READ-ONLY; Gets or sets the list of the disk Ids. @@ -935,7 +956,7 @@ type HyperVToAzStackHCIReplicationExtensionModelCustomProperties struct { // REQUIRED; Gets or sets the ARM Id of the source HyperV fabric. HyperVFabricArmID *string - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for ReplicationExtensionModelCustomProperties. InstanceType *string // Gets or sets the storage account Id. @@ -991,19 +1012,19 @@ func (h *HyperVToAzStackHCIReplicationExtensionModelCustomProperties) GetReplica // IdentityModel - Identity model. type IdentityModel struct { - // REQUIRED; Gets or sets the authority of the SPN with which Dra communicates to service. + // REQUIRED; Gets or sets the authority of the SPN with which fabric agent communicates to service. AADAuthority *string - // REQUIRED; Gets or sets the client/application Id of the SPN with which Dra communicates to service. + // REQUIRED; Gets or sets the client/application Id of the SPN with which fabric agent communicates to service. ApplicationID *string - // REQUIRED; Gets or sets the audience of the SPN with which Dra communicates to service. + // REQUIRED; Gets or sets the audience of the SPN with which fabric agent communicates to service. Audience *string - // REQUIRED; Gets or sets the object Id of the SPN with which Dra communicates to service. + // REQUIRED; Gets or sets the object Id of the SPN with which fabric agent communicates to service. ObjectID *string - // REQUIRED; Gets or sets the tenant Id of the SPN with which Dra communicates to service. + // REQUIRED; Gets or sets the tenant Id of the SPN with which fabric agent communicates to service. TenantID *string } @@ -1043,34 +1064,157 @@ type InnerHealthErrorModel struct { Summary *string } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API -type Operation struct { - // Localized display information for this particular operation. - Display *OperationDisplay - - // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - ActionType *ActionType +// JobModel - Job model. +type JobModel struct { + // The resource-specific properties for this resource. + Properties *JobModelProperties - // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane - // operations. - IsDataAction *bool + // 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 operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", - // "Microsoft.Compute/virtualMachines/capture/action" + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default - // value is "user,system" - Origin *Origin + // 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 } -// OperationDisplay - Localized display information for this particular operation. -type OperationDisplay struct { - // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. - Description *string +// JobModelCustomProperties - Job model custom properties. +type JobModelCustomProperties struct { + // REQUIRED; Discriminator property for JobModelCustomProperties. + InstanceType *string - // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual - // Machine", "Restart Virtual Machine". + // READ-ONLY; Gets or sets any custom properties of the affected object. + AffectedObjectDetails *JobModelCustomPropertiesAffectedObjectDetails +} + +// GetJobModelCustomProperties implements the JobModelCustomPropertiesClassification interface for type JobModelCustomProperties. +func (j *JobModelCustomProperties) GetJobModelCustomProperties() *JobModelCustomProperties { return j } + +// JobModelCustomPropertiesAffectedObjectDetails - Gets or sets any custom properties of the affected object. +type JobModelCustomPropertiesAffectedObjectDetails struct { + // CONSTANT; undefinedField has constant value "object", any specified value is ignored. + Type *string + Description *string +} + +// JobModelListResult - The response of a JobModel list operation. +type JobModelListResult struct { + // REQUIRED; The JobModel items on this page + Value []*JobModel + + // The link to the next page of items + NextLink *string +} + +// JobModelProperties - Job model properties. +type JobModelProperties struct { + // REQUIRED; Job model custom properties. + CustomProperties JobModelCustomPropertiesClassification + + // READ-ONLY; Gets or sets the job activity id. + ActivityID *string + + // READ-ONLY; Gets or sets the list of allowed actions on the job. + AllowedActions []*string + + // READ-ONLY; Gets or sets the friendly display name. + DisplayName *string + + // READ-ONLY; Gets or sets the end time. + EndTime *time.Time + + // READ-ONLY; Gets or sets the list of errors. + Errors []*ErrorModel + + // READ-ONLY; Gets or sets the affected object Id. + ObjectID *string + + // READ-ONLY; Gets or sets the affected object internal Id. + ObjectInternalID *string + + // READ-ONLY; Gets or sets the affected object internal name. + ObjectInternalName *string + + // READ-ONLY; Gets or sets the affected object name. + ObjectName *string + + // READ-ONLY; Gets or sets the object type. + ObjectType *JobObjectType + + // READ-ONLY; Gets or sets the provisioning state of the job. + ProvisioningState *ProvisioningState + + // READ-ONLY; Gets or sets the replication provider. + ReplicationProviderID *string + + // READ-ONLY; Gets or sets the source fabric provider. + SourceFabricProviderID *string + + // READ-ONLY; Gets or sets the start time. + StartTime *time.Time + + // READ-ONLY; Gets or sets the job state. + State *JobState + + // READ-ONLY; Gets or sets the target fabric provider. + TargetFabricProviderID *string + + // READ-ONLY; Gets or sets the list of tasks. + Tasks []*TaskModel +} + +// ManagedServiceIdentity - Managed service identity (system assigned and/or user assigned identities) +type ManagedServiceIdentity struct { + // REQUIRED; Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + Type *ManagedServiceIdentityType + + // The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM + // resource ids in the form: + // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + // The dictionary values can be empty objects ({}) in + // requests. + UserAssignedIdentities map[string]*UserAssignedIdentity + + // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned + // identity. + PrincipalID *string + + // READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *string +} + +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane + // operations. + IsDataAction *bool + + // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", + // "Microsoft.Compute/virtualMachines/capture/action" + Name *string + + // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + // value is "user,system" + Origin *Origin +} + +// OperationDisplay - Localized display information for this particular operation. +type OperationDisplay struct { + // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. + Description *string + + // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + // Machine", "Restart Virtual Machine". Operation *string // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft @@ -1119,7 +1263,7 @@ type PlannedFailoverModel struct { // PlannedFailoverModelCustomProperties - Planned failover model custom properties. type PlannedFailoverModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for PlannedFailoverModelCustomProperties. InstanceType *string } @@ -1137,34 +1281,25 @@ type PlannedFailoverModelProperties struct { // PolicyModel - Policy model. type PolicyModel struct { - // REQUIRED; Policy model properties. + // The resource-specific properties for this resource. Properties *PolicyModelProperties - // READ-ONLY; Gets or sets the Id of the resource. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; Gets or sets the name of the resource. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY - SystemData *PolicyModelSystemData + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; Gets or sets the type of the resource. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// PolicyModelCollection - Policy model collection. -type PolicyModelCollection struct { - // Gets or sets the value of next link. - NextLink *string - - // Gets or sets the list of policies. - Value []*PolicyModel -} - // PolicyModelCustomProperties - Policy model custom properties. type PolicyModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for PolicyModelCustomProperties. InstanceType *string } @@ -1173,6 +1308,15 @@ func (p *PolicyModelCustomProperties) GetPolicyModelCustomProperties() *PolicyMo return p } +// PolicyModelListResult - The response of a PolicyModel list operation. +type PolicyModelListResult struct { + // REQUIRED; The PolicyModel items on this page + Value []*PolicyModel + + // The link to the next page of items + NextLink *string +} + // PolicyModelProperties - Policy model properties. type PolicyModelProperties struct { // REQUIRED; Policy model custom properties. @@ -1182,24 +1326,170 @@ type PolicyModelProperties struct { ProvisioningState *ProvisioningState } -type PolicyModelSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time +// PrivateEndpoint - Represent private Endpoint network resource that is linked to the Private Endpoint connection. +type PrivateEndpoint struct { + // Gets or sets the id. + ID *string +} - // Gets or sets identity that created the resource. - CreatedBy *string +// PrivateEndpointConnection - Represents private endpoint connection. +type PrivateEndpointConnection struct { + // The resource-specific properties for this resource. + Properties *PrivateEndpointConnectionResponseProperties - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + ID *string - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time + // READ-ONLY; The name of the resource + Name *string - // Gets or sets the identity that last modified the resource. - LastModifiedBy *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 +} + +// PrivateEndpointConnectionListResult - The response of a PrivateEndpointConnection list operation. +type PrivateEndpointConnectionListResult struct { + // REQUIRED; The PrivateEndpointConnection items on this page + Value []*PrivateEndpointConnection - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string + // The link to the next page of items + NextLink *string +} + +// PrivateEndpointConnectionProxy - Represents private endpoint connection proxy request. +type PrivateEndpointConnectionProxy struct { + // Gets or sets ETag. + Etag *string + + // The resource-specific properties for this resource. + Properties *PrivateEndpointConnectionProxyProperties + + // 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 + 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 +} + +// PrivateEndpointConnectionProxyListResult - The response of a PrivateEndpointConnectionProxy list operation. +type PrivateEndpointConnectionProxyListResult struct { + // REQUIRED; The PrivateEndpointConnectionProxy items on this page + Value []*PrivateEndpointConnectionProxy + + // The link to the next page of items + NextLink *string +} + +// PrivateEndpointConnectionProxyProperties - Represents private endpoint connection proxy request. +type PrivateEndpointConnectionProxyProperties struct { + // Represent remote private endpoint information for the private endpoint connection proxy. + RemotePrivateEndpoint *RemotePrivateEndpoint + + // READ-ONLY; Gets or sets the provisioning state of the private endpoint connection proxy. + ProvisioningState *ProvisioningState +} + +// PrivateEndpointConnectionResponseProperties - Represents Private endpoint connection response properties. +type PrivateEndpointConnectionResponseProperties struct { + // Represent private Endpoint network resource that is linked to the Private Endpoint connection. + PrivateEndpoint *PrivateEndpoint + + // Represents Private link service connection state. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState + + // READ-ONLY; Gets or sets provisioning state of the private endpoint connection. + ProvisioningState *ProvisioningState +} + +// PrivateLinkResource - Represents private link resource. +type PrivateLinkResource struct { + // The resource-specific properties for this resource. + Properties *PrivateLinkResourceProperties + + // 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 + 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 +} + +// PrivateLinkResourceListResult - The response of a PrivateLinkResource list operation. +type PrivateLinkResourceListResult struct { + // REQUIRED; The PrivateLinkResource items on this page + Value []*PrivateLinkResource + + // The link to the next page of items + NextLink *string +} + +// PrivateLinkResourceProperties - Represents private link resource properties. +type PrivateLinkResourceProperties struct { + // Gets or sets the group id. + GroupID *string + + // Gets or sets the required member. This translates to how many Private IPs should be created for each privately linkable + // resource. + RequiredMembers []*string + + // Gets or sets the private DNS zone names. + RequiredZoneNames []*string + + // READ-ONLY; Gets or sets the provisioning state of the private link resource. + ProvisioningState *ProvisioningState +} + +// PrivateLinkServiceConnection - Represents of an NRP private link service connection. +type PrivateLinkServiceConnection struct { + // Gets or sets group ids. + GroupIDs []*string + + // Gets or sets private link service connection name. + Name *string + + // Gets or sets the request message for the private link service connection. + RequestMessage *string +} + +// PrivateLinkServiceConnectionState - Represents Private link service connection state. +type PrivateLinkServiceConnectionState struct { + // Gets or sets actions required. + ActionsRequired *string + + // Gets or sets description. + Description *string + + // Gets or sets the status. + Status *PrivateEndpointConnectionStatus +} + +// PrivateLinkServiceProxy - Represents NRP private link service proxy. +type PrivateLinkServiceProxy struct { + // Gets or sets group connectivity information. + GroupConnectivityInformation []*GroupConnectivityInformation + + // Gets or sets private link service proxy id. + ID *string + + // Represent remote private endpoint connection. + RemotePrivateEndpointConnection *RemotePrivateEndpointConnection + + // Represents Private link service connection state. + RemotePrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState } // ProtectedItemDynamicMemoryConfig - Protected item dynamic memory config. @@ -1214,36 +1504,51 @@ type ProtectedItemDynamicMemoryConfig struct { TargetMemoryBufferPercentage *int32 } +// ProtectedItemJobProperties - Protected item job properties. +type ProtectedItemJobProperties struct { + // READ-ONLY; Gets or sets the job friendly display name. + DisplayName *string + + // READ-ONLY; Gets or sets end time of the job. + EndTime *time.Time + + // READ-ONLY; Gets or sets job Id. + ID *string + + // READ-ONLY; Gets or sets job name. + Name *string + + // READ-ONLY; Gets or sets protection scenario name. + ScenarioName *string + + // READ-ONLY; Gets or sets start time of the job. + StartTime *time.Time + + // READ-ONLY; Gets or sets job state. + State *string +} + // ProtectedItemModel - Protected item model. type ProtectedItemModel struct { - // REQUIRED; Protected item model properties. + // The resource-specific properties for this resource. Properties *ProtectedItemModelProperties - // READ-ONLY; Gets or sets the Id of the resource. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; Gets or sets the name of the resource. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY - SystemData *ProtectedItemModelSystemData + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; Gets or sets the type of the resource. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// ProtectedItemModelCollection - Protected item model collection. -type ProtectedItemModelCollection struct { - // Gets or sets the value of next link. - NextLink *string - - // Gets or sets the list of protected items. - Value []*ProtectedItemModel -} - // ProtectedItemModelCustomProperties - Protected item model custom properties. type ProtectedItemModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for ProtectedItemModelCustomProperties. InstanceType *string } @@ -1253,6 +1558,27 @@ func (p *ProtectedItemModelCustomProperties) GetProtectedItemModelCustomProperti return p } +// ProtectedItemModelCustomPropertiesUpdate - Protected item model custom properties. +type ProtectedItemModelCustomPropertiesUpdate struct { + // REQUIRED; Discriminator property for ProtectedItemModelCustomPropertiesUpdate. + InstanceType *string +} + +// GetProtectedItemModelCustomPropertiesUpdate implements the ProtectedItemModelCustomPropertiesUpdateClassification interface +// for type ProtectedItemModelCustomPropertiesUpdate. +func (p *ProtectedItemModelCustomPropertiesUpdate) GetProtectedItemModelCustomPropertiesUpdate() *ProtectedItemModelCustomPropertiesUpdate { + return p +} + +// ProtectedItemModelListResult - The response of a ProtectedItemModel list operation. +type ProtectedItemModelListResult struct { + // REQUIRED; The ProtectedItemModel items on this page + Value []*ProtectedItemModel + + // The link to the next page of items + NextLink *string +} + // ProtectedItemModelProperties - Protected item model properties. type ProtectedItemModelProperties struct { // REQUIRED; Protected item model custom properties. @@ -1270,11 +1596,11 @@ type ProtectedItemModelProperties struct { // READ-ONLY; Gets or sets the protected item correlation Id. CorrelationID *string - // READ-ONLY - CurrentJob *ProtectedItemModelPropertiesCurrentJob + // READ-ONLY; Gets or sets the current scenario. + CurrentJob *ProtectedItemJobProperties - // READ-ONLY; Gets or sets the DRA Id. - DraID *string + // READ-ONLY; Gets or sets the fabric agent Id. + FabricAgentID *string // READ-ONLY; Gets or sets the fabric Id. FabricID *string @@ -1288,11 +1614,11 @@ type ProtectedItemModelProperties struct { // READ-ONLY; Gets or sets the list of health errors. HealthErrors []*HealthErrorModel - // READ-ONLY - LastFailedEnableProtectionJob *ProtectedItemModelPropertiesLastFailedEnableProtectionJob + // READ-ONLY; Gets or sets the last failed enabled protection job. + LastFailedEnableProtectionJob *ProtectedItemJobProperties - // READ-ONLY - LastFailedPlannedFailoverJob *ProtectedItemModelPropertiesLastFailedPlannedFailoverJob + // READ-ONLY; Gets or sets the last failed planned failover job. + LastFailedPlannedFailoverJob *ProtectedItemJobProperties // READ-ONLY; Gets or sets the Last successful planned failover time. LastSuccessfulPlannedFailoverTime *time.Time @@ -1303,8 +1629,8 @@ type ProtectedItemModelProperties struct { // READ-ONLY; Gets or sets the Last successful unplanned failover time. LastSuccessfulUnplannedFailoverTime *time.Time - // READ-ONLY - LastTestFailoverJob *ProtectedItemModelPropertiesLastTestFailoverJob + // READ-ONLY; Gets or sets the last test failover job. + LastTestFailoverJob *ProtectedItemJobProperties // READ-ONLY; Gets or sets the protection state. ProtectionState *ProtectionState @@ -1312,7 +1638,7 @@ type ProtectedItemModelProperties struct { // READ-ONLY; Gets or sets the protection state description. ProtectionStateDescription *string - // READ-ONLY; Gets or sets the provisioning state of the Dra. + // READ-ONLY; Gets or sets the provisioning state of the fabric agent. ProvisioningState *ProvisioningState // READ-ONLY; Gets or sets protected item replication health. @@ -1327,8 +1653,8 @@ type ProtectedItemModelProperties struct { // READ-ONLY; Gets or sets the source fabric provider Id. SourceFabricProviderID *string - // READ-ONLY; Gets or sets the target DRA Id. - TargetDraID *string + // READ-ONLY; Gets or sets the target fabric agent Id. + TargetFabricAgentID *string // READ-ONLY; Gets or sets the target fabric Id. TargetFabricID *string @@ -1343,148 +1669,51 @@ type ProtectedItemModelProperties struct { TestFailoverStateDescription *string } -type ProtectedItemModelPropertiesCurrentJob struct { - // READ-ONLY; Gets or sets the workflow friendly display name. - DisplayName *string - - // READ-ONLY; Gets or sets end time of the workflow. - EndTime *time.Time - - // READ-ONLY; Gets or sets workflow Id. - ID *string - - // READ-ONLY; Gets or sets workflow name. - Name *string - - // READ-ONLY; Gets or sets protection scenario name. - ScenarioName *string - - // READ-ONLY; Gets or sets start time of the workflow. - StartTime *time.Time - - // READ-ONLY; Gets or sets workflow state. - State *string -} - -type ProtectedItemModelPropertiesLastFailedEnableProtectionJob struct { - // READ-ONLY; Gets or sets the workflow friendly display name. - DisplayName *string - - // READ-ONLY; Gets or sets end time of the workflow. - EndTime *time.Time - - // READ-ONLY; Gets or sets workflow Id. - ID *string - - // READ-ONLY; Gets or sets workflow name. - Name *string - - // READ-ONLY; Gets or sets protection scenario name. - ScenarioName *string - - // READ-ONLY; Gets or sets start time of the workflow. - StartTime *time.Time - - // READ-ONLY; Gets or sets workflow state. - State *string -} - -type ProtectedItemModelPropertiesLastFailedPlannedFailoverJob struct { - // READ-ONLY; Gets or sets the workflow friendly display name. - DisplayName *string - - // READ-ONLY; Gets or sets end time of the workflow. - EndTime *time.Time - - // READ-ONLY; Gets or sets workflow Id. - ID *string - - // READ-ONLY; Gets or sets workflow name. - Name *string - - // READ-ONLY; Gets or sets protection scenario name. - ScenarioName *string - - // READ-ONLY; Gets or sets start time of the workflow. - StartTime *time.Time - - // READ-ONLY; Gets or sets workflow state. - State *string +// ProtectedItemModelPropertiesUpdate - Protected item model properties update. +type ProtectedItemModelPropertiesUpdate struct { + // Protected item model custom properties update. + CustomProperties ProtectedItemModelCustomPropertiesUpdateClassification } -type ProtectedItemModelPropertiesLastTestFailoverJob struct { - // READ-ONLY; Gets or sets the workflow friendly display name. - DisplayName *string +// ProtectedItemModelUpdate - Protected item model update. +type ProtectedItemModelUpdate struct { + // Protected item model properties. + Properties *ProtectedItemModelPropertiesUpdate - // READ-ONLY; Gets or sets end time of the workflow. - EndTime *time.Time - - // READ-ONLY; Gets or sets workflow Id. + // READ-ONLY; Gets or sets the Id of the resource. ID *string - // READ-ONLY; Gets or sets workflow name. + // READ-ONLY; Gets or sets the name of the resource. Name *string - // READ-ONLY; Gets or sets protection scenario name. - ScenarioName *string - - // READ-ONLY; Gets or sets start time of the workflow. - StartTime *time.Time + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData - // READ-ONLY; Gets or sets workflow state. - State *string -} - -type ProtectedItemModelSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time - - // Gets or sets identity that created the resource. - CreatedBy *string - - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string - - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time - - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string - - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string + // READ-ONLY; Gets or sets the type of the resource. + Type *string } // RecoveryPointModel - Recovery point model. type RecoveryPointModel struct { - // REQUIRED; Recovery point model properties. + // The resource-specific properties for this resource. Properties *RecoveryPointModelProperties - // READ-ONLY; Gets or sets the Id of the resource. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; Gets or sets the name of the resource. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY - SystemData *RecoveryPointModelSystemData + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; Gets or sets the type of the resource. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// RecoveryPointModelCollection - Recovery point model collection. -type RecoveryPointModelCollection struct { - // Gets or sets the value of next link. - NextLink *string - - // Gets or sets the list of recovery points. - Value []*RecoveryPointModel -} - // RecoveryPointModelCustomProperties - Recovery point model custom properties. type RecoveryPointModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for RecoveryPointModelCustomProperties. InstanceType *string } @@ -1494,6 +1723,15 @@ func (r *RecoveryPointModelCustomProperties) GetRecoveryPointModelCustomProperti return r } +// RecoveryPointModelListResult - The response of a RecoveryPointModel list operation. +type RecoveryPointModelListResult struct { + // REQUIRED; The RecoveryPointModel items on this page + Value []*RecoveryPointModel + + // The link to the next page of items + NextLink *string +} + // RecoveryPointModelProperties - Recovery point model properties. type RecoveryPointModelProperties struct { // REQUIRED; Recovery point model custom properties. @@ -1504,58 +1742,56 @@ type RecoveryPointModelProperties struct { // REQUIRED; Gets or sets the recovery point type. RecoveryPointType *RecoveryPointType + + // READ-ONLY; Gets or sets the provisioning state of the recovery point item. + ProvisioningState *ProvisioningState } -type RecoveryPointModelSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time +// RemotePrivateEndpoint - Represent remote private endpoint information for the private endpoint connection proxy. +type RemotePrivateEndpoint struct { + // REQUIRED; Gets or sets private link service proxy id. + ID *string - // Gets or sets identity that created the resource. - CreatedBy *string + // Gets or sets the list of Connection Details. This is the connection details for private endpoint. + ConnectionDetails []*ConnectionDetails - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string + // Gets or sets the list of Manual Private Link Service Connections and gets populated for Manual approval flow. + ManualPrivateLinkServiceConnections []*PrivateLinkServiceConnection - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time + // Gets or sets the list of Private Link Service Connections and gets populated for Auto approval flow. + PrivateLinkServiceConnections []*PrivateLinkServiceConnection - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string + // Gets or sets the list of private link service proxies. + PrivateLinkServiceProxies []*PrivateLinkServiceProxy +} - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string +// RemotePrivateEndpointConnection - Represent remote private endpoint connection. +type RemotePrivateEndpointConnection struct { + // Gets or sets the remote private endpoint connection id. + ID *string } // ReplicationExtensionModel - Replication extension model. type ReplicationExtensionModel struct { - // REQUIRED; Replication extension model properties. + // The resource-specific properties for this resource. Properties *ReplicationExtensionModelProperties - // READ-ONLY; Gets or sets the Id of the resource. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; Gets or sets the name of the resource. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY - SystemData *ReplicationExtensionModelSystemData + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; Gets or sets the type of the resource. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// ReplicationExtensionModelCollection - Replication extension model collection. -type ReplicationExtensionModelCollection struct { - // Gets or sets the value of next link. - NextLink *string - - // Gets or sets the list of replication extensions. - Value []*ReplicationExtensionModel -} - // ReplicationExtensionModelCustomProperties - Replication extension model custom properties. type ReplicationExtensionModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for ReplicationExtensionModelCustomProperties. InstanceType *string } @@ -1565,6 +1801,15 @@ func (r *ReplicationExtensionModelCustomProperties) GetReplicationExtensionModel return r } +// ReplicationExtensionModelListResult - The response of a ReplicationExtensionModel list operation. +type ReplicationExtensionModelListResult struct { + // REQUIRED; The ReplicationExtensionModel items on this page + Value []*ReplicationExtensionModel + + // The link to the next page of items + NextLink *string +} + // ReplicationExtensionModelProperties - Replication extension model properties. type ReplicationExtensionModelProperties struct { // REQUIRED; Replication extension model custom properties. @@ -1574,39 +1819,40 @@ type ReplicationExtensionModelProperties struct { ProvisioningState *ProvisioningState } -type ReplicationExtensionModelSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). +// StorageContainerProperties - Storage container properties. +type StorageContainerProperties struct { + // REQUIRED; Gets or sets the ClusterSharedVolumePath. + ClusterSharedVolumePath *string + + // REQUIRED; Gets or sets the Name. + Name *string +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). CreatedAt *time.Time - // Gets or sets identity that created the resource. + // The identity that created the resource. CreatedBy *string - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string + // The type of identity that created the resource. + CreatedByType *CreatedByType - // Gets or sets the timestamp of resource last modification (UTC). + // The timestamp of resource last modification (UTC) LastModifiedAt *time.Time - // Gets or sets the identity that last modified the resource. + // The identity that last modified the resource. LastModifiedBy *string - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string -} - -// StorageContainerProperties - Storage container properties. -type StorageContainerProperties struct { - // REQUIRED; Gets or sets the ClusterSharedVolumePath. - ClusterSharedVolumePath *string - - // REQUIRED; Gets or sets the Name. - Name *string + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType } // TaskModel - Task model. type TaskModel struct { - // Gets or sets the list of children workflow models. - ChildrenWorkflows []*WorkflowModel + // Gets or sets the list of children job models. + ChildrenJobs []*JobModel // Task model custom properties. CustomProperties *TaskModelCustomProperties @@ -1630,68 +1876,77 @@ type TaskModelCustomProperties struct { InstanceType *string } -// TestFailoverCleanupWorkflowModelCustomProperties - Test failover cleanup workflow model custom properties. -type TestFailoverCleanupWorkflowModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. +// TestFailoverCleanupJobModelCustomProperties - Test failover cleanup job model custom properties. +type TestFailoverCleanupJobModelCustomProperties struct { + // REQUIRED; Discriminator property for JobModelCustomProperties. InstanceType *string // READ-ONLY; Gets or sets any custom properties of the affected object. - AffectedObjectDetails map[string]*string + AffectedObjectDetails *JobModelCustomPropertiesAffectedObjectDetails // READ-ONLY; Gets or sets the test failover cleanup comments. Comments *string } -// GetWorkflowModelCustomProperties implements the WorkflowModelCustomPropertiesClassification interface for type TestFailoverCleanupWorkflowModelCustomProperties. -func (t *TestFailoverCleanupWorkflowModelCustomProperties) GetWorkflowModelCustomProperties() *WorkflowModelCustomProperties { - return &WorkflowModelCustomProperties{ +// GetJobModelCustomProperties implements the JobModelCustomPropertiesClassification interface for type TestFailoverCleanupJobModelCustomProperties. +func (t *TestFailoverCleanupJobModelCustomProperties) GetJobModelCustomProperties() *JobModelCustomProperties { + return &JobModelCustomProperties{ AffectedObjectDetails: t.AffectedObjectDetails, InstanceType: t.InstanceType, } } -// TestFailoverWorkflowModelCustomProperties - Test failover workflow model custom properties. -type TestFailoverWorkflowModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. +// TestFailoverJobModelCustomProperties - Test failover job model custom properties. +type TestFailoverJobModelCustomProperties struct { + // REQUIRED; Discriminator property for JobModelCustomProperties. InstanceType *string // READ-ONLY; Gets or sets any custom properties of the affected object. - AffectedObjectDetails map[string]*string + AffectedObjectDetails *JobModelCustomPropertiesAffectedObjectDetails // READ-ONLY; Gets or sets the test VM details. ProtectedItemDetails []*FailoverProtectedItemProperties } -// GetWorkflowModelCustomProperties implements the WorkflowModelCustomPropertiesClassification interface for type TestFailoverWorkflowModelCustomProperties. -func (t *TestFailoverWorkflowModelCustomProperties) GetWorkflowModelCustomProperties() *WorkflowModelCustomProperties { - return &WorkflowModelCustomProperties{ +// GetJobModelCustomProperties implements the JobModelCustomPropertiesClassification interface for type TestFailoverJobModelCustomProperties. +func (t *TestFailoverJobModelCustomProperties) GetJobModelCustomProperties() *JobModelCustomProperties { + return &JobModelCustomProperties{ AffectedObjectDetails: t.AffectedObjectDetails, InstanceType: t.InstanceType, } } -// VMwareDraModelCustomProperties - VMware DRA model custom properties. -type VMwareDraModelCustomProperties struct { - // REQUIRED; Gets or sets the BIOS Id of the DRA machine. +// UserAssignedIdentity - User assigned identity properties +type UserAssignedIdentity struct { + // READ-ONLY; The client ID of the assigned identity. + ClientID *string + + // READ-ONLY; The principal ID of the assigned identity. + PrincipalID *string +} + +// VMwareFabricAgentModelCustomProperties - VMware fabric agent model custom properties. +type VMwareFabricAgentModelCustomProperties struct { + // REQUIRED; Gets or sets the BIOS Id of the fabric agent machine. BiosID *string - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for FabricAgentModelCustomProperties. InstanceType *string // REQUIRED; Identity model. MarsAuthenticationIdentity *IdentityModel } -// GetDraModelCustomProperties implements the DraModelCustomPropertiesClassification interface for type VMwareDraModelCustomProperties. -func (v *VMwareDraModelCustomProperties) GetDraModelCustomProperties() *DraModelCustomProperties { - return &DraModelCustomProperties{ +// GetFabricAgentModelCustomProperties implements the FabricAgentModelCustomPropertiesClassification interface for type VMwareFabricAgentModelCustomProperties. +func (v *VMwareFabricAgentModelCustomProperties) GetFabricAgentModelCustomProperties() *FabricAgentModelCustomProperties { + return &FabricAgentModelCustomProperties{ InstanceType: v.InstanceType, } } // VMwareMigrateFabricModelCustomProperties - VMware migrate fabric model custom properties. type VMwareMigrateFabricModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for FabricModelCustomProperties. InstanceType *string // REQUIRED; Gets or sets the ARM Id of the migration solution. @@ -1722,6 +1977,21 @@ type VMwareToAzStackHCIDiskInput struct { // REQUIRED; Gets or sets a value indicating whether disk is os disk. IsOsDisk *bool + // Gets or sets a value of disk block size. + DiskBlockSize *int64 + + // Disk controller. + DiskController *DiskControllerInputs + + // Gets or sets a value of disk identifier. + DiskIdentifier *string + + // Gets or sets a value of disk logical sector size. + DiskLogicalSectorSize *int64 + + // Gets or sets a value of disk physical sector size. + DiskPhysicalSectorSize *int64 + // Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard disk. IsDynamic *bool @@ -1729,6 +1999,36 @@ type VMwareToAzStackHCIDiskInput struct { StorageContainerID *string } +// VMwareToAzStackHCIEventModelCustomProperties - VMware to AzStackHCI event model custom properties. This class provides +// provider specific details for events of type DataContract.HealthEvents.HealthEventType.ProtectedItemHealth and +// DataContract.HealthEvents.HealthEventType.AgentHealth. +type VMwareToAzStackHCIEventModelCustomProperties struct { + // REQUIRED; Discriminator property for EventModelCustomProperties. + InstanceType *string + + // READ-ONLY; Gets or sets the friendly name of the source which has raised this health event. + EventSourceFriendlyName *string + + // READ-ONLY; Gets or sets the protected item friendly name. + ProtectedItemFriendlyName *string + + // READ-ONLY; Gets or sets the server type. + ServerType *string + + // READ-ONLY; Gets or sets the source appliance name. + SourceApplianceName *string + + // READ-ONLY; Gets or sets the source target name. + TargetApplianceName *string +} + +// GetEventModelCustomProperties implements the EventModelCustomPropertiesClassification interface for type VMwareToAzStackHCIEventModelCustomProperties. +func (v *VMwareToAzStackHCIEventModelCustomProperties) GetEventModelCustomProperties() *EventModelCustomProperties { + return &EventModelCustomProperties{ + InstanceType: v.InstanceType, + } +} + // VMwareToAzStackHCINicInput - VMwareToAzStackHCI NIC properties. type VMwareToAzStackHCINicInput struct { // REQUIRED; Gets or sets the NIC label. @@ -1740,10 +2040,16 @@ type VMwareToAzStackHCINicInput struct { // REQUIRED; Gets or sets the selection type of the NIC. SelectionTypeForFailover *VMNicSelection - // REQUIRED; Gets or sets the target network Id within AzStackHCI Cluster. + // Gets or sets a value indicating whether mac address migration is enabled. + IsMacMigrationEnabled *bool + + // Gets or sets a value indicating whether static ip migration is enabled. + IsStaticIPMigrationEnabled *bool + + // Gets or sets the target network Id within AzStackHCI Cluster. TargetNetworkID *string - // REQUIRED; Gets or sets the target test network Id within AzStackHCI Cluster. + // Gets or sets the target test network Id within AzStackHCI Cluster. TestNetworkID *string // READ-ONLY; Gets or sets the network name. @@ -1752,7 +2058,7 @@ type VMwareToAzStackHCINicInput struct { // VMwareToAzStackHCIPlannedFailoverModelCustomProperties - VMware to AzStackHCI planned failover model custom properties. type VMwareToAzStackHCIPlannedFailoverModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for PlannedFailoverModelCustomProperties. InstanceType *string // REQUIRED; Gets or sets a value indicating whether VM needs to be shut down. @@ -1775,7 +2081,7 @@ type VMwareToAzStackHCIPolicyModelCustomProperties struct { // REQUIRED; Gets or sets the crash consistent snapshot frequency (in minutes). CrashConsistentFrequencyInMinutes *int32 - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for PolicyModelCustomProperties. InstanceType *string // REQUIRED; Gets or sets the duration in minutes until which the recovery points need to be stored. @@ -1794,6 +2100,15 @@ type VMwareToAzStackHCIProtectedDiskProperties struct { // READ-ONLY; Gets or sets the disk capacity in bytes. CapacityInBytes *int64 + // READ-ONLY; Gets or sets a value of disk block size. + DiskBlockSize *int64 + + // READ-ONLY; Gets or sets a value of disk logical sector size. + DiskLogicalSectorSize *int64 + + // READ-ONLY; Gets or sets a value of disk physical sector size. + DiskPhysicalSectorSize *int64 + // READ-ONLY; Gets or sets the disk type. DiskType *string @@ -1839,7 +2154,7 @@ type VMwareToAzStackHCIProtectedItemModelCustomProperties struct { // REQUIRED; Gets or sets the hypervisor generation of the virtual machine possible values are 1,2. HyperVGeneration *string - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for ProtectedItemModelCustomProperties. InstanceType *string // REQUIRED; Gets or sets the list of VM NIC to replicate. @@ -1848,8 +2163,8 @@ type VMwareToAzStackHCIProtectedItemModelCustomProperties struct { // REQUIRED; Gets or sets the run as account Id. RunAsAccountID *string - // REQUIRED; Gets or sets the source DRA name. - SourceDraName *string + // REQUIRED; Gets or sets the source fabric agent name. + SourceFabricAgentName *string // REQUIRED; Gets or sets the target storage container ARM Id. StorageContainerID *string @@ -1857,8 +2172,8 @@ type VMwareToAzStackHCIProtectedItemModelCustomProperties struct { // REQUIRED; Gets or sets the Target Arc Cluster Custom Location ARM Id. TargetArcClusterCustomLocationID *string - // REQUIRED; Gets or sets the target DRA name. - TargetDraName *string + // REQUIRED; Gets or sets the target fabric agent name. + TargetFabricAgentName *string // REQUIRED; Gets or sets the Target HCI Cluster ARM Id. TargetHciClusterID *string @@ -1979,6 +2294,38 @@ func (v *VMwareToAzStackHCIProtectedItemModelCustomProperties) GetProtectedItemM } } +// VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate - VMware to AzStackHCI Protected item model custom properties. +type VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate struct { + // REQUIRED; Discriminator property for ProtectedItemModelCustomPropertiesUpdate. + InstanceType *string + + // Protected item dynamic memory config. + DynamicMemoryConfig *ProtectedItemDynamicMemoryConfig + + // Gets or sets a value indicating whether memory is dynamical. + IsDynamicRAM *bool + + // Gets or sets the list of VM NIC to replicate. + NicsToInclude []*VMwareToAzStackHCINicInput + + // Gets or sets the type of the OS. + OSType *string + + // Gets or sets the target CPU cores. + TargetCPUCores *int32 + + // Gets or sets the target memory in mega-bytes. + TargetMemoryInMegaBytes *int32 +} + +// GetProtectedItemModelCustomPropertiesUpdate implements the ProtectedItemModelCustomPropertiesUpdateClassification interface +// for type VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate. +func (v *VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate) GetProtectedItemModelCustomPropertiesUpdate() *ProtectedItemModelCustomPropertiesUpdate { + return &ProtectedItemModelCustomPropertiesUpdate{ + InstanceType: v.InstanceType, + } +} + // VMwareToAzStackHCIProtectedNicProperties - VMwareToAzStackHCI NIC properties. type VMwareToAzStackHCIProtectedNicProperties struct { // Gets or sets a value indicating whether this is the primary NIC. @@ -2006,12 +2353,29 @@ type VMwareToAzStackHCIProtectedNicProperties struct { TestNetworkID *string } +// VMwareToAzStackHCIRecoveryPointModelCustomProperties - VMware to AzStackHCI recovery point model custom properties. +type VMwareToAzStackHCIRecoveryPointModelCustomProperties struct { + // REQUIRED; Discriminator property for RecoveryPointModelCustomProperties. + InstanceType *string + + // READ-ONLY; Gets or sets the list of the disk Ids. + DiskIDs []*string +} + +// GetRecoveryPointModelCustomProperties implements the RecoveryPointModelCustomPropertiesClassification interface for type +// VMwareToAzStackHCIRecoveryPointModelCustomProperties. +func (v *VMwareToAzStackHCIRecoveryPointModelCustomProperties) GetRecoveryPointModelCustomProperties() *RecoveryPointModelCustomProperties { + return &RecoveryPointModelCustomProperties{ + InstanceType: v.InstanceType, + } +} + // VMwareToAzStackHCIReplicationExtensionModelCustomProperties - VMware to AzStackHCI Replication extension model custom properties. type VMwareToAzStackHCIReplicationExtensionModelCustomProperties struct { // REQUIRED; Gets or sets the ARM Id of the target AzStackHCI fabric. AzStackHciFabricArmID *string - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for ReplicationExtensionModelCustomProperties. InstanceType *string // REQUIRED; Gets or sets the ARM Id of the source VMware fabric. @@ -2068,37 +2432,54 @@ func (v *VMwareToAzStackHCIReplicationExtensionModelCustomProperties) GetReplica } } +// VaultIdentityModel - Vault model. +type VaultIdentityModel struct { + // REQUIRED; Gets or sets the identityType which can be either SystemAssigned or None. + Type *VaultIdentityType + + // READ-ONLY; Gets or sets the object ID of the service principal object for the managed identity that is used to grant role-based + // access to an Azure resource. + PrincipalID *string + + // READ-ONLY; Gets or sets a Globally Unique Identifier (GUID) that represents the Azure AD tenant where the resource is now + // a member. + TenantID *string +} + // VaultModel - Vault model. type VaultModel struct { - // REQUIRED; Gets or sets the location of the vault. + // REQUIRED; The geo-location where the resource lives Location *string - // Vault properties. + // The managed service identities assigned to this resource. + Identity *ManagedServiceIdentity + + // The resource-specific properties for this resource. Properties *VaultModelProperties - // Gets or sets the resource tags. + // Resource tags. Tags map[string]*string - // READ-ONLY; Gets or sets the Id of the resource. + // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" ID *string - // READ-ONLY; Gets or sets the name of the resource. + // READ-ONLY; The name of the resource Name *string - // READ-ONLY - SystemData *VaultModelSystemData + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; Gets or sets the type of the resource. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// VaultModelCollection - Vault model collection. -type VaultModelCollection struct { - // Gets or sets the value of next link. - NextLink *string - - // Gets or sets the list of vaults. +// VaultModelListResult - The response of a VaultModel list operation. +type VaultModelListResult struct { + // REQUIRED; The VaultModel items on this page Value []*VaultModel + + // The link to the next page of items + NextLink *string } // VaultModelProperties - Vault properties. @@ -2113,28 +2494,11 @@ type VaultModelProperties struct { ServiceResourceID *string } -type VaultModelSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time - - // Gets or sets identity that created the resource. - CreatedBy *string - - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string - - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time - - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string - - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string -} - -// VaultModelUpdate - Vault model for update. +// VaultModelUpdate - Vault model update. type VaultModelUpdate struct { + // Vault identity. + Identity *VaultIdentityModel + // Vault properties. Properties *VaultModelProperties @@ -2147,144 +2511,9 @@ type VaultModelUpdate struct { // READ-ONLY; Gets or sets the name of the resource. Name *string - // READ-ONLY - SystemData *VaultModelUpdateSystemData - - // READ-ONLY; Gets or sets the type of the resource. - Type *string -} - -type VaultModelUpdateSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time - - // Gets or sets identity that created the resource. - CreatedBy *string - - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string - - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time - - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string - - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string -} - -// WorkflowModel - Workflow model. -type WorkflowModel struct { - // REQUIRED; Workflow model properties. - Properties *WorkflowModelProperties - - // READ-ONLY; Gets or sets the Id of the resource. - ID *string - - // READ-ONLY; Gets or sets the name of the resource. - Name *string - - // READ-ONLY - SystemData *WorkflowModelSystemData + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData // READ-ONLY; Gets or sets the type of the resource. Type *string } - -// WorkflowModelCollection - Workflow model collection. -type WorkflowModelCollection struct { - // Gets or sets the value of next link. - NextLink *string - - // Gets or sets the list of workflows. - Value []*WorkflowModel -} - -// WorkflowModelCustomProperties - Workflow model custom properties. -type WorkflowModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. - InstanceType *string - - // READ-ONLY; Gets or sets any custom properties of the affected object. - AffectedObjectDetails map[string]*string -} - -// GetWorkflowModelCustomProperties implements the WorkflowModelCustomPropertiesClassification interface for type WorkflowModelCustomProperties. -func (w *WorkflowModelCustomProperties) GetWorkflowModelCustomProperties() *WorkflowModelCustomProperties { - return w -} - -// WorkflowModelProperties - Workflow model properties. -type WorkflowModelProperties struct { - // REQUIRED; Workflow model custom properties. - CustomProperties WorkflowModelCustomPropertiesClassification - - // READ-ONLY; Gets or sets the workflow activity id. - ActivityID *string - - // READ-ONLY; Gets or sets the list of allowed actions on the workflow. - AllowedActions []*string - - // READ-ONLY; Gets or sets the friendly display name. - DisplayName *string - - // READ-ONLY; Gets or sets the end time. - EndTime *time.Time - - // READ-ONLY; Gets or sets the list of errors. - Errors []*ErrorModel - - // READ-ONLY; Gets or sets the affected object Id. - ObjectID *string - - // READ-ONLY; Gets or sets the affected object internal Id. - ObjectInternalID *string - - // READ-ONLY; Gets or sets the affected object internal name. - ObjectInternalName *string - - // READ-ONLY; Gets or sets the affected object name. - ObjectName *string - - // READ-ONLY; Gets or sets the object type. - ObjectType *WorkflowObjectType - - // READ-ONLY; Gets or sets the replication provider. - ReplicationProviderID *string - - // READ-ONLY; Gets or sets the source fabric provider. - SourceFabricProviderID *string - - // READ-ONLY; Gets or sets the start time. - StartTime *time.Time - - // READ-ONLY; Gets or sets the workflow state. - State *WorkflowState - - // READ-ONLY; Gets or sets the target fabric provider. - TargetFabricProviderID *string - - // READ-ONLY; Gets or sets the list of tasks. - Tasks []*TaskModel -} - -type WorkflowModelSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time - - // Gets or sets identity that created the resource. - CreatedBy *string - - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string - - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time - - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string - - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/models_serde.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/models_serde.go index e3fabf49a712..18654db62d9e 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/models_serde.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/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. @@ -175,45 +172,58 @@ func (c *CheckNameAvailabilityResponseModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DeploymentPreflightModel. -func (d DeploymentPreflightModel) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ConnectionDetails. +func (c ConnectionDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "resources", d.Resources) + populate(objectMap, "groupId", c.GroupID) + populate(objectMap, "id", c.ID) + populate(objectMap, "linkIdentifier", c.LinkIdentifier) + populate(objectMap, "memberName", c.MemberName) + populate(objectMap, "privateIpAddress", c.PrivateIPAddress) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentPreflightModel. -func (d *DeploymentPreflightModel) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionDetails. +func (c *ConnectionDetails) 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", d, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "resources": - err = unpopulate(val, "Resources", &d.Resources) + case "groupId": + err = unpopulate(val, "GroupID", &c.GroupID) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "linkIdentifier": + err = unpopulate(val, "LinkIdentifier", &c.LinkIdentifier) + delete(rawMsg, key) + case "memberName": + err = unpopulate(val, "MemberName", &c.MemberName) + delete(rawMsg, key) + case "privateIpAddress": + err = unpopulate(val, "PrivateIPAddress", &c.PrivateIPAddress) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DeploymentPreflightResource. -func (d DeploymentPreflightResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeploymentPreflightModel. +func (d DeploymentPreflightModel) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "apiVersion", d.APIVersion) - populate(objectMap, "location", d.Location) - populate(objectMap, "name", d.Name) - populate(objectMap, "type", d.Type) + populate(objectMap, "resources", d.Resources) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentPreflightResource. -func (d *DeploymentPreflightResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentPreflightModel. +func (d *DeploymentPreflightModel) 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", d, err) @@ -221,17 +231,8 @@ func (d *DeploymentPreflightResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "apiVersion": - err = unpopulate(val, "APIVersion", &d.APIVersion) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &d.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) + case "resources": + err = unpopulate(val, "Resources", &d.Resources) delete(rawMsg, key) } if err != nil { @@ -241,19 +242,19 @@ func (d *DeploymentPreflightResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DraModel. -func (d DraModel) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeploymentPreflightResource. +func (d DeploymentPreflightResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", d.ID) + populate(objectMap, "apiVersion", d.APIVersion) + populate(objectMap, "location", d.Location) populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "systemData", d.SystemData) + populateAny(objectMap, "properties", d.Properties) populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DraModel. -func (d *DraModel) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentPreflightResource. +func (d *DeploymentPreflightResource) 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", d, err) @@ -261,8 +262,11 @@ func (d *DraModel) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &d.ID) + case "apiVersion": + err = unpopulate(val, "APIVersion", &d.APIVersion) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &d.Name) @@ -270,9 +274,6 @@ func (d *DraModel) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &d.SystemData) - delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) @@ -284,145 +285,17 @@ func (d *DraModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DraModelCollection. -func (d DraModelCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DraModelCollection. -func (d *DraModelCollection) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &d.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &d.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DraModelCustomProperties. -func (d DraModelCustomProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["instanceType"] = d.InstanceType - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DraModelCustomProperties. -func (d *DraModelCustomProperties) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "instanceType": - err = unpopulate(val, "InstanceType", &d.InstanceType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DraModelProperties. -func (d DraModelProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "authenticationIdentity", d.AuthenticationIdentity) - populate(objectMap, "correlationId", d.CorrelationID) - populate(objectMap, "customProperties", d.CustomProperties) - populate(objectMap, "healthErrors", d.HealthErrors) - populate(objectMap, "isResponsive", d.IsResponsive) - populateDateTimeRFC3339(objectMap, "lastHeartbeat", d.LastHeartbeat) - populate(objectMap, "machineId", d.MachineID) - populate(objectMap, "machineName", d.MachineName) - populate(objectMap, "provisioningState", d.ProvisioningState) - populate(objectMap, "resourceAccessIdentity", d.ResourceAccessIdentity) - populate(objectMap, "versionNumber", d.VersionNumber) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DraModelProperties. -func (d *DraModelProperties) 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", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "authenticationIdentity": - err = unpopulate(val, "AuthenticationIdentity", &d.AuthenticationIdentity) - delete(rawMsg, key) - case "correlationId": - err = unpopulate(val, "CorrelationID", &d.CorrelationID) - delete(rawMsg, key) - case "customProperties": - d.CustomProperties, err = unmarshalDraModelCustomPropertiesClassification(val) - delete(rawMsg, key) - case "healthErrors": - err = unpopulate(val, "HealthErrors", &d.HealthErrors) - delete(rawMsg, key) - case "isResponsive": - err = unpopulate(val, "IsResponsive", &d.IsResponsive) - delete(rawMsg, key) - case "lastHeartbeat": - err = unpopulateDateTimeRFC3339(val, "LastHeartbeat", &d.LastHeartbeat) - delete(rawMsg, key) - case "machineId": - err = unpopulate(val, "MachineID", &d.MachineID) - delete(rawMsg, key) - case "machineName": - err = unpopulate(val, "MachineName", &d.MachineName) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) - delete(rawMsg, key) - case "resourceAccessIdentity": - err = unpopulate(val, "ResourceAccessIdentity", &d.ResourceAccessIdentity) - delete(rawMsg, key) - case "versionNumber": - err = unpopulate(val, "VersionNumber", &d.VersionNumber) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DraModelSystemData. -func (d DraModelSystemData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DiskControllerInputs. +func (d DiskControllerInputs) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", d.CreatedAt) - populate(objectMap, "createdBy", d.CreatedBy) - populate(objectMap, "createdByType", d.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", d.LastModifiedAt) - populate(objectMap, "lastModifiedBy", d.LastModifiedBy) - populate(objectMap, "lastModifiedByType", d.LastModifiedByType) + populate(objectMap, "controllerId", d.ControllerID) + populate(objectMap, "controllerLocation", d.ControllerLocation) + populate(objectMap, "controllerName", d.ControllerName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DraModelSystemData. -func (d *DraModelSystemData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskControllerInputs. +func (d *DiskControllerInputs) 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", d, err) @@ -430,23 +303,14 @@ func (d *DraModelSystemData) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &d.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &d.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &d.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &d.LastModifiedAt) + case "controllerId": + err = unpopulate(val, "ControllerID", &d.ControllerID) delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &d.LastModifiedBy) + case "controllerLocation": + err = unpopulate(val, "ControllerLocation", &d.ControllerLocation) delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &d.LastModifiedByType) + case "controllerName": + err = unpopulate(val, "ControllerName", &d.ControllerName) delete(rawMsg, key) } if err != nil { @@ -499,16 +363,16 @@ func (e *EmailConfigurationModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type EmailConfigurationModelCollection. -func (e EmailConfigurationModelCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EmailConfigurationModelListResult. +func (e EmailConfigurationModelListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", e.NextLink) populate(objectMap, "value", e.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EmailConfigurationModelCollection. -func (e *EmailConfigurationModelCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EmailConfigurationModelListResult. +func (e *EmailConfigurationModelListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) @@ -535,6 +399,7 @@ func (e EmailConfigurationModelProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "customEmailAddresses", e.CustomEmailAddresses) populate(objectMap, "locale", e.Locale) + populate(objectMap, "provisioningState", e.ProvisioningState) populate(objectMap, "sendToOwners", e.SendToOwners) return json.Marshal(objectMap) } @@ -554,6 +419,9 @@ func (e *EmailConfigurationModelProperties) UnmarshalJSON(data []byte) error { case "locale": err = unpopulate(val, "Locale", &e.Locale) delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) case "sendToOwners": err = unpopulate(val, "SendToOwners", &e.SendToOwners) delete(rawMsg, key) @@ -565,53 +433,6 @@ func (e *EmailConfigurationModelProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type EmailConfigurationModelSystemData. -func (e EmailConfigurationModelSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", e.CreatedAt) - populate(objectMap, "createdBy", e.CreatedBy) - populate(objectMap, "createdByType", e.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", e.LastModifiedAt) - populate(objectMap, "lastModifiedBy", e.LastModifiedBy) - populate(objectMap, "lastModifiedByType", e.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EmailConfigurationModelSystemData. -func (e *EmailConfigurationModelSystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &e.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &e.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &e.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &e.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &e.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &e.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type ErrorModel. func (e ErrorModel) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -706,16 +527,15 @@ func (e *EventModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type EventModelCollection. -func (e EventModelCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventModelCustomProperties. +func (e EventModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", e.NextLink) - populate(objectMap, "value", e.Value) + objectMap["instanceType"] = e.InstanceType return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EventModelCollection. -func (e *EventModelCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventModelCustomProperties. +func (e *EventModelCustomProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) @@ -723,11 +543,8 @@ func (e *EventModelCollection) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &e.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &e.Value) + case "instanceType": + err = unpopulate(val, "InstanceType", &e.InstanceType) delete(rawMsg, key) } if err != nil { @@ -737,15 +554,16 @@ func (e *EventModelCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type EventModelCustomProperties. -func (e EventModelCustomProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventModelListResult. +func (e EventModelListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["instanceType"] = e.InstanceType + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EventModelCustomProperties. -func (e *EventModelCustomProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventModelListResult. +func (e *EventModelListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) @@ -753,8 +571,11 @@ func (e *EventModelCustomProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "instanceType": - err = unpopulate(val, "InstanceType", &e.InstanceType) + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) delete(rawMsg, key) } if err != nil { @@ -773,6 +594,7 @@ func (e EventModelProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "eventName", e.EventName) populate(objectMap, "eventType", e.EventType) populate(objectMap, "healthErrors", e.HealthErrors) + populate(objectMap, "provisioningState", e.ProvisioningState) populate(objectMap, "resourceName", e.ResourceName) populate(objectMap, "resourceType", e.ResourceType) populate(objectMap, "severity", e.Severity) @@ -807,6 +629,9 @@ func (e *EventModelProperties) UnmarshalJSON(data []byte) error { case "healthErrors": err = unpopulate(val, "HealthErrors", &e.HealthErrors) delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) case "resourceName": err = unpopulate(val, "ResourceName", &e.ResourceName) delete(rawMsg, key) @@ -827,68 +652,58 @@ func (e *EventModelProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type EventModelSystemData. -func (e EventModelSystemData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type FabricAgentModel. +func (f FabricAgentModel) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", e.CreatedAt) - populate(objectMap, "createdBy", e.CreatedBy) - populate(objectMap, "createdByType", e.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", e.LastModifiedAt) - populate(objectMap, "lastModifiedBy", e.LastModifiedBy) - populate(objectMap, "lastModifiedByType", e.LastModifiedByType) + populate(objectMap, "id", f.ID) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "type", f.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EventModelSystemData. -func (e *EventModelSystemData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type FabricAgentModel. +func (f *FabricAgentModel) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", f, err) } for key, val := range rawMsg { var err error switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &e.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &e.CreatedBy) + case "id": + err = unpopulate(val, "ID", &f.ID) delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &e.CreatedByType) + case "name": + err = unpopulate(val, "Name", &f.Name) delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &e.LastModifiedAt) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &e.LastModifiedBy) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &e.LastModifiedByType) + case "type": + err = unpopulate(val, "Type", &f.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", f, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type FabricModel. -func (f FabricModel) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type FabricAgentModelCustomProperties. +func (f FabricAgentModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", f.ID) - populate(objectMap, "location", f.Location) - populate(objectMap, "name", f.Name) - populate(objectMap, "properties", f.Properties) - populate(objectMap, "systemData", f.SystemData) - populate(objectMap, "tags", f.Tags) - populate(objectMap, "type", f.Type) + objectMap["instanceType"] = f.InstanceType return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type FabricModel. -func (f *FabricModel) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type FabricAgentModelCustomProperties. +func (f *FabricAgentModelCustomProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", f, err) @@ -896,8 +711,139 @@ func (f *FabricModel) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &f.ID) + case "instanceType": + err = unpopulate(val, "InstanceType", &f.InstanceType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FabricAgentModelListResult. +func (f FabricAgentModelListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FabricAgentModelListResult. +func (f *FabricAgentModelListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FabricAgentModelProperties. +func (f FabricAgentModelProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "authenticationIdentity", f.AuthenticationIdentity) + populate(objectMap, "correlationId", f.CorrelationID) + populate(objectMap, "customProperties", f.CustomProperties) + populate(objectMap, "healthErrors", f.HealthErrors) + populate(objectMap, "isResponsive", f.IsResponsive) + populateDateTimeRFC3339(objectMap, "lastHeartbeat", f.LastHeartbeat) + populate(objectMap, "machineId", f.MachineID) + populate(objectMap, "machineName", f.MachineName) + populate(objectMap, "provisioningState", f.ProvisioningState) + populate(objectMap, "resourceAccessIdentity", f.ResourceAccessIdentity) + populate(objectMap, "versionNumber", f.VersionNumber) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FabricAgentModelProperties. +func (f *FabricAgentModelProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authenticationIdentity": + err = unpopulate(val, "AuthenticationIdentity", &f.AuthenticationIdentity) + delete(rawMsg, key) + case "correlationId": + err = unpopulate(val, "CorrelationID", &f.CorrelationID) + delete(rawMsg, key) + case "customProperties": + f.CustomProperties, err = unmarshalFabricAgentModelCustomPropertiesClassification(val) + delete(rawMsg, key) + case "healthErrors": + err = unpopulate(val, "HealthErrors", &f.HealthErrors) + delete(rawMsg, key) + case "isResponsive": + err = unpopulate(val, "IsResponsive", &f.IsResponsive) + delete(rawMsg, key) + case "lastHeartbeat": + err = unpopulateDateTimeRFC3339(val, "LastHeartbeat", &f.LastHeartbeat) + delete(rawMsg, key) + case "machineId": + err = unpopulate(val, "MachineID", &f.MachineID) + delete(rawMsg, key) + case "machineName": + err = unpopulate(val, "MachineName", &f.MachineName) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &f.ProvisioningState) + delete(rawMsg, key) + case "resourceAccessIdentity": + err = unpopulate(val, "ResourceAccessIdentity", &f.ResourceAccessIdentity) + delete(rawMsg, key) + case "versionNumber": + err = unpopulate(val, "VersionNumber", &f.VersionNumber) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FabricModel. +func (f FabricModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", f.ID) + populate(objectMap, "location", f.Location) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "tags", f.Tags) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FabricModel. +func (f *FabricModel) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &f.ID) delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &f.Location) @@ -925,16 +871,15 @@ func (f *FabricModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type FabricModelCollection. -func (f FabricModelCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type FabricModelCustomProperties. +func (f FabricModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", f.NextLink) - populate(objectMap, "value", f.Value) + objectMap["instanceType"] = f.InstanceType return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type FabricModelCollection. -func (f *FabricModelCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type FabricModelCustomProperties. +func (f *FabricModelCustomProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", f, err) @@ -942,11 +887,8 @@ func (f *FabricModelCollection) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &f.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &f.Value) + case "instanceType": + err = unpopulate(val, "InstanceType", &f.InstanceType) delete(rawMsg, key) } if err != nil { @@ -956,15 +898,16 @@ func (f *FabricModelCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type FabricModelCustomProperties. -func (f FabricModelCustomProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type FabricModelListResult. +func (f FabricModelListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["instanceType"] = f.InstanceType + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type FabricModelCustomProperties. -func (f *FabricModelCustomProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type FabricModelListResult. +func (f *FabricModelListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", f, err) @@ -972,8 +915,11 @@ func (f *FabricModelCustomProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "instanceType": - err = unpopulate(val, "InstanceType", &f.InstanceType) + case "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) delete(rawMsg, key) } if err != nil { @@ -1030,53 +976,6 @@ func (f *FabricModelProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type FabricModelSystemData. -func (f FabricModelSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", f.CreatedAt) - populate(objectMap, "createdBy", f.CreatedBy) - populate(objectMap, "createdByType", f.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", f.LastModifiedAt) - populate(objectMap, "lastModifiedBy", f.LastModifiedBy) - populate(objectMap, "lastModifiedByType", f.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FabricModelSystemData. -func (f *FabricModelSystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &f.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &f.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &f.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &f.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &f.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &f.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type FabricModelUpdate. func (f FabricModelUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1124,20 +1023,17 @@ func (f *FabricModelUpdate) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type FabricModelUpdateSystemData. -func (f FabricModelUpdateSystemData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type FailoverJobModelCustomProperties. +func (f FailoverJobModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", f.CreatedAt) - populate(objectMap, "createdBy", f.CreatedBy) - populate(objectMap, "createdByType", f.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", f.LastModifiedAt) - populate(objectMap, "lastModifiedBy", f.LastModifiedBy) - populate(objectMap, "lastModifiedByType", f.LastModifiedByType) + populate(objectMap, "affectedObjectDetails", f.AffectedObjectDetails) + objectMap["instanceType"] = "FailoverJobDetails" + populate(objectMap, "protectedItemDetails", f.ProtectedItemDetails) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type FabricModelUpdateSystemData. -func (f *FabricModelUpdateSystemData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type FailoverJobModelCustomProperties. +func (f *FailoverJobModelCustomProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", f, err) @@ -1145,23 +1041,14 @@ func (f *FabricModelUpdateSystemData) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &f.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &f.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &f.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &f.LastModifiedAt) + case "affectedObjectDetails": + err = unpopulate(val, "AffectedObjectDetails", &f.AffectedObjectDetails) delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &f.LastModifiedBy) + case "instanceType": + err = unpopulate(val, "InstanceType", &f.InstanceType) delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &f.LastModifiedByType) + case "protectedItemDetails": + err = unpopulate(val, "ProtectedItemDetails", &f.ProtectedItemDetails) delete(rawMsg, key) } if err != nil { @@ -1222,36 +1109,48 @@ func (f *FailoverProtectedItemProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type FailoverWorkflowModelCustomProperties. -func (f FailoverWorkflowModelCustomProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GroupConnectivityInformation. +func (g GroupConnectivityInformation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "affectedObjectDetails", f.AffectedObjectDetails) - objectMap["instanceType"] = "FailoverWorkflowDetails" - populate(objectMap, "protectedItemDetails", f.ProtectedItemDetails) + populate(objectMap, "customerVisibleFqdns", g.CustomerVisibleFqdns) + populate(objectMap, "groupId", g.GroupID) + populate(objectMap, "internalFqdn", g.InternalFqdn) + populate(objectMap, "memberName", g.MemberName) + populate(objectMap, "privateLinkServiceArmRegion", g.PrivateLinkServiceArmRegion) + populate(objectMap, "redirectMapId", g.RedirectMapID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type FailoverWorkflowModelCustomProperties. -func (f *FailoverWorkflowModelCustomProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupConnectivityInformation. +func (g *GroupConnectivityInformation) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "affectedObjectDetails": - err = unpopulate(val, "AffectedObjectDetails", &f.AffectedObjectDetails) + case "customerVisibleFqdns": + err = unpopulate(val, "CustomerVisibleFqdns", &g.CustomerVisibleFqdns) delete(rawMsg, key) - case "instanceType": - err = unpopulate(val, "InstanceType", &f.InstanceType) + case "groupId": + err = unpopulate(val, "GroupID", &g.GroupID) delete(rawMsg, key) - case "protectedItemDetails": - err = unpopulate(val, "ProtectedItemDetails", &f.ProtectedItemDetails) + case "internalFqdn": + err = unpopulate(val, "InternalFqdn", &g.InternalFqdn) + delete(rawMsg, key) + case "memberName": + err = unpopulate(val, "MemberName", &g.MemberName) + delete(rawMsg, key) + case "privateLinkServiceArmRegion": + err = unpopulate(val, "PrivateLinkServiceArmRegion", &g.PrivateLinkServiceArmRegion) + delete(rawMsg, key) + case "redirectMapId": + err = unpopulate(val, "RedirectMapID", &g.RedirectMapID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil @@ -1386,8 +1285,13 @@ func (h *HyperVMigrateFabricModelCustomProperties) UnmarshalJSON(data []byte) er // MarshalJSON implements the json.Marshaller interface for type HyperVToAzStackHCIDiskInput. func (h HyperVToAzStackHCIDiskInput) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "diskBlockSize", h.DiskBlockSize) + populate(objectMap, "diskController", h.DiskController) populate(objectMap, "diskFileFormat", h.DiskFileFormat) populate(objectMap, "diskId", h.DiskID) + populate(objectMap, "diskIdentifier", h.DiskIdentifier) + populate(objectMap, "diskLogicalSectorSize", h.DiskLogicalSectorSize) + populate(objectMap, "diskPhysicalSectorSize", h.DiskPhysicalSectorSize) populate(objectMap, "diskSizeGB", h.DiskSizeGB) populate(objectMap, "isDynamic", h.IsDynamic) populate(objectMap, "isOsDisk", h.IsOsDisk) @@ -1404,12 +1308,27 @@ func (h *HyperVToAzStackHCIDiskInput) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "diskBlockSize": + err = unpopulate(val, "DiskBlockSize", &h.DiskBlockSize) + delete(rawMsg, key) + case "diskController": + err = unpopulate(val, "DiskController", &h.DiskController) + delete(rawMsg, key) case "diskFileFormat": err = unpopulate(val, "DiskFileFormat", &h.DiskFileFormat) delete(rawMsg, key) case "diskId": err = unpopulate(val, "DiskID", &h.DiskID) delete(rawMsg, key) + case "diskIdentifier": + err = unpopulate(val, "DiskIdentifier", &h.DiskIdentifier) + delete(rawMsg, key) + case "diskLogicalSectorSize": + err = unpopulate(val, "DiskLogicalSectorSize", &h.DiskLogicalSectorSize) + delete(rawMsg, key) + case "diskPhysicalSectorSize": + err = unpopulate(val, "DiskPhysicalSectorSize", &h.DiskPhysicalSectorSize) + delete(rawMsg, key) case "diskSizeGB": err = unpopulate(val, "DiskSizeGB", &h.DiskSizeGB) delete(rawMsg, key) @@ -1480,6 +1399,8 @@ func (h *HyperVToAzStackHCIEventModelCustomProperties) UnmarshalJSON(data []byte // MarshalJSON implements the json.Marshaller interface for type HyperVToAzStackHCINicInput. func (h HyperVToAzStackHCINicInput) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "isMacMigrationEnabled", h.IsMacMigrationEnabled) + populate(objectMap, "isStaticIpMigrationEnabled", h.IsStaticIPMigrationEnabled) populate(objectMap, "networkName", h.NetworkName) populate(objectMap, "nicId", h.NicID) populate(objectMap, "selectionTypeForFailover", h.SelectionTypeForFailover) @@ -1497,6 +1418,12 @@ func (h *HyperVToAzStackHCINicInput) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "isMacMigrationEnabled": + err = unpopulate(val, "IsMacMigrationEnabled", &h.IsMacMigrationEnabled) + delete(rawMsg, key) + case "isStaticIpMigrationEnabled": + err = unpopulate(val, "IsStaticIPMigrationEnabled", &h.IsStaticIPMigrationEnabled) + delete(rawMsg, key) case "networkName": err = unpopulate(val, "NetworkName", &h.NetworkName) delete(rawMsg, key) @@ -1594,6 +1521,9 @@ func (h *HyperVToAzStackHCIPolicyModelCustomProperties) UnmarshalJSON(data []byt func (h HyperVToAzStackHCIProtectedDiskProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "capacityInBytes", h.CapacityInBytes) + populate(objectMap, "diskBlockSize", h.DiskBlockSize) + populate(objectMap, "diskLogicalSectorSize", h.DiskLogicalSectorSize) + populate(objectMap, "diskPhysicalSectorSize", h.DiskPhysicalSectorSize) populate(objectMap, "diskType", h.DiskType) populate(objectMap, "isDynamic", h.IsDynamic) populate(objectMap, "isOsDisk", h.IsOsDisk) @@ -1619,6 +1549,15 @@ func (h *HyperVToAzStackHCIProtectedDiskProperties) UnmarshalJSON(data []byte) e case "capacityInBytes": err = unpopulate(val, "CapacityInBytes", &h.CapacityInBytes) delete(rawMsg, key) + case "diskBlockSize": + err = unpopulate(val, "DiskBlockSize", &h.DiskBlockSize) + delete(rawMsg, key) + case "diskLogicalSectorSize": + err = unpopulate(val, "DiskLogicalSectorSize", &h.DiskLogicalSectorSize) + delete(rawMsg, key) + case "diskPhysicalSectorSize": + err = unpopulate(val, "DiskPhysicalSectorSize", &h.DiskPhysicalSectorSize) + delete(rawMsg, key) case "diskType": err = unpopulate(val, "DiskType", &h.DiskType) delete(rawMsg, key) @@ -1683,7 +1622,7 @@ func (h HyperVToAzStackHCIProtectedItemModelCustomProperties) MarshalJSON() ([]b populate(objectMap, "runAsAccountId", h.RunAsAccountID) populate(objectMap, "sourceApplianceName", h.SourceApplianceName) populate(objectMap, "sourceCpuCores", h.SourceCPUCores) - populate(objectMap, "sourceDraName", h.SourceDraName) + populate(objectMap, "sourceFabricAgentName", h.SourceFabricAgentName) populate(objectMap, "sourceMemoryInMegaBytes", h.SourceMemoryInMegaBytes) populate(objectMap, "sourceVmName", h.SourceVMName) populate(objectMap, "storageContainerId", h.StorageContainerID) @@ -1691,7 +1630,7 @@ func (h HyperVToAzStackHCIProtectedItemModelCustomProperties) MarshalJSON() ([]b populate(objectMap, "targetArcClusterCustomLocationId", h.TargetArcClusterCustomLocationID) populate(objectMap, "targetAzStackHciClusterName", h.TargetAzStackHciClusterName) populate(objectMap, "targetCpuCores", h.TargetCPUCores) - populate(objectMap, "targetDraName", h.TargetDraName) + populate(objectMap, "targetFabricAgentName", h.TargetFabricAgentName) populate(objectMap, "targetHciClusterId", h.TargetHciClusterID) populate(objectMap, "targetLocation", h.TargetLocation) populate(objectMap, "targetMemoryInMegaBytes", h.TargetMemoryInMegaBytes) @@ -1781,8 +1720,8 @@ func (h *HyperVToAzStackHCIProtectedItemModelCustomProperties) UnmarshalJSON(dat case "sourceCpuCores": err = unpopulate(val, "SourceCPUCores", &h.SourceCPUCores) delete(rawMsg, key) - case "sourceDraName": - err = unpopulate(val, "SourceDraName", &h.SourceDraName) + case "sourceFabricAgentName": + err = unpopulate(val, "SourceFabricAgentName", &h.SourceFabricAgentName) delete(rawMsg, key) case "sourceMemoryInMegaBytes": err = unpopulate(val, "SourceMemoryInMegaBytes", &h.SourceMemoryInMegaBytes) @@ -1805,8 +1744,8 @@ func (h *HyperVToAzStackHCIProtectedItemModelCustomProperties) UnmarshalJSON(dat case "targetCpuCores": err = unpopulate(val, "TargetCPUCores", &h.TargetCPUCores) delete(rawMsg, key) - case "targetDraName": - err = unpopulate(val, "TargetDraName", &h.TargetDraName) + case "targetFabricAgentName": + err = unpopulate(val, "TargetFabricAgentName", &h.TargetFabricAgentName) delete(rawMsg, key) case "targetHciClusterId": err = unpopulate(val, "TargetHciClusterID", &h.TargetHciClusterID) @@ -1840,6 +1779,57 @@ func (h *HyperVToAzStackHCIProtectedItemModelCustomProperties) UnmarshalJSON(dat return nil } +// MarshalJSON implements the json.Marshaller interface for type HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate. +func (h HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dynamicMemoryConfig", h.DynamicMemoryConfig) + objectMap["instanceType"] = "HyperVToAzStackHCI" + populate(objectMap, "isDynamicRam", h.IsDynamicRAM) + populate(objectMap, "nicsToInclude", h.NicsToInclude) + populate(objectMap, "osType", h.OSType) + populate(objectMap, "targetCpuCores", h.TargetCPUCores) + populate(objectMap, "targetMemoryInMegaBytes", h.TargetMemoryInMegaBytes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate. +func (h *HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate) 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", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dynamicMemoryConfig": + err = unpopulate(val, "DynamicMemoryConfig", &h.DynamicMemoryConfig) + delete(rawMsg, key) + case "instanceType": + err = unpopulate(val, "InstanceType", &h.InstanceType) + delete(rawMsg, key) + case "isDynamicRam": + err = unpopulate(val, "IsDynamicRAM", &h.IsDynamicRAM) + delete(rawMsg, key) + case "nicsToInclude": + err = unpopulate(val, "NicsToInclude", &h.NicsToInclude) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &h.OSType) + delete(rawMsg, key) + case "targetCpuCores": + err = unpopulate(val, "TargetCPUCores", &h.TargetCPUCores) + delete(rawMsg, key) + case "targetMemoryInMegaBytes": + err = unpopulate(val, "TargetMemoryInMegaBytes", &h.TargetMemoryInMegaBytes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type HyperVToAzStackHCIProtectedNicProperties. func (h HyperVToAzStackHCIProtectedNicProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2119,11 +2109,281 @@ func (i *InnerHealthErrorModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Operation. -func (o Operation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type JobModel. +func (j JobModel) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "actionType", o.ActionType) - populate(objectMap, "display", o.Display) + populate(objectMap, "id", j.ID) + populate(objectMap, "name", j.Name) + populate(objectMap, "properties", j.Properties) + populate(objectMap, "systemData", j.SystemData) + populate(objectMap, "type", j.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobModel. +func (j *JobModel) 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", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &j.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &j.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &j.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &j.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &j.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JobModelCustomProperties. +func (j JobModelCustomProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "affectedObjectDetails", j.AffectedObjectDetails) + objectMap["instanceType"] = j.InstanceType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobModelCustomProperties. +func (j *JobModelCustomProperties) 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", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "affectedObjectDetails": + err = unpopulate(val, "AffectedObjectDetails", &j.AffectedObjectDetails) + delete(rawMsg, key) + case "instanceType": + err = unpopulate(val, "InstanceType", &j.InstanceType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JobModelCustomPropertiesAffectedObjectDetails. +func (j JobModelCustomPropertiesAffectedObjectDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", j.Description) + objectMap["type"] = "object" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobModelCustomPropertiesAffectedObjectDetails. +func (j *JobModelCustomPropertiesAffectedObjectDetails) 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", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &j.Description) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &j.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JobModelListResult. +func (j JobModelListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", j.NextLink) + populate(objectMap, "value", j.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobModelListResult. +func (j *JobModelListResult) 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", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &j.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &j.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JobModelProperties. +func (j JobModelProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "activityId", j.ActivityID) + populate(objectMap, "allowedActions", j.AllowedActions) + populate(objectMap, "customProperties", j.CustomProperties) + populate(objectMap, "displayName", j.DisplayName) + populateDateTimeRFC3339(objectMap, "endTime", j.EndTime) + populate(objectMap, "errors", j.Errors) + populate(objectMap, "objectId", j.ObjectID) + populate(objectMap, "objectInternalId", j.ObjectInternalID) + populate(objectMap, "objectInternalName", j.ObjectInternalName) + populate(objectMap, "objectName", j.ObjectName) + populate(objectMap, "objectType", j.ObjectType) + populate(objectMap, "provisioningState", j.ProvisioningState) + populate(objectMap, "replicationProviderId", j.ReplicationProviderID) + populate(objectMap, "sourceFabricProviderId", j.SourceFabricProviderID) + populateDateTimeRFC3339(objectMap, "startTime", j.StartTime) + populate(objectMap, "state", j.State) + populate(objectMap, "targetFabricProviderId", j.TargetFabricProviderID) + populate(objectMap, "tasks", j.Tasks) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobModelProperties. +func (j *JobModelProperties) 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", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "activityId": + err = unpopulate(val, "ActivityID", &j.ActivityID) + delete(rawMsg, key) + case "allowedActions": + err = unpopulate(val, "AllowedActions", &j.AllowedActions) + delete(rawMsg, key) + case "customProperties": + j.CustomProperties, err = unmarshalJobModelCustomPropertiesClassification(val) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &j.DisplayName) + delete(rawMsg, key) + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &j.EndTime) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &j.Errors) + delete(rawMsg, key) + case "objectId": + err = unpopulate(val, "ObjectID", &j.ObjectID) + delete(rawMsg, key) + case "objectInternalId": + err = unpopulate(val, "ObjectInternalID", &j.ObjectInternalID) + delete(rawMsg, key) + case "objectInternalName": + err = unpopulate(val, "ObjectInternalName", &j.ObjectInternalName) + delete(rawMsg, key) + case "objectName": + err = unpopulate(val, "ObjectName", &j.ObjectName) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &j.ObjectType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &j.ProvisioningState) + delete(rawMsg, key) + case "replicationProviderId": + err = unpopulate(val, "ReplicationProviderID", &j.ReplicationProviderID) + delete(rawMsg, key) + case "sourceFabricProviderId": + err = unpopulate(val, "SourceFabricProviderID", &j.SourceFabricProviderID) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &j.StartTime) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &j.State) + delete(rawMsg, key) + case "targetFabricProviderId": + err = unpopulate(val, "TargetFabricProviderID", &j.TargetFabricProviderID) + delete(rawMsg, key) + case "tasks": + err = unpopulate(val, "Tasks", &j.Tasks) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. +func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", m.PrincipalID) + populate(objectMap, "tenantId", m.TenantID) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServiceIdentity. +func (m *ManagedServiceIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &m.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) populate(objectMap, "isDataAction", o.IsDataAction) populate(objectMap, "name", o.Name) populate(objectMap, "origin", o.Origin) @@ -2399,16 +2659,15 @@ func (p *PolicyModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PolicyModelCollection. -func (p PolicyModelCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PolicyModelCustomProperties. +func (p PolicyModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) + objectMap["instanceType"] = p.InstanceType return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyModelCollection. -func (p *PolicyModelCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyModelCustomProperties. +func (p *PolicyModelCustomProperties) 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", p, err) @@ -2416,11 +2675,8 @@ func (p *PolicyModelCollection) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) + case "instanceType": + err = unpopulate(val, "InstanceType", &p.InstanceType) delete(rawMsg, key) } if err != nil { @@ -2430,15 +2686,16 @@ func (p *PolicyModelCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PolicyModelCustomProperties. -func (p PolicyModelCustomProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PolicyModelListResult. +func (p PolicyModelListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["instanceType"] = p.InstanceType + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyModelCustomProperties. -func (p *PolicyModelCustomProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyModelListResult. +func (p *PolicyModelListResult) 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", p, err) @@ -2446,8 +2703,11 @@ func (p *PolicyModelCustomProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "instanceType": - err = unpopulate(val, "InstanceType", &p.InstanceType) + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { @@ -2488,64 +2748,15 @@ func (p *PolicyModelProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PolicyModelSystemData. -func (p PolicyModelSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", p.CreatedAt) - populate(objectMap, "createdBy", p.CreatedBy) - populate(objectMap, "createdByType", p.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", p.LastModifiedAt) - populate(objectMap, "lastModifiedBy", p.LastModifiedBy) - populate(objectMap, "lastModifiedByType", p.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyModelSystemData. -func (p *PolicyModelSystemData) 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", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &p.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &p.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &p.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &p.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &p.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &p.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ProtectedItemDynamicMemoryConfig. -func (p ProtectedItemDynamicMemoryConfig) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpoint. +func (p PrivateEndpoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "maximumMemoryInMegaBytes", p.MaximumMemoryInMegaBytes) - populate(objectMap, "minimumMemoryInMegaBytes", p.MinimumMemoryInMegaBytes) - populate(objectMap, "targetMemoryBufferPercentage", p.TargetMemoryBufferPercentage) + populate(objectMap, "id", p.ID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemDynamicMemoryConfig. -func (p *ProtectedItemDynamicMemoryConfig) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpoint. +func (p *PrivateEndpoint) 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", p, err) @@ -2553,14 +2764,8 @@ func (p *ProtectedItemDynamicMemoryConfig) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "maximumMemoryInMegaBytes": - err = unpopulate(val, "MaximumMemoryInMegaBytes", &p.MaximumMemoryInMegaBytes) - delete(rawMsg, key) - case "minimumMemoryInMegaBytes": - err = unpopulate(val, "MinimumMemoryInMegaBytes", &p.MinimumMemoryInMegaBytes) - delete(rawMsg, key) - case "targetMemoryBufferPercentage": - err = unpopulate(val, "TargetMemoryBufferPercentage", &p.TargetMemoryBufferPercentage) + case "id": + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) } if err != nil { @@ -2570,8 +2775,8 @@ func (p *ProtectedItemDynamicMemoryConfig) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModel. -func (p ProtectedItemModel) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. +func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) @@ -2581,8 +2786,8 @@ func (p ProtectedItemModel) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModel. -func (p *ProtectedItemModel) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. +func (p *PrivateEndpointConnection) 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", p, err) @@ -2613,16 +2818,16 @@ func (p *ProtectedItemModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelCollection. -func (p ProtectedItemModelCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. +func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", p.NextLink) populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelCollection. -func (p *ProtectedItemModelCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult. +func (p *PrivateEndpointConnectionListResult) 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", p, err) @@ -2644,12 +2849,507 @@ func (p *ProtectedItemModelCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelCustomProperties. -func (p ProtectedItemModelCustomProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProxy. +func (p PrivateEndpointConnectionProxy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["instanceType"] = p.InstanceType - return json.Marshal(objectMap) -} + populate(objectMap, "etag", p.Etag) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProxy. +func (p *PrivateEndpointConnectionProxy) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &p.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProxyListResult. +func (p PrivateEndpointConnectionProxyListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProxyListResult. +func (p *PrivateEndpointConnectionProxyListResult) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProxyProperties. +func (p PrivateEndpointConnectionProxyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "remotePrivateEndpoint", p.RemotePrivateEndpoint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProxyProperties. +func (p *PrivateEndpointConnectionProxyProperties) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "remotePrivateEndpoint": + err = unpopulate(val, "RemotePrivateEndpoint", &p.RemotePrivateEndpoint) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionResponseProperties. +func (p PrivateEndpointConnectionResponseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionResponseProperties. +func (p *PrivateEndpointConnectionResponseProperties) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. +func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. +func (p *PrivateLinkResource) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. +func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceListResult. +func (p *PrivateLinkResourceListResult) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "requiredMembers", p.RequiredMembers) + populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. +func (p *PrivateLinkResourceProperties) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) + delete(rawMsg, key) + case "requiredZoneNames": + err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnection. +func (p PrivateLinkServiceConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupIds", p.GroupIDs) + populate(objectMap, "name", p.Name) + populate(objectMap, "requestMessage", p.RequestMessage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnection. +func (p *PrivateLinkServiceConnection) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupIds": + err = unpopulate(val, "GroupIDs", &p.GroupIDs) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "requestMessage": + err = unpopulate(val, "RequestMessage", &p.RequestMessage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState. +func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionsRequired", p.ActionsRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState. +func (p *PrivateLinkServiceConnectionState) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionsRequired": + err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceProxy. +func (p PrivateLinkServiceProxy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupConnectivityInformation", p.GroupConnectivityInformation) + populate(objectMap, "id", p.ID) + populate(objectMap, "remotePrivateEndpointConnection", p.RemotePrivateEndpointConnection) + populate(objectMap, "remotePrivateLinkServiceConnectionState", p.RemotePrivateLinkServiceConnectionState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceProxy. +func (p *PrivateLinkServiceProxy) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupConnectivityInformation": + err = unpopulate(val, "GroupConnectivityInformation", &p.GroupConnectivityInformation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "remotePrivateEndpointConnection": + err = unpopulate(val, "RemotePrivateEndpointConnection", &p.RemotePrivateEndpointConnection) + delete(rawMsg, key) + case "remotePrivateLinkServiceConnectionState": + err = unpopulate(val, "RemotePrivateLinkServiceConnectionState", &p.RemotePrivateLinkServiceConnectionState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProtectedItemDynamicMemoryConfig. +func (p ProtectedItemDynamicMemoryConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "maximumMemoryInMegaBytes", p.MaximumMemoryInMegaBytes) + populate(objectMap, "minimumMemoryInMegaBytes", p.MinimumMemoryInMegaBytes) + populate(objectMap, "targetMemoryBufferPercentage", p.TargetMemoryBufferPercentage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemDynamicMemoryConfig. +func (p *ProtectedItemDynamicMemoryConfig) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "maximumMemoryInMegaBytes": + err = unpopulate(val, "MaximumMemoryInMegaBytes", &p.MaximumMemoryInMegaBytes) + delete(rawMsg, key) + case "minimumMemoryInMegaBytes": + err = unpopulate(val, "MinimumMemoryInMegaBytes", &p.MinimumMemoryInMegaBytes) + delete(rawMsg, key) + case "targetMemoryBufferPercentage": + err = unpopulate(val, "TargetMemoryBufferPercentage", &p.TargetMemoryBufferPercentage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProtectedItemJobProperties. +func (p ProtectedItemJobProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", p.DisplayName) + populateDateTimeRFC3339(objectMap, "endTime", p.EndTime) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "scenarioName", p.ScenarioName) + populateDateTimeRFC3339(objectMap, "startTime", p.StartTime) + populate(objectMap, "state", p.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemJobProperties. +func (p *ProtectedItemJobProperties) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) + delete(rawMsg, key) + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &p.EndTime) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "scenarioName": + err = unpopulate(val, "ScenarioName", &p.ScenarioName) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &p.StartTime) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &p.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModel. +func (p ProtectedItemModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModel. +func (p *ProtectedItemModel) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelCustomProperties. +func (p ProtectedItemModelCustomProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["instanceType"] = p.InstanceType + return json.Marshal(objectMap) +} // UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelCustomProperties. func (p *ProtectedItemModelCustomProperties) UnmarshalJSON(data []byte) error { @@ -2671,6 +3371,64 @@ func (p *ProtectedItemModelCustomProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelCustomPropertiesUpdate. +func (p ProtectedItemModelCustomPropertiesUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["instanceType"] = p.InstanceType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelCustomPropertiesUpdate. +func (p *ProtectedItemModelCustomPropertiesUpdate) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "instanceType": + err = unpopulate(val, "InstanceType", &p.InstanceType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelListResult. +func (p ProtectedItemModelListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelListResult. +func (p *ProtectedItemModelListResult) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelProperties. func (p ProtectedItemModelProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2678,7 +3436,7 @@ func (p ProtectedItemModelProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "correlationId", p.CorrelationID) populate(objectMap, "currentJob", p.CurrentJob) populate(objectMap, "customProperties", p.CustomProperties) - populate(objectMap, "draId", p.DraID) + populate(objectMap, "fabricAgentId", p.FabricAgentID) populate(objectMap, "fabricId", p.FabricID) populate(objectMap, "fabricObjectId", p.FabricObjectID) populate(objectMap, "fabricObjectName", p.FabricObjectName) @@ -2698,7 +3456,7 @@ func (p ProtectedItemModelProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "resyncRequired", p.ResyncRequired) populate(objectMap, "resynchronizationState", p.ResynchronizationState) populate(objectMap, "sourceFabricProviderId", p.SourceFabricProviderID) - populate(objectMap, "targetDraId", p.TargetDraID) + populate(objectMap, "targetFabricAgentId", p.TargetFabricAgentID) populate(objectMap, "targetFabricId", p.TargetFabricID) populate(objectMap, "targetFabricProviderId", p.TargetFabricProviderID) populate(objectMap, "testFailoverState", p.TestFailoverState) @@ -2727,8 +3485,8 @@ func (p *ProtectedItemModelProperties) UnmarshalJSON(data []byte) error { case "customProperties": p.CustomProperties, err = unmarshalProtectedItemModelCustomPropertiesClassification(val) delete(rawMsg, key) - case "draId": - err = unpopulate(val, "DraID", &p.DraID) + case "fabricAgentId": + err = unpopulate(val, "FabricAgentID", &p.FabricAgentID) delete(rawMsg, key) case "fabricId": err = unpopulate(val, "FabricID", &p.FabricID) @@ -2787,8 +3545,8 @@ func (p *ProtectedItemModelProperties) UnmarshalJSON(data []byte) error { case "sourceFabricProviderId": err = unpopulate(val, "SourceFabricProviderID", &p.SourceFabricProviderID) delete(rawMsg, key) - case "targetDraId": - err = unpopulate(val, "TargetDraID", &p.TargetDraID) + case "targetFabricAgentId": + err = unpopulate(val, "TargetFabricAgentID", &p.TargetFabricAgentID) delete(rawMsg, key) case "targetFabricId": err = unpopulate(val, "TargetFabricID", &p.TargetFabricID) @@ -2810,123 +3568,15 @@ func (p *ProtectedItemModelProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelPropertiesCurrentJob. -func (p ProtectedItemModelPropertiesCurrentJob) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "displayName", p.DisplayName) - populateDateTimeRFC3339(objectMap, "endTime", p.EndTime) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "scenarioName", p.ScenarioName) - populateDateTimeRFC3339(objectMap, "startTime", p.StartTime) - populate(objectMap, "state", p.State) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelPropertiesCurrentJob. -func (p *ProtectedItemModelPropertiesCurrentJob) 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", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &p.DisplayName) - delete(rawMsg, key) - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &p.EndTime) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "scenarioName": - err = unpopulate(val, "ScenarioName", &p.ScenarioName) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &p.StartTime) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &p.State) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelPropertiesLastFailedEnableProtectionJob. -func (p ProtectedItemModelPropertiesLastFailedEnableProtectionJob) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "displayName", p.DisplayName) - populateDateTimeRFC3339(objectMap, "endTime", p.EndTime) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "scenarioName", p.ScenarioName) - populateDateTimeRFC3339(objectMap, "startTime", p.StartTime) - populate(objectMap, "state", p.State) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelPropertiesLastFailedEnableProtectionJob. -func (p *ProtectedItemModelPropertiesLastFailedEnableProtectionJob) 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", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &p.DisplayName) - delete(rawMsg, key) - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &p.EndTime) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "scenarioName": - err = unpopulate(val, "ScenarioName", &p.ScenarioName) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &p.StartTime) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &p.State) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelPropertiesLastFailedPlannedFailoverJob. -func (p ProtectedItemModelPropertiesLastFailedPlannedFailoverJob) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelPropertiesUpdate. +func (p ProtectedItemModelPropertiesUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "displayName", p.DisplayName) - populateDateTimeRFC3339(objectMap, "endTime", p.EndTime) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "scenarioName", p.ScenarioName) - populateDateTimeRFC3339(objectMap, "startTime", p.StartTime) - populate(objectMap, "state", p.State) + populate(objectMap, "customProperties", p.CustomProperties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelPropertiesLastFailedPlannedFailoverJob. -func (p *ProtectedItemModelPropertiesLastFailedPlannedFailoverJob) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelPropertiesUpdate. +func (p *ProtectedItemModelPropertiesUpdate) 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", p, err) @@ -2934,26 +3584,8 @@ func (p *ProtectedItemModelPropertiesLastFailedPlannedFailoverJob) UnmarshalJSON for key, val := range rawMsg { var err error switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &p.DisplayName) - delete(rawMsg, key) - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &p.EndTime) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "scenarioName": - err = unpopulate(val, "ScenarioName", &p.ScenarioName) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &p.StartTime) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &p.State) + case "customProperties": + p.CustomProperties, err = unmarshalProtectedItemModelCustomPropertiesUpdateClassification(val) delete(rawMsg, key) } if err != nil { @@ -2963,21 +3595,19 @@ func (p *ProtectedItemModelPropertiesLastFailedPlannedFailoverJob) UnmarshalJSON return nil } -// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelPropertiesLastTestFailoverJob. -func (p ProtectedItemModelPropertiesLastTestFailoverJob) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelUpdate. +func (p ProtectedItemModelUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "displayName", p.DisplayName) - populateDateTimeRFC3339(objectMap, "endTime", p.EndTime) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) - populate(objectMap, "scenarioName", p.ScenarioName) - populateDateTimeRFC3339(objectMap, "startTime", p.StartTime) - populate(objectMap, "state", p.State) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelPropertiesLastTestFailoverJob. -func (p *ProtectedItemModelPropertiesLastTestFailoverJob) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelUpdate. +func (p *ProtectedItemModelUpdate) 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", p, err) @@ -2985,73 +3615,20 @@ func (p *ProtectedItemModelPropertiesLastTestFailoverJob) UnmarshalJSON(data []b for key, val := range rawMsg { var err error switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &p.DisplayName) - delete(rawMsg, key) - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &p.EndTime) - delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) - case "scenarioName": - err = unpopulate(val, "ScenarioName", &p.ScenarioName) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &p.StartTime) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &p.State) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelSystemData. -func (p ProtectedItemModelSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", p.CreatedAt) - populate(objectMap, "createdBy", p.CreatedBy) - populate(objectMap, "createdByType", p.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", p.LastModifiedAt) - populate(objectMap, "lastModifiedBy", p.LastModifiedBy) - populate(objectMap, "lastModifiedByType", p.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelSystemData. -func (p *ProtectedItemModelSystemData) 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", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &p.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &p.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &p.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &p.LastModifiedAt) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &p.LastModifiedBy) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &p.LastModifiedByType) + case "type": + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { @@ -3104,28 +3681,24 @@ func (r *RecoveryPointModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RecoveryPointModelCollection. -func (r RecoveryPointModelCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecoveryPointModelCustomProperties. +func (r RecoveryPointModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) + objectMap["instanceType"] = r.InstanceType return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointModelCollection. -func (r *RecoveryPointModelCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointModelCustomProperties. +func (r *RecoveryPointModelCustomProperties) 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", r, err) } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) + for key, val := range rawMsg { + var err error + switch key { + case "instanceType": + err = unpopulate(val, "InstanceType", &r.InstanceType) delete(rawMsg, key) } if err != nil { @@ -3135,15 +3708,16 @@ func (r *RecoveryPointModelCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RecoveryPointModelCustomProperties. -func (r RecoveryPointModelCustomProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecoveryPointModelListResult. +func (r RecoveryPointModelListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["instanceType"] = r.InstanceType + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointModelCustomProperties. -func (r *RecoveryPointModelCustomProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointModelListResult. +func (r *RecoveryPointModelListResult) 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", r, err) @@ -3151,8 +3725,11 @@ func (r *RecoveryPointModelCustomProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "instanceType": - err = unpopulate(val, "InstanceType", &r.InstanceType) + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) delete(rawMsg, key) } if err != nil { @@ -3166,6 +3743,7 @@ func (r *RecoveryPointModelCustomProperties) UnmarshalJSON(data []byte) error { func (r RecoveryPointModelProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "customProperties", r.CustomProperties) + populate(objectMap, "provisioningState", r.ProvisioningState) populateDateTimeRFC3339(objectMap, "recoveryPointTime", r.RecoveryPointTime) populate(objectMap, "recoveryPointType", r.RecoveryPointType) return json.Marshal(objectMap) @@ -3183,6 +3761,9 @@ func (r *RecoveryPointModelProperties) UnmarshalJSON(data []byte) error { case "customProperties": r.CustomProperties, err = unmarshalRecoveryPointModelCustomPropertiesClassification(val) delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) case "recoveryPointTime": err = unpopulateDateTimeRFC3339(val, "RecoveryPointTime", &r.RecoveryPointTime) delete(rawMsg, key) @@ -3197,20 +3778,19 @@ func (r *RecoveryPointModelProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RecoveryPointModelSystemData. -func (r RecoveryPointModelSystemData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RemotePrivateEndpoint. +func (r RemotePrivateEndpoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", r.CreatedAt) - populate(objectMap, "createdBy", r.CreatedBy) - populate(objectMap, "createdByType", r.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", r.LastModifiedAt) - populate(objectMap, "lastModifiedBy", r.LastModifiedBy) - populate(objectMap, "lastModifiedByType", r.LastModifiedByType) + populate(objectMap, "connectionDetails", r.ConnectionDetails) + populate(objectMap, "id", r.ID) + populate(objectMap, "manualPrivateLinkServiceConnections", r.ManualPrivateLinkServiceConnections) + populate(objectMap, "privateLinkServiceConnections", r.PrivateLinkServiceConnections) + populate(objectMap, "privateLinkServiceProxies", r.PrivateLinkServiceProxies) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointModelSystemData. -func (r *RecoveryPointModelSystemData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RemotePrivateEndpoint. +func (r *RemotePrivateEndpoint) 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", r, err) @@ -3218,23 +3798,47 @@ func (r *RecoveryPointModelSystemData) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &r.CreatedAt) + case "connectionDetails": + err = unpopulate(val, "ConnectionDetails", &r.ConnectionDetails) delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &r.CreatedBy) + case "id": + err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &r.CreatedByType) + case "manualPrivateLinkServiceConnections": + err = unpopulate(val, "ManualPrivateLinkServiceConnections", &r.ManualPrivateLinkServiceConnections) delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &r.LastModifiedAt) + case "privateLinkServiceConnections": + err = unpopulate(val, "PrivateLinkServiceConnections", &r.PrivateLinkServiceConnections) delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &r.LastModifiedBy) + case "privateLinkServiceProxies": + err = unpopulate(val, "PrivateLinkServiceProxies", &r.PrivateLinkServiceProxies) delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &r.LastModifiedByType) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RemotePrivateEndpointConnection. +func (r RemotePrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RemotePrivateEndpointConnection. +func (r *RemotePrivateEndpointConnection) 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", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) } if err != nil { @@ -3287,16 +3891,15 @@ func (r *ReplicationExtensionModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ReplicationExtensionModelCollection. -func (r ReplicationExtensionModelCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ReplicationExtensionModelCustomProperties. +func (r ReplicationExtensionModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) + objectMap["instanceType"] = r.InstanceType return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationExtensionModelCollection. -func (r *ReplicationExtensionModelCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationExtensionModelCustomProperties. +func (r *ReplicationExtensionModelCustomProperties) 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", r, err) @@ -3304,11 +3907,8 @@ func (r *ReplicationExtensionModelCollection) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) + case "instanceType": + err = unpopulate(val, "InstanceType", &r.InstanceType) delete(rawMsg, key) } if err != nil { @@ -3318,15 +3918,16 @@ func (r *ReplicationExtensionModelCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ReplicationExtensionModelCustomProperties. -func (r ReplicationExtensionModelCustomProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ReplicationExtensionModelListResult. +func (r ReplicationExtensionModelListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["instanceType"] = r.InstanceType + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationExtensionModelCustomProperties. -func (r *ReplicationExtensionModelCustomProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationExtensionModelListResult. +func (r *ReplicationExtensionModelListResult) 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", r, err) @@ -3334,8 +3935,11 @@ func (r *ReplicationExtensionModelCustomProperties) UnmarshalJSON(data []byte) e for key, val := range rawMsg { var err error switch key { - case "instanceType": - err = unpopulate(val, "InstanceType", &r.InstanceType) + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) delete(rawMsg, key) } if err != nil { @@ -3376,63 +3980,51 @@ func (r *ReplicationExtensionModelProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ReplicationExtensionModelSystemData. -func (r ReplicationExtensionModelSystemData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StorageContainerProperties. +func (s StorageContainerProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", r.CreatedAt) - populate(objectMap, "createdBy", r.CreatedBy) - populate(objectMap, "createdByType", r.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", r.LastModifiedAt) - populate(objectMap, "lastModifiedBy", r.LastModifiedBy) - populate(objectMap, "lastModifiedByType", r.LastModifiedByType) + populate(objectMap, "clusterSharedVolumePath", s.ClusterSharedVolumePath) + populate(objectMap, "name", s.Name) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationExtensionModelSystemData. -func (r *ReplicationExtensionModelSystemData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageContainerProperties. +func (s *StorageContainerProperties) 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", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &r.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &r.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &r.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &r.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &r.LastModifiedBy) + case "clusterSharedVolumePath": + err = unpopulate(val, "ClusterSharedVolumePath", &s.ClusterSharedVolumePath) delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &r.LastModifiedByType) + case "name": + err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StorageContainerProperties. -func (s StorageContainerProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "clusterSharedVolumePath", s.ClusterSharedVolumePath) - populate(objectMap, "name", s.Name) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StorageContainerProperties. -func (s *StorageContainerProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -3440,11 +4032,23 @@ func (s *StorageContainerProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "clusterSharedVolumePath": - err = unpopulate(val, "ClusterSharedVolumePath", &s.ClusterSharedVolumePath) + case "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) delete(rawMsg, key) } if err != nil { @@ -3457,7 +4061,7 @@ func (s *StorageContainerProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TaskModel. func (t TaskModel) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "childrenWorkflows", t.ChildrenWorkflows) + populate(objectMap, "childrenJobs", t.ChildrenJobs) populate(objectMap, "customProperties", t.CustomProperties) populateDateTimeRFC3339(objectMap, "endTime", t.EndTime) populateDateTimeRFC3339(objectMap, "startTime", t.StartTime) @@ -3475,8 +4079,8 @@ func (t *TaskModel) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "childrenWorkflows": - err = unpopulate(val, "ChildrenWorkflows", &t.ChildrenWorkflows) + case "childrenJobs": + err = unpopulate(val, "ChildrenJobs", &t.ChildrenJobs) delete(rawMsg, key) case "customProperties": err = unpopulate(val, "CustomProperties", &t.CustomProperties) @@ -3528,17 +4132,17 @@ func (t *TaskModelCustomProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TestFailoverCleanupWorkflowModelCustomProperties. -func (t TestFailoverCleanupWorkflowModelCustomProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TestFailoverCleanupJobModelCustomProperties. +func (t TestFailoverCleanupJobModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "affectedObjectDetails", t.AffectedObjectDetails) populate(objectMap, "comments", t.Comments) - objectMap["instanceType"] = "TestFailoverCleanupWorkflowDetails" + objectMap["instanceType"] = "TestFailoverCleanupJobDetails" return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TestFailoverCleanupWorkflowModelCustomProperties. -func (t *TestFailoverCleanupWorkflowModelCustomProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TestFailoverCleanupJobModelCustomProperties. +func (t *TestFailoverCleanupJobModelCustomProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -3563,17 +4167,17 @@ func (t *TestFailoverCleanupWorkflowModelCustomProperties) UnmarshalJSON(data [] return nil } -// MarshalJSON implements the json.Marshaller interface for type TestFailoverWorkflowModelCustomProperties. -func (t TestFailoverWorkflowModelCustomProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TestFailoverJobModelCustomProperties. +func (t TestFailoverJobModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "affectedObjectDetails", t.AffectedObjectDetails) - objectMap["instanceType"] = "TestFailoverWorkflowDetails" + objectMap["instanceType"] = "TestFailoverJobDetails" populate(objectMap, "protectedItemDetails", t.ProtectedItemDetails) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TestFailoverWorkflowModelCustomProperties. -func (t *TestFailoverWorkflowModelCustomProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TestFailoverJobModelCustomProperties. +func (t *TestFailoverJobModelCustomProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -3598,8 +4202,39 @@ func (t *TestFailoverWorkflowModelCustomProperties) UnmarshalJSON(data []byte) e return nil } -// MarshalJSON implements the json.Marshaller interface for type VMwareDraModelCustomProperties. -func (v VMwareDraModelCustomProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentity. +func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity. +func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMwareFabricAgentModelCustomProperties. +func (v VMwareFabricAgentModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "biosId", v.BiosID) objectMap["instanceType"] = "VMware" @@ -3607,8 +4242,8 @@ func (v VMwareDraModelCustomProperties) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VMwareDraModelCustomProperties. -func (v *VMwareDraModelCustomProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VMwareFabricAgentModelCustomProperties. +func (v *VMwareFabricAgentModelCustomProperties) 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", v, err) @@ -3671,8 +4306,13 @@ func (v *VMwareMigrateFabricModelCustomProperties) UnmarshalJSON(data []byte) er // MarshalJSON implements the json.Marshaller interface for type VMwareToAzStackHCIDiskInput. func (v VMwareToAzStackHCIDiskInput) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "diskBlockSize", v.DiskBlockSize) + populate(objectMap, "diskController", v.DiskController) populate(objectMap, "diskFileFormat", v.DiskFileFormat) populate(objectMap, "diskId", v.DiskID) + populate(objectMap, "diskIdentifier", v.DiskIdentifier) + populate(objectMap, "diskLogicalSectorSize", v.DiskLogicalSectorSize) + populate(objectMap, "diskPhysicalSectorSize", v.DiskPhysicalSectorSize) populate(objectMap, "diskSizeGB", v.DiskSizeGB) populate(objectMap, "isDynamic", v.IsDynamic) populate(objectMap, "isOsDisk", v.IsOsDisk) @@ -3689,12 +4329,27 @@ func (v *VMwareToAzStackHCIDiskInput) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "diskBlockSize": + err = unpopulate(val, "DiskBlockSize", &v.DiskBlockSize) + delete(rawMsg, key) + case "diskController": + err = unpopulate(val, "DiskController", &v.DiskController) + delete(rawMsg, key) case "diskFileFormat": err = unpopulate(val, "DiskFileFormat", &v.DiskFileFormat) delete(rawMsg, key) case "diskId": err = unpopulate(val, "DiskID", &v.DiskID) delete(rawMsg, key) + case "diskIdentifier": + err = unpopulate(val, "DiskIdentifier", &v.DiskIdentifier) + delete(rawMsg, key) + case "diskLogicalSectorSize": + err = unpopulate(val, "DiskLogicalSectorSize", &v.DiskLogicalSectorSize) + delete(rawMsg, key) + case "diskPhysicalSectorSize": + err = unpopulate(val, "DiskPhysicalSectorSize", &v.DiskPhysicalSectorSize) + delete(rawMsg, key) case "diskSizeGB": err = unpopulate(val, "DiskSizeGB", &v.DiskSizeGB) delete(rawMsg, key) @@ -3715,9 +4370,58 @@ func (v *VMwareToAzStackHCIDiskInput) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type VMwareToAzStackHCIEventModelCustomProperties. +func (v VMwareToAzStackHCIEventModelCustomProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "eventSourceFriendlyName", v.EventSourceFriendlyName) + objectMap["instanceType"] = "VMwareToAzStackHCI" + populate(objectMap, "protectedItemFriendlyName", v.ProtectedItemFriendlyName) + populate(objectMap, "serverType", v.ServerType) + populate(objectMap, "sourceApplianceName", v.SourceApplianceName) + populate(objectMap, "targetApplianceName", v.TargetApplianceName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMwareToAzStackHCIEventModelCustomProperties. +func (v *VMwareToAzStackHCIEventModelCustomProperties) 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", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "eventSourceFriendlyName": + err = unpopulate(val, "EventSourceFriendlyName", &v.EventSourceFriendlyName) + delete(rawMsg, key) + case "instanceType": + err = unpopulate(val, "InstanceType", &v.InstanceType) + delete(rawMsg, key) + case "protectedItemFriendlyName": + err = unpopulate(val, "ProtectedItemFriendlyName", &v.ProtectedItemFriendlyName) + delete(rawMsg, key) + case "serverType": + err = unpopulate(val, "ServerType", &v.ServerType) + delete(rawMsg, key) + case "sourceApplianceName": + err = unpopulate(val, "SourceApplianceName", &v.SourceApplianceName) + delete(rawMsg, key) + case "targetApplianceName": + err = unpopulate(val, "TargetApplianceName", &v.TargetApplianceName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type VMwareToAzStackHCINicInput. func (v VMwareToAzStackHCINicInput) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "isMacMigrationEnabled", v.IsMacMigrationEnabled) + populate(objectMap, "isStaticIpMigrationEnabled", v.IsStaticIPMigrationEnabled) populate(objectMap, "label", v.Label) populate(objectMap, "networkName", v.NetworkName) populate(objectMap, "nicId", v.NicID) @@ -3736,6 +4440,12 @@ func (v *VMwareToAzStackHCINicInput) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "isMacMigrationEnabled": + err = unpopulate(val, "IsMacMigrationEnabled", &v.IsMacMigrationEnabled) + delete(rawMsg, key) + case "isStaticIpMigrationEnabled": + err = unpopulate(val, "IsStaticIPMigrationEnabled", &v.IsStaticIPMigrationEnabled) + delete(rawMsg, key) case "label": err = unpopulate(val, "Label", &v.Label) delete(rawMsg, key) @@ -3836,6 +4546,9 @@ func (v *VMwareToAzStackHCIPolicyModelCustomProperties) UnmarshalJSON(data []byt func (v VMwareToAzStackHCIProtectedDiskProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "capacityInBytes", v.CapacityInBytes) + populate(objectMap, "diskBlockSize", v.DiskBlockSize) + populate(objectMap, "diskLogicalSectorSize", v.DiskLogicalSectorSize) + populate(objectMap, "diskPhysicalSectorSize", v.DiskPhysicalSectorSize) populate(objectMap, "diskType", v.DiskType) populate(objectMap, "isDynamic", v.IsDynamic) populate(objectMap, "isOsDisk", v.IsOsDisk) @@ -3861,6 +4574,15 @@ func (v *VMwareToAzStackHCIProtectedDiskProperties) UnmarshalJSON(data []byte) e case "capacityInBytes": err = unpopulate(val, "CapacityInBytes", &v.CapacityInBytes) delete(rawMsg, key) + case "diskBlockSize": + err = unpopulate(val, "DiskBlockSize", &v.DiskBlockSize) + delete(rawMsg, key) + case "diskLogicalSectorSize": + err = unpopulate(val, "DiskLogicalSectorSize", &v.DiskLogicalSectorSize) + delete(rawMsg, key) + case "diskPhysicalSectorSize": + err = unpopulate(val, "DiskPhysicalSectorSize", &v.DiskPhysicalSectorSize) + delete(rawMsg, key) case "diskType": err = unpopulate(val, "DiskType", &v.DiskType) delete(rawMsg, key) @@ -3932,7 +4654,7 @@ func (v VMwareToAzStackHCIProtectedItemModelCustomProperties) MarshalJSON() ([]b populate(objectMap, "runAsAccountId", v.RunAsAccountID) populate(objectMap, "sourceApplianceName", v.SourceApplianceName) populate(objectMap, "sourceCpuCores", v.SourceCPUCores) - populate(objectMap, "sourceDraName", v.SourceDraName) + populate(objectMap, "sourceFabricAgentName", v.SourceFabricAgentName) populate(objectMap, "sourceMemoryInMegaBytes", v.SourceMemoryInMegaBytes) populate(objectMap, "sourceVmName", v.SourceVMName) populate(objectMap, "storageContainerId", v.StorageContainerID) @@ -3940,7 +4662,7 @@ func (v VMwareToAzStackHCIProtectedItemModelCustomProperties) MarshalJSON() ([]b populate(objectMap, "targetArcClusterCustomLocationId", v.TargetArcClusterCustomLocationID) populate(objectMap, "targetAzStackHciClusterName", v.TargetAzStackHciClusterName) populate(objectMap, "targetCpuCores", v.TargetCPUCores) - populate(objectMap, "targetDraName", v.TargetDraName) + populate(objectMap, "targetFabricAgentName", v.TargetFabricAgentName) populate(objectMap, "targetHciClusterId", v.TargetHciClusterID) populate(objectMap, "targetLocation", v.TargetLocation) populate(objectMap, "targetMemoryInMegaBytes", v.TargetMemoryInMegaBytes) @@ -4051,8 +4773,8 @@ func (v *VMwareToAzStackHCIProtectedItemModelCustomProperties) UnmarshalJSON(dat case "sourceCpuCores": err = unpopulate(val, "SourceCPUCores", &v.SourceCPUCores) delete(rawMsg, key) - case "sourceDraName": - err = unpopulate(val, "SourceDraName", &v.SourceDraName) + case "sourceFabricAgentName": + err = unpopulate(val, "SourceFabricAgentName", &v.SourceFabricAgentName) delete(rawMsg, key) case "sourceMemoryInMegaBytes": err = unpopulate(val, "SourceMemoryInMegaBytes", &v.SourceMemoryInMegaBytes) @@ -4075,8 +4797,8 @@ func (v *VMwareToAzStackHCIProtectedItemModelCustomProperties) UnmarshalJSON(dat case "targetCpuCores": err = unpopulate(val, "TargetCPUCores", &v.TargetCPUCores) delete(rawMsg, key) - case "targetDraName": - err = unpopulate(val, "TargetDraName", &v.TargetDraName) + case "targetFabricAgentName": + err = unpopulate(val, "TargetFabricAgentName", &v.TargetFabricAgentName) delete(rawMsg, key) case "targetHciClusterId": err = unpopulate(val, "TargetHciClusterID", &v.TargetHciClusterID) @@ -4110,6 +4832,57 @@ func (v *VMwareToAzStackHCIProtectedItemModelCustomProperties) UnmarshalJSON(dat return nil } +// MarshalJSON implements the json.Marshaller interface for type VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate. +func (v VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dynamicMemoryConfig", v.DynamicMemoryConfig) + objectMap["instanceType"] = "VMwareToAzStackHCI" + populate(objectMap, "isDynamicRam", v.IsDynamicRAM) + populate(objectMap, "nicsToInclude", v.NicsToInclude) + populate(objectMap, "osType", v.OSType) + populate(objectMap, "targetCpuCores", v.TargetCPUCores) + populate(objectMap, "targetMemoryInMegaBytes", v.TargetMemoryInMegaBytes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate. +func (v *VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate) 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", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dynamicMemoryConfig": + err = unpopulate(val, "DynamicMemoryConfig", &v.DynamicMemoryConfig) + delete(rawMsg, key) + case "instanceType": + err = unpopulate(val, "InstanceType", &v.InstanceType) + delete(rawMsg, key) + case "isDynamicRam": + err = unpopulate(val, "IsDynamicRAM", &v.IsDynamicRAM) + delete(rawMsg, key) + case "nicsToInclude": + err = unpopulate(val, "NicsToInclude", &v.NicsToInclude) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &v.OSType) + delete(rawMsg, key) + case "targetCpuCores": + err = unpopulate(val, "TargetCPUCores", &v.TargetCPUCores) + delete(rawMsg, key) + case "targetMemoryInMegaBytes": + err = unpopulate(val, "TargetMemoryInMegaBytes", &v.TargetMemoryInMegaBytes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type VMwareToAzStackHCIProtectedNicProperties. func (v VMwareToAzStackHCIProtectedNicProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -4154,8 +4927,39 @@ func (v *VMwareToAzStackHCIProtectedNicProperties) UnmarshalJSON(data []byte) er case "targetNetworkId": err = unpopulate(val, "TargetNetworkID", &v.TargetNetworkID) delete(rawMsg, key) - case "testNetworkId": - err = unpopulate(val, "TestNetworkID", &v.TestNetworkID) + case "testNetworkId": + err = unpopulate(val, "TestNetworkID", &v.TestNetworkID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMwareToAzStackHCIRecoveryPointModelCustomProperties. +func (v VMwareToAzStackHCIRecoveryPointModelCustomProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "diskIds", v.DiskIDs) + objectMap["instanceType"] = "VMwareToAzStackHCIRecoveryPointModelCustomProperties" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMwareToAzStackHCIRecoveryPointModelCustomProperties. +func (v *VMwareToAzStackHCIRecoveryPointModelCustomProperties) 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", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diskIds": + err = unpopulate(val, "DiskIDs", &v.DiskIDs) + delete(rawMsg, key) + case "instanceType": + err = unpopulate(val, "InstanceType", &v.InstanceType) delete(rawMsg, key) } if err != nil { @@ -4256,10 +5060,46 @@ func (v *VMwareToAzStackHCIReplicationExtensionModelCustomProperties) UnmarshalJ return nil } +// MarshalJSON implements the json.Marshaller interface for type VaultIdentityModel. +func (v VaultIdentityModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", v.PrincipalID) + populate(objectMap, "tenantId", v.TenantID) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VaultIdentityModel. +func (v *VaultIdentityModel) 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", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &v.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &v.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type VaultModel. func (v VaultModel) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", v.ID) + populate(objectMap, "identity", v.Identity) populate(objectMap, "location", v.Location) populate(objectMap, "name", v.Name) populate(objectMap, "properties", v.Properties) @@ -4281,6 +5121,9 @@ func (v *VaultModel) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &v.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &v.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &v.Location) delete(rawMsg, key) @@ -4307,16 +5150,16 @@ func (v *VaultModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VaultModelCollection. -func (v VaultModelCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VaultModelListResult. +func (v VaultModelListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", v.NextLink) populate(objectMap, "value", v.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VaultModelCollection. -func (v *VaultModelCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VaultModelListResult. +func (v *VaultModelListResult) 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", v, err) @@ -4373,57 +5216,11 @@ func (v *VaultModelProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VaultModelSystemData. -func (v VaultModelSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", v.CreatedAt) - populate(objectMap, "createdBy", v.CreatedBy) - populate(objectMap, "createdByType", v.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", v.LastModifiedAt) - populate(objectMap, "lastModifiedBy", v.LastModifiedBy) - populate(objectMap, "lastModifiedByType", v.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VaultModelSystemData. -func (v *VaultModelSystemData) 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", v, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &v.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &v.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &v.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &v.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &v.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &v.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type VaultModelUpdate. func (v VaultModelUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", v.ID) + populate(objectMap, "identity", v.Identity) populate(objectMap, "name", v.Name) populate(objectMap, "properties", v.Properties) populate(objectMap, "systemData", v.SystemData) @@ -4444,6 +5241,9 @@ func (v *VaultModelUpdate) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &v.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &v.Identity) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &v.Name) delete(rawMsg, key) @@ -4467,308 +5267,28 @@ func (v *VaultModelUpdate) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VaultModelUpdateSystemData. -func (v VaultModelUpdateSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", v.CreatedAt) - populate(objectMap, "createdBy", v.CreatedBy) - populate(objectMap, "createdByType", v.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", v.LastModifiedAt) - populate(objectMap, "lastModifiedBy", v.LastModifiedBy) - populate(objectMap, "lastModifiedByType", v.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VaultModelUpdateSystemData. -func (v *VaultModelUpdateSystemData) 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", v, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &v.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &v.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &v.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &v.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &v.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &v.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type WorkflowModel. -func (w WorkflowModel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", w.ID) - populate(objectMap, "name", w.Name) - populate(objectMap, "properties", w.Properties) - populate(objectMap, "systemData", w.SystemData) - populate(objectMap, "type", w.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkflowModel. -func (w *WorkflowModel) 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", w, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &w.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &w.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &w.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &w.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &w.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type WorkflowModelCollection. -func (w WorkflowModelCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", w.NextLink) - populate(objectMap, "value", w.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkflowModelCollection. -func (w *WorkflowModelCollection) 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", w, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &w.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &w.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type WorkflowModelCustomProperties. -func (w WorkflowModelCustomProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "affectedObjectDetails", w.AffectedObjectDetails) - objectMap["instanceType"] = w.InstanceType - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkflowModelCustomProperties. -func (w *WorkflowModelCustomProperties) 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", w, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "affectedObjectDetails": - err = unpopulate(val, "AffectedObjectDetails", &w.AffectedObjectDetails) - delete(rawMsg, key) - case "instanceType": - err = unpopulate(val, "InstanceType", &w.InstanceType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type WorkflowModelProperties. -func (w WorkflowModelProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "activityId", w.ActivityID) - populate(objectMap, "allowedActions", w.AllowedActions) - populate(objectMap, "customProperties", w.CustomProperties) - populate(objectMap, "displayName", w.DisplayName) - populateDateTimeRFC3339(objectMap, "endTime", w.EndTime) - populate(objectMap, "errors", w.Errors) - populate(objectMap, "objectId", w.ObjectID) - populate(objectMap, "objectInternalId", w.ObjectInternalID) - populate(objectMap, "objectInternalName", w.ObjectInternalName) - populate(objectMap, "objectName", w.ObjectName) - populate(objectMap, "objectType", w.ObjectType) - populate(objectMap, "replicationProviderId", w.ReplicationProviderID) - populate(objectMap, "sourceFabricProviderId", w.SourceFabricProviderID) - populateDateTimeRFC3339(objectMap, "startTime", w.StartTime) - populate(objectMap, "state", w.State) - populate(objectMap, "targetFabricProviderId", w.TargetFabricProviderID) - populate(objectMap, "tasks", w.Tasks) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkflowModelProperties. -func (w *WorkflowModelProperties) 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", w, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "activityId": - err = unpopulate(val, "ActivityID", &w.ActivityID) - delete(rawMsg, key) - case "allowedActions": - err = unpopulate(val, "AllowedActions", &w.AllowedActions) - delete(rawMsg, key) - case "customProperties": - w.CustomProperties, err = unmarshalWorkflowModelCustomPropertiesClassification(val) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &w.DisplayName) - delete(rawMsg, key) - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &w.EndTime) - delete(rawMsg, key) - case "errors": - err = unpopulate(val, "Errors", &w.Errors) - delete(rawMsg, key) - case "objectId": - err = unpopulate(val, "ObjectID", &w.ObjectID) - delete(rawMsg, key) - case "objectInternalId": - err = unpopulate(val, "ObjectInternalID", &w.ObjectInternalID) - delete(rawMsg, key) - case "objectInternalName": - err = unpopulate(val, "ObjectInternalName", &w.ObjectInternalName) - delete(rawMsg, key) - case "objectName": - err = unpopulate(val, "ObjectName", &w.ObjectName) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &w.ObjectType) - delete(rawMsg, key) - case "replicationProviderId": - err = unpopulate(val, "ReplicationProviderID", &w.ReplicationProviderID) - delete(rawMsg, key) - case "sourceFabricProviderId": - err = unpopulate(val, "SourceFabricProviderID", &w.SourceFabricProviderID) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &w.StartTime) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &w.State) - delete(rawMsg, key) - case "targetFabricProviderId": - err = unpopulate(val, "TargetFabricProviderID", &w.TargetFabricProviderID) - delete(rawMsg, key) - case "tasks": - err = unpopulate(val, "Tasks", &w.Tasks) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type WorkflowModelSystemData. -func (w WorkflowModelSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", w.CreatedAt) - populate(objectMap, "createdBy", w.CreatedBy) - populate(objectMap, "createdByType", w.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", w.LastModifiedAt) - populate(objectMap, "lastModifiedBy", w.LastModifiedBy) - populate(objectMap, "lastModifiedByType", w.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkflowModelSystemData. -func (w *WorkflowModelSystemData) 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", w, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &w.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &w.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &w.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &w.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &w.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &w.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v } - return nil } -func populate(m map[string]any, k string, v any) { +func populateAny(m map[string]any, k string, v any) { if v == nil { return } else if azcore.IsNullValue(v) { m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { + } else { m[k] = v } } 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vaultoperationstatus_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operationresults_client.go similarity index 57% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vaultoperationstatus_client.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operationresults_client.go index 19b7c31d5347..d4e4c960266d 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vaultoperationstatus_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operationresults_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. @@ -20,63 +17,61 @@ import ( "strings" ) -// VaultOperationStatusClient contains the methods for the VaultOperationStatus group. -// Don't use this type directly, use NewVaultOperationStatusClient() instead. -type VaultOperationStatusClient struct { +// OperationResultsClient contains the methods for the OperationResults group. +// Don't use this type directly, use NewOperationResultsClient() instead. +type OperationResultsClient struct { internal *arm.Client subscriptionID string } -// NewVaultOperationStatusClient creates a new instance of VaultOperationStatusClient with the specified values. +// NewOperationResultsClient creates a new instance of OperationResultsClient with the specified values. // - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. -func NewVaultOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VaultOperationStatusClient, error) { +func NewOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationResultsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } - client := &VaultOperationStatusClient{ + client := &OperationResultsClient{ subscriptionID: subscriptionID, internal: cl, } return client, nil } -// Get - Tracks the results of an asynchronous operation on the vault. +// Get - Gets the operations. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - vaultName - The vault name. // - operationID - The ID of an ongoing async operation. -// - options - VaultOperationStatusClientGetOptions contains the optional parameters for the VaultOperationStatusClient.Get -// method. -func (client *VaultOperationStatusClient) Get(ctx context.Context, resourceGroupName string, vaultName string, operationID string, options *VaultOperationStatusClientGetOptions) (VaultOperationStatusClientGetResponse, error) { +// - options - OperationResultsClientGetOptions contains the optional parameters for the OperationResultsClient.Get method. +func (client *OperationResultsClient) Get(ctx context.Context, resourceGroupName string, operationID string, options *OperationResultsClientGetOptions) (OperationResultsClientGetResponse, error) { var err error - const operationName = "VaultOperationStatusClient.Get" + const operationName = "OperationResultsClient.Get" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, operationID, options) + req, err := client.getCreateRequest(ctx, resourceGroupName, operationID, options) if err != nil { - return VaultOperationStatusClientGetResponse{}, err + return OperationResultsClientGetResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return VaultOperationStatusClientGetResponse{}, err + return OperationResultsClientGetResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return VaultOperationStatusClientGetResponse{}, err + return OperationResultsClientGetResponse{}, err } resp, err := client.getHandleResponse(httpResp) return resp, err } // getCreateRequest creates the Get request. -func (client *VaultOperationStatusClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, operationID string, options *VaultOperationStatusClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/operations/{operationId}" +func (client *OperationResultsClient) getCreateRequest(ctx context.Context, resourceGroupName string, operationID string, _ *OperationResultsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/operationResults/{operationId}/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/{operationId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -85,10 +80,6 @@ func (client *VaultOperationStatusClient) getCreateRequest(ctx context.Context, return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) if operationID == "" { return nil, errors.New("parameter operationID cannot be empty") } @@ -98,17 +89,17 @@ func (client *VaultOperationStatusClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // getHandleResponse handles the Get response. -func (client *VaultOperationStatusClient) getHandleResponse(resp *http.Response) (VaultOperationStatusClientGetResponse, error) { - result := VaultOperationStatusClientGetResponse{} +func (client *OperationResultsClient) getHandleResponse(resp *http.Response) (OperationResultsClientGetResponse, error) { + result := OperationResultsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return VaultOperationStatusClientGetResponse{}, err + return OperationResultsClientGetResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operations_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operations_client.go index a918a38ab518..4d70bf746e4c 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operations_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/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,9 +34,9 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO return client, nil } -// NewListPager - Gets the operations. +// NewListPager - List the operations for the provider // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -65,14 +62,14 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption } // listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.DataReplication/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operations_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operations_client_example_test.go deleted file mode 100644 index d455e99cc3d3..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operations_client_example_test.go +++ /dev/null @@ -1,58 +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 armrecoveryservicesdatareplication_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Operations_List.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.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 = armrecoveryservicesdatareplication.OperationListResult{ - // Value: []*armrecoveryservicesdatareplication.Operation{ - // { - // Name: to.Ptr("chktcqashuxscvbp"), - // ActionType: to.Ptr(armrecoveryservicesdatareplication.ActionTypeInternal), - // Display: &armrecoveryservicesdatareplication.OperationDisplay{ - // Description: to.Ptr("bjdvnagzxjandxcbcrf"), - // Operation: to.Ptr("dfal"), - // Provider: to.Ptr("yembewkfmaq"), - // Resource: to.Ptr("epyscqvmqhxbwgyqhzeaumpor"), - // }, - // IsDataAction: to.Ptr(true), - // Origin: to.Ptr(armrecoveryservicesdatareplication.OriginUser), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/options.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/options.go index a802a5622ecd..d9ffa31056ca 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/options.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/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. @@ -8,47 +5,18 @@ package armrecoveryservicesdatareplication -// AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityOptions contains the optional parameters for the AzureSiteRecoveryManagementServiceAPIClient.CheckNameAvailability -// method. -type AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityOptions struct { +// CheckNameAvailabilityClientPostOptions contains the optional parameters for the CheckNameAvailabilityClient.Post method. +type CheckNameAvailabilityClientPostOptions struct { // Resource details. Body *CheckNameAvailabilityModel } -// AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightOptions contains the optional parameters for the AzureSiteRecoveryManagementServiceAPIClient.DeploymentPreflight -// method. -type AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightOptions struct { +// DeploymentPreflightClientPostOptions contains the optional parameters for the DeploymentPreflightClient.Post method. +type DeploymentPreflightClientPostOptions struct { // Deployment preflight model. Body *DeploymentPreflightModel } -// DraClientBeginCreateOptions contains the optional parameters for the DraClient.BeginCreate method. -type DraClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DraClientBeginDeleteOptions contains the optional parameters for the DraClient.BeginDelete method. -type DraClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DraClientGetOptions contains the optional parameters for the DraClient.Get method. -type DraClientGetOptions struct { - // placeholder for future optional parameters -} - -// DraClientListOptions contains the optional parameters for the DraClient.NewListPager method. -type DraClientListOptions struct { - // placeholder for future optional parameters -} - -// DraOperationStatusClientGetOptions contains the optional parameters for the DraOperationStatusClient.Get method. -type DraOperationStatusClientGetOptions struct { - // placeholder for future optional parameters -} - // EmailConfigurationClientCreateOptions contains the optional parameters for the EmailConfigurationClient.Create method. type EmailConfigurationClientCreateOptions struct { // placeholder for future optional parameters @@ -74,25 +42,50 @@ type EventClientListOptions struct { // Continuation token. ContinuationToken *string - // Filter string. - Filter *string + // OData options. + ODataOptions *string + + // Page size. + PageSize *int32 +} + +// FabricAgentClientBeginCreateOptions contains the optional parameters for the FabricAgentClient.BeginCreate method. +type FabricAgentClientBeginCreateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FabricAgentClientBeginDeleteOptions contains the optional parameters for the FabricAgentClient.BeginDelete method. +type FabricAgentClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FabricAgentClientGetOptions contains the optional parameters for the FabricAgentClient.Get method. +type FabricAgentClientGetOptions struct { + // placeholder for future optional parameters +} + +// FabricAgentClientListOptions contains the optional parameters for the FabricAgentClient.NewListPager method. +type FabricAgentClientListOptions struct { + // placeholder for future optional parameters } // FabricClientBeginCreateOptions contains the optional parameters for the FabricClient.BeginCreate method. type FabricClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // FabricClientBeginDeleteOptions contains the optional parameters for the FabricClient.BeginDelete method. type FabricClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // FabricClientBeginUpdateOptions contains the optional parameters for the FabricClient.BeginUpdate method. type FabricClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -104,8 +97,7 @@ type FabricClientGetOptions struct { // FabricClientListBySubscriptionOptions contains the optional parameters for the FabricClient.NewListBySubscriptionPager // method. type FabricClientListBySubscriptionOptions struct { - // Continuation token from the previous call. - ContinuationToken *string + // placeholder for future optional parameters } // FabricClientListOptions contains the optional parameters for the FabricClient.NewListPager method. @@ -114,8 +106,31 @@ type FabricClientListOptions struct { ContinuationToken *string } -// FabricOperationsStatusClientGetOptions contains the optional parameters for the FabricOperationsStatusClient.Get method. -type FabricOperationsStatusClientGetOptions struct { +// JobClientGetOptions contains the optional parameters for the JobClient.Get method. +type JobClientGetOptions struct { + // placeholder for future optional parameters +} + +// JobClientListOptions contains the optional parameters for the JobClient.NewListPager method. +type JobClientListOptions struct { + // Continuation token. + ContinuationToken *string + + // OData options. + ODataOptions *string + + // Page size. + PageSize *int32 +} + +// LocationBasedOperationResultsClientGetOptions contains the optional parameters for the LocationBasedOperationResultsClient.Get +// method. +type LocationBasedOperationResultsClientGetOptions struct { + // placeholder for future optional parameters +} + +// OperationResultsClientGetOptions contains the optional parameters for the OperationResultsClient.Get method. +type OperationResultsClientGetOptions struct { // placeholder for future optional parameters } @@ -126,13 +141,13 @@ type OperationsClientListOptions struct { // PolicyClientBeginCreateOptions contains the optional parameters for the PolicyClient.BeginCreate method. type PolicyClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // PolicyClientBeginDeleteOptions contains the optional parameters for the PolicyClient.BeginDelete method. type PolicyClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -146,14 +161,76 @@ type PolicyClientListOptions struct { // placeholder for future optional parameters } -// PolicyOperationStatusClientGetOptions contains the optional parameters for the PolicyOperationStatusClient.Get method. -type PolicyOperationStatusClientGetOptions struct { +// PrivateEndpointConnectionProxiesClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.BeginDelete +// method. +type PrivateEndpointConnectionProxiesClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionProxiesClientCreateOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.Create +// method. +type PrivateEndpointConnectionProxiesClientCreateOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionProxiesClientGetOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.Get +// method. +type PrivateEndpointConnectionProxiesClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionProxiesClientListOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.NewListPager +// method. +type PrivateEndpointConnectionProxiesClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionProxiesClientValidateOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.Validate +// method. +type PrivateEndpointConnectionProxiesClientValidateOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. +type PrivateEndpointConnectionsClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +type PrivateEndpointConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager +// method. +type PrivateEndpointConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Update +// method. +type PrivateEndpointConnectionsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get method. +type PrivateLinkResourcesClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListPager +// method. +type PrivateLinkResourcesClientListOptions struct { // placeholder for future optional parameters } // ProtectedItemClientBeginCreateOptions contains the optional parameters for the ProtectedItemClient.BeginCreate method. type ProtectedItemClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -162,17 +239,20 @@ type ProtectedItemClientBeginDeleteOptions struct { // A flag indicating whether to do force delete or not. ForceDelete *bool - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ProtectedItemClientBeginPlannedFailoverOptions contains the optional parameters for the ProtectedItemClient.BeginPlannedFailover // method. type ProtectedItemClientBeginPlannedFailoverOptions struct { - // Planned failover model. - Body *PlannedFailoverModel + // Resumes the long-running operation from the provided token. + ResumeToken string +} - // Resumes the LRO from the provided token. +// ProtectedItemClientBeginUpdateOptions contains the optional parameters for the ProtectedItemClient.BeginUpdate method. +type ProtectedItemClientBeginUpdateOptions struct { + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -183,36 +263,37 @@ type ProtectedItemClientGetOptions struct { // ProtectedItemClientListOptions contains the optional parameters for the ProtectedItemClient.NewListPager method. type ProtectedItemClientListOptions struct { - // placeholder for future optional parameters -} + // Continuation token. + ContinuationToken *string -// ProtectedItemOperationStatusClientGetOptions contains the optional parameters for the ProtectedItemOperationStatusClient.Get -// method. -type ProtectedItemOperationStatusClientGetOptions struct { - // placeholder for future optional parameters + // OData options. + ODataOptions *string + + // Page size. + PageSize *int32 } -// RecoveryPointsClientGetOptions contains the optional parameters for the RecoveryPointsClient.Get method. -type RecoveryPointsClientGetOptions struct { +// RecoveryPointClientGetOptions contains the optional parameters for the RecoveryPointClient.Get method. +type RecoveryPointClientGetOptions struct { // placeholder for future optional parameters } -// RecoveryPointsClientListOptions contains the optional parameters for the RecoveryPointsClient.NewListPager method. -type RecoveryPointsClientListOptions struct { +// RecoveryPointClientListOptions contains the optional parameters for the RecoveryPointClient.NewListPager method. +type RecoveryPointClientListOptions struct { // placeholder for future optional parameters } // ReplicationExtensionClientBeginCreateOptions contains the optional parameters for the ReplicationExtensionClient.BeginCreate // method. type ReplicationExtensionClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ReplicationExtensionClientBeginDeleteOptions contains the optional parameters for the ReplicationExtensionClient.BeginDelete // method. type ReplicationExtensionClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -227,27 +308,21 @@ type ReplicationExtensionClientListOptions struct { // placeholder for future optional parameters } -// ReplicationExtensionOperationStatusClientGetOptions contains the optional parameters for the ReplicationExtensionOperationStatusClient.Get -// method. -type ReplicationExtensionOperationStatusClientGetOptions struct { - // placeholder for future optional parameters -} - // VaultClientBeginCreateOptions contains the optional parameters for the VaultClient.BeginCreate method. type VaultClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // VaultClientBeginDeleteOptions contains the optional parameters for the VaultClient.BeginDelete method. type VaultClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // VaultClientBeginUpdateOptions contains the optional parameters for the VaultClient.BeginUpdate method. type VaultClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -258,8 +333,7 @@ type VaultClientGetOptions struct { // VaultClientListBySubscriptionOptions contains the optional parameters for the VaultClient.NewListBySubscriptionPager method. type VaultClientListBySubscriptionOptions struct { - // Continuation token from the previous call. - ContinuationToken *string + // placeholder for future optional parameters } // VaultClientListOptions contains the optional parameters for the VaultClient.NewListPager method. @@ -267,27 +341,3 @@ type VaultClientListOptions struct { // Continuation token from the previous call. ContinuationToken *string } - -// VaultOperationStatusClientGetOptions contains the optional parameters for the VaultOperationStatusClient.Get method. -type VaultOperationStatusClientGetOptions struct { - // placeholder for future optional parameters -} - -// WorkflowClientGetOptions contains the optional parameters for the WorkflowClient.Get method. -type WorkflowClientGetOptions struct { - // placeholder for future optional parameters -} - -// WorkflowClientListOptions contains the optional parameters for the WorkflowClient.NewListPager method. -type WorkflowClientListOptions struct { - // Continuation token. - ContinuationToken *string - - // Filter string. - Filter *string -} - -// WorkflowOperationStatusClientGetOptions contains the optional parameters for the WorkflowOperationStatusClient.Get method. -type WorkflowOperationStatusClientGetOptions struct { - // placeholder for future optional parameters -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policy_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policy_client.go index 9917eb0a2277..b9bea5f55923 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policy_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policy_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. @@ -46,7 +43,7 @@ func NewPolicyClient(subscriptionID string, credential azcore.TokenCredential, o // BeginCreate - Creates the policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - policyName - The policy name. @@ -59,7 +56,7 @@ func (client *PolicyClient) BeginCreate(ctx context.Context, resourceGroupName s return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PolicyClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, Tracer: client.internal.Tracer(), }) return poller, err @@ -73,7 +70,7 @@ func (client *PolicyClient) BeginCreate(ctx context.Context, resourceGroupName s // Create - Creates the policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 func (client *PolicyClient) create(ctx context.Context, resourceGroupName string, vaultName string, policyName string, body PolicyModel, options *PolicyClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "PolicyClient.BeginCreate" @@ -96,7 +93,7 @@ func (client *PolicyClient) create(ctx context.Context, resourceGroupName string } // createCreateRequest creates the Create request. -func (client *PolicyClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, policyName string, body PolicyModel, options *PolicyClientBeginCreateOptions) (*policy.Request, error) { +func (client *PolicyClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, policyName string, body PolicyModel, _ *PolicyClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -119,7 +116,7 @@ func (client *PolicyClient) createCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -131,7 +128,7 @@ func (client *PolicyClient) createCreateRequest(ctx context.Context, resourceGro // BeginDelete - Removes the policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - policyName - The policy name. @@ -157,7 +154,7 @@ func (client *PolicyClient) BeginDelete(ctx context.Context, resourceGroupName s // Delete - Removes the policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 func (client *PolicyClient) deleteOperation(ctx context.Context, resourceGroupName string, vaultName string, policyName string, options *PolicyClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PolicyClient.BeginDelete" @@ -180,7 +177,7 @@ func (client *PolicyClient) deleteOperation(ctx context.Context, resourceGroupNa } // deleteCreateRequest creates the Delete request. -func (client *PolicyClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, policyName string, options *PolicyClientBeginDeleteOptions) (*policy.Request, error) { +func (client *PolicyClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, policyName string, _ *PolicyClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -203,7 +200,7 @@ func (client *PolicyClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -212,7 +209,7 @@ func (client *PolicyClient) deleteCreateRequest(ctx context.Context, resourceGro // Get - Gets the details of the policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - policyName - The policy name. @@ -240,7 +237,7 @@ func (client *PolicyClient) Get(ctx context.Context, resourceGroupName string, v } // getCreateRequest creates the Get request. -func (client *PolicyClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, policyName string, options *PolicyClientGetOptions) (*policy.Request, error) { +func (client *PolicyClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, policyName string, _ *PolicyClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -263,7 +260,7 @@ func (client *PolicyClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -280,7 +277,7 @@ func (client *PolicyClient) getHandleResponse(resp *http.Response) (PolicyClient // NewListPager - Gets the list of policies in the given vault. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - options - PolicyClientListOptions contains the optional parameters for the PolicyClient.NewListPager method. @@ -308,7 +305,7 @@ func (client *PolicyClient) NewListPager(resourceGroupName string, vaultName str } // listCreateRequest creates the List request. -func (client *PolicyClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *PolicyClientListOptions) (*policy.Request, error) { +func (client *PolicyClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, _ *PolicyClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -327,7 +324,7 @@ func (client *PolicyClient) listCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -336,7 +333,7 @@ func (client *PolicyClient) listCreateRequest(ctx context.Context, resourceGroup // listHandleResponse handles the List response. func (client *PolicyClient) listHandleResponse(resp *http.Response) (PolicyClientListResponse, error) { result := PolicyClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PolicyModelCollection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.PolicyModelListResult); err != nil { return PolicyClientListResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policy_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policy_client_example_test.go deleted file mode 100644 index b1c2cb3b8c9e..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policy_client_example_test.go +++ /dev/null @@ -1,175 +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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Policy_Get.json -func ExamplePolicyClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPolicyClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "wdqsacasc", 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.PolicyModel = armrecoveryservicesdatareplication.PolicyModel{ - // Name: to.Ptr("ocmty"), - // Type: to.Ptr("pvltqld"), - // ID: to.Ptr("ffivjzdtqgguqlenedikvdilazliwm"), - // Properties: &armrecoveryservicesdatareplication.PolicyModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.PolicyModelCustomProperties{ - // InstanceType: to.Ptr("PolicyModelCustomProperties"), - // }, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // }, - // SystemData: &armrecoveryservicesdatareplication.PolicyModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:54.713Z"); return t}()), - // CreatedBy: to.Ptr("yiaelkrpuzsfumovsxeb"), - // CreatedByType: to.Ptr("qwzrkjsfloruegijrfnfpn"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:54.713Z"); return t}()), - // LastModifiedBy: to.Ptr("xy"), - // LastModifiedByType: to.Ptr("rnc"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Policy_Create.json -func ExamplePolicyClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPolicyClient().BeginCreate(ctx, "rgrecoveryservicesdatareplication", "4", "fafqwc", armrecoveryservicesdatareplication.PolicyModel{ - Properties: &armrecoveryservicesdatareplication.PolicyModelProperties{ - CustomProperties: &armrecoveryservicesdatareplication.PolicyModelCustomProperties{ - InstanceType: to.Ptr("PolicyModelCustomProperties"), - }, - }, - }, 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.PolicyModel = armrecoveryservicesdatareplication.PolicyModel{ - // Name: to.Ptr("ocmty"), - // Type: to.Ptr("pvltqld"), - // ID: to.Ptr("ffivjzdtqgguqlenedikvdilazliwm"), - // Properties: &armrecoveryservicesdatareplication.PolicyModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.PolicyModelCustomProperties{ - // InstanceType: to.Ptr("PolicyModelCustomProperties"), - // }, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // }, - // SystemData: &armrecoveryservicesdatareplication.PolicyModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:54.713Z"); return t}()), - // CreatedBy: to.Ptr("yiaelkrpuzsfumovsxeb"), - // CreatedByType: to.Ptr("qwzrkjsfloruegijrfnfpn"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:54.713Z"); return t}()), - // LastModifiedBy: to.Ptr("xy"), - // LastModifiedByType: to.Ptr("rnc"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Policy_Delete.json -func ExamplePolicyClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewPolicyClient().BeginDelete(ctx, "rgrecoveryservicesdatareplication", "4", "wqfscsdv", 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/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Policy_List.json -func ExamplePolicyClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewPolicyClient().NewListPager("rgrecoveryservicesdatareplication", "4", 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.PolicyModelCollection = armrecoveryservicesdatareplication.PolicyModelCollection{ - // Value: []*armrecoveryservicesdatareplication.PolicyModel{ - // { - // Name: to.Ptr("ocmty"), - // Type: to.Ptr("pvltqld"), - // ID: to.Ptr("ffivjzdtqgguqlenedikvdilazliwm"), - // Properties: &armrecoveryservicesdatareplication.PolicyModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.PolicyModelCustomProperties{ - // InstanceType: to.Ptr("PolicyModelCustomProperties"), - // }, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // }, - // SystemData: &armrecoveryservicesdatareplication.PolicyModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:54.713Z"); return t}()), - // CreatedBy: to.Ptr("yiaelkrpuzsfumovsxeb"), - // CreatedByType: to.Ptr("qwzrkjsfloruegijrfnfpn"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:54.713Z"); return t}()), - // LastModifiedBy: to.Ptr("xy"), - // LastModifiedByType: to.Ptr("rnc"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policyoperationstatus_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policyoperationstatus_client.go deleted file mode 100644 index 14244c942f19..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policyoperationstatus_client.go +++ /dev/null @@ -1,119 +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 armrecoveryservicesdatareplication - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// PolicyOperationStatusClient contains the methods for the PolicyOperationStatus group. -// Don't use this type directly, use NewPolicyOperationStatusClient() instead. -type PolicyOperationStatusClient struct { - internal *arm.Client - subscriptionID string -} - -// NewPolicyOperationStatusClient creates a new instance of PolicyOperationStatusClient with the specified values. -// - subscriptionID - The ID of the target subscription. The value must be an UUID. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewPolicyOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PolicyOperationStatusClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &PolicyOperationStatusClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Tracks the results of an asynchronous operation on the policy. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-02-16-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - vaultName - The vault name. -// - policyName - The policy name. -// - operationID - The ID of an ongoing async operation. -// - options - PolicyOperationStatusClientGetOptions contains the optional parameters for the PolicyOperationStatusClient.Get -// method. -func (client *PolicyOperationStatusClient) Get(ctx context.Context, resourceGroupName string, vaultName string, policyName string, operationID string, options *PolicyOperationStatusClientGetOptions) (PolicyOperationStatusClientGetResponse, error) { - var err error - const operationName = "PolicyOperationStatusClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, policyName, operationID, options) - if err != nil { - return PolicyOperationStatusClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PolicyOperationStatusClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PolicyOperationStatusClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *PolicyOperationStatusClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, policyName string, operationID string, options *PolicyOperationStatusClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}/operations/{operationId}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - if policyName == "" { - return nil, errors.New("parameter policyName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{policyName}", url.PathEscape(policyName)) - if operationID == "" { - return nil, errors.New("parameter operationID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *PolicyOperationStatusClient) getHandleResponse(resp *http.Response) (PolicyOperationStatusClientGetResponse, error) { - result := PolicyOperationStatusClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return PolicyOperationStatusClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policyoperationstatus_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policyoperationstatus_client_example_test.go deleted file mode 100644 index a1f17fb1c935..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policyoperationstatus_client_example_test.go +++ /dev/null @@ -1,45 +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 armrecoveryservicesdatareplication_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/PolicyOperationStatus_Get.json -func ExamplePolicyOperationStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPolicyOperationStatusClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "xczxcwec", "wdqfsdxv", 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.OperationStatus = armrecoveryservicesdatareplication.OperationStatus{ - // Name: to.Ptr("wzdasptnwlxgobklayoqapjcgcf"), - // EndTime: to.Ptr("nauyrfh"), - // ID: to.Ptr("sf"), - // StartTime: to.Ptr("xuzwmfrhluafmwwsmzqxsytyehsh"), - // Status: to.Ptr("plbnngzfppdram"), - // } -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/polymorphic_helpers.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/polymorphic_helpers.go index 286a31af02aa..4ef287374b6b 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/polymorphic_helpers.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/polymorphic_helpers.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,20 +7,22 @@ package armrecoveryservicesdatareplication import "encoding/json" -func unmarshalDraModelCustomPropertiesClassification(rawMsg json.RawMessage) (DraModelCustomPropertiesClassification, error) { - if rawMsg == nil { +func unmarshalEventModelCustomPropertiesClassification(rawMsg json.RawMessage) (EventModelCustomPropertiesClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } - var b DraModelCustomPropertiesClassification + var b EventModelCustomPropertiesClassification switch m["instanceType"] { - case "VMware": - b = &VMwareDraModelCustomProperties{} + case "HyperVToAzStackHCI": + b = &HyperVToAzStackHCIEventModelCustomProperties{} + case "VMwareToAzStackHCI": + b = &VMwareToAzStackHCIEventModelCustomProperties{} default: - b = &DraModelCustomProperties{} + b = &EventModelCustomProperties{} } if err := json.Unmarshal(rawMsg, b); err != nil { return nil, err @@ -31,20 +30,20 @@ func unmarshalDraModelCustomPropertiesClassification(rawMsg json.RawMessage) (Dr return b, nil } -func unmarshalEventModelCustomPropertiesClassification(rawMsg json.RawMessage) (EventModelCustomPropertiesClassification, error) { - if rawMsg == nil { +func unmarshalFabricAgentModelCustomPropertiesClassification(rawMsg json.RawMessage) (FabricAgentModelCustomPropertiesClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } - var b EventModelCustomPropertiesClassification + var b FabricAgentModelCustomPropertiesClassification switch m["instanceType"] { - case "HyperVToAzStackHCI": - b = &HyperVToAzStackHCIEventModelCustomProperties{} + case "VMware": + b = &VMwareFabricAgentModelCustomProperties{} default: - b = &EventModelCustomProperties{} + b = &FabricAgentModelCustomProperties{} } if err := json.Unmarshal(rawMsg, b); err != nil { return nil, err @@ -53,7 +52,7 @@ func unmarshalEventModelCustomPropertiesClassification(rawMsg json.RawMessage) ( } func unmarshalFabricModelCustomPropertiesClassification(rawMsg json.RawMessage) (FabricModelCustomPropertiesClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -77,8 +76,33 @@ func unmarshalFabricModelCustomPropertiesClassification(rawMsg json.RawMessage) return b, nil } +func unmarshalJobModelCustomPropertiesClassification(rawMsg json.RawMessage) (JobModelCustomPropertiesClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b JobModelCustomPropertiesClassification + switch m["instanceType"] { + case "FailoverJobDetails": + b = &FailoverJobModelCustomProperties{} + case "TestFailoverCleanupJobDetails": + b = &TestFailoverCleanupJobModelCustomProperties{} + case "TestFailoverJobDetails": + b = &TestFailoverJobModelCustomProperties{} + default: + b = &JobModelCustomProperties{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} + func unmarshalPlannedFailoverModelCustomPropertiesClassification(rawMsg json.RawMessage) (PlannedFailoverModelCustomPropertiesClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -101,7 +125,7 @@ func unmarshalPlannedFailoverModelCustomPropertiesClassification(rawMsg json.Raw } func unmarshalPolicyModelCustomPropertiesClassification(rawMsg json.RawMessage) (PolicyModelCustomPropertiesClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -124,7 +148,7 @@ func unmarshalPolicyModelCustomPropertiesClassification(rawMsg json.RawMessage) } func unmarshalProtectedItemModelCustomPropertiesClassification(rawMsg json.RawMessage) (ProtectedItemModelCustomPropertiesClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -146,20 +170,22 @@ func unmarshalProtectedItemModelCustomPropertiesClassification(rawMsg json.RawMe return b, nil } -func unmarshalRecoveryPointModelCustomPropertiesClassification(rawMsg json.RawMessage) (RecoveryPointModelCustomPropertiesClassification, error) { - if rawMsg == nil { +func unmarshalProtectedItemModelCustomPropertiesUpdateClassification(rawMsg json.RawMessage) (ProtectedItemModelCustomPropertiesUpdateClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } - var b RecoveryPointModelCustomPropertiesClassification + var b ProtectedItemModelCustomPropertiesUpdateClassification switch m["instanceType"] { case "HyperVToAzStackHCI": - b = &HyperVToAzStackHCIRecoveryPointModelCustomProperties{} + b = &HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate{} + case "VMwareToAzStackHCI": + b = &VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate{} default: - b = &RecoveryPointModelCustomProperties{} + b = &ProtectedItemModelCustomPropertiesUpdate{} } if err := json.Unmarshal(rawMsg, b); err != nil { return nil, err @@ -167,22 +193,22 @@ func unmarshalRecoveryPointModelCustomPropertiesClassification(rawMsg json.RawMe return b, nil } -func unmarshalReplicationExtensionModelCustomPropertiesClassification(rawMsg json.RawMessage) (ReplicationExtensionModelCustomPropertiesClassification, error) { - if rawMsg == nil { +func unmarshalRecoveryPointModelCustomPropertiesClassification(rawMsg json.RawMessage) (RecoveryPointModelCustomPropertiesClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } - var b ReplicationExtensionModelCustomPropertiesClassification + var b RecoveryPointModelCustomPropertiesClassification switch m["instanceType"] { case "HyperVToAzStackHCI": - b = &HyperVToAzStackHCIReplicationExtensionModelCustomProperties{} - case "VMwareToAzStackHCI": - b = &VMwareToAzStackHCIReplicationExtensionModelCustomProperties{} + b = &HyperVToAzStackHCIRecoveryPointModelCustomProperties{} + case "VMwareToAzStackHCIRecoveryPointModelCustomProperties": + b = &VMwareToAzStackHCIRecoveryPointModelCustomProperties{} default: - b = &ReplicationExtensionModelCustomProperties{} + b = &RecoveryPointModelCustomProperties{} } if err := json.Unmarshal(rawMsg, b); err != nil { return nil, err @@ -190,24 +216,22 @@ func unmarshalReplicationExtensionModelCustomPropertiesClassification(rawMsg jso return b, nil } -func unmarshalWorkflowModelCustomPropertiesClassification(rawMsg json.RawMessage) (WorkflowModelCustomPropertiesClassification, error) { - if rawMsg == nil { +func unmarshalReplicationExtensionModelCustomPropertiesClassification(rawMsg json.RawMessage) (ReplicationExtensionModelCustomPropertiesClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } - var b WorkflowModelCustomPropertiesClassification + var b ReplicationExtensionModelCustomPropertiesClassification switch m["instanceType"] { - case "FailoverWorkflowDetails": - b = &FailoverWorkflowModelCustomProperties{} - case "TestFailoverCleanupWorkflowDetails": - b = &TestFailoverCleanupWorkflowModelCustomProperties{} - case "TestFailoverWorkflowDetails": - b = &TestFailoverWorkflowModelCustomProperties{} + case "HyperVToAzStackHCI": + b = &HyperVToAzStackHCIReplicationExtensionModelCustomProperties{} + case "VMwareToAzStackHCI": + b = &VMwareToAzStackHCIReplicationExtensionModelCustomProperties{} default: - b = &WorkflowModelCustomProperties{} + b = &ReplicationExtensionModelCustomProperties{} } if err := json.Unmarshal(rawMsg, b); err != nil { return nil, err diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnectionproxies_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnectionproxies_client.go new file mode 100644 index 000000000000..349e8d7b1286 --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnectionproxies_client.go @@ -0,0 +1,407 @@ +// 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 armrecoveryservicesdatareplication + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// PrivateEndpointConnectionProxiesClient contains the methods for the PrivateEndpointConnectionProxies group. +// Don't use this type directly, use NewPrivateEndpointConnectionProxiesClient() instead. +type PrivateEndpointConnectionProxiesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPrivateEndpointConnectionProxiesClient creates a new instance of PrivateEndpointConnectionProxiesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewPrivateEndpointConnectionProxiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionProxiesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrivateEndpointConnectionProxiesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Create a new private endpoint connection proxy which includes both auto and manual approval types. Creating the +// proxy resource will also create a private endpoint connection resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The vault name. +// - privateEndpointConnectionProxyName - The private endpoint connection proxy name. +// - body - Private endpoint connection creation input. +// - options - PrivateEndpointConnectionProxiesClientCreateOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.Create +// method. +func (client *PrivateEndpointConnectionProxiesClient) Create(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, body PrivateEndpointConnectionProxy, options *PrivateEndpointConnectionProxiesClientCreateOptions) (PrivateEndpointConnectionProxiesClientCreateResponse, error) { + var err error + const operationName = "PrivateEndpointConnectionProxiesClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, vaultName, privateEndpointConnectionProxyName, body, options) + if err != nil { + return PrivateEndpointConnectionProxiesClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionProxiesClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionProxiesClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *PrivateEndpointConnectionProxiesClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, body PrivateEndpointConnectionProxy, _ *PrivateEndpointConnectionProxiesClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnectionProxies/{privateEndpointConnectionProxyName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + if privateEndpointConnectionProxyName == "" { + return nil, errors.New("parameter privateEndpointConnectionProxyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionProxyName}", url.PathEscape(privateEndpointConnectionProxyName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *PrivateEndpointConnectionProxiesClient) createHandleResponse(resp *http.Response) (PrivateEndpointConnectionProxiesClientCreateResponse, error) { + result := PrivateEndpointConnectionProxiesClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionProxy); err != nil { + return PrivateEndpointConnectionProxiesClientCreateResponse{}, err + } + return result, nil +} + +// BeginDelete - Returns the operation to track the deletion of private endpoint connection proxy. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The vault name. +// - privateEndpointConnectionProxyName - The private endpoint connection proxy name. +// - options - PrivateEndpointConnectionProxiesClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.BeginDelete +// method. +func (client *PrivateEndpointConnectionProxiesClient) BeginDelete(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, options *PrivateEndpointConnectionProxiesClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionProxiesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, vaultName, privateEndpointConnectionProxyName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionProxiesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateEndpointConnectionProxiesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Returns the operation to track the deletion of private endpoint connection proxy. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +func (client *PrivateEndpointConnectionProxiesClient) deleteOperation(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, options *PrivateEndpointConnectionProxiesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "PrivateEndpointConnectionProxiesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, vaultName, privateEndpointConnectionProxyName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PrivateEndpointConnectionProxiesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, _ *PrivateEndpointConnectionProxiesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnectionProxies/{privateEndpointConnectionProxyName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + if privateEndpointConnectionProxyName == "" { + return nil, errors.New("parameter privateEndpointConnectionProxyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionProxyName}", url.PathEscape(privateEndpointConnectionProxyName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the private endpoint connection proxy details. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The vault name. +// - privateEndpointConnectionProxyName - The private endpoint connection proxy name. +// - options - PrivateEndpointConnectionProxiesClientGetOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.Get +// method. +func (client *PrivateEndpointConnectionProxiesClient) Get(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, options *PrivateEndpointConnectionProxiesClientGetOptions) (PrivateEndpointConnectionProxiesClientGetResponse, error) { + var err error + const operationName = "PrivateEndpointConnectionProxiesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, privateEndpointConnectionProxyName, options) + if err != nil { + return PrivateEndpointConnectionProxiesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionProxiesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionProxiesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *PrivateEndpointConnectionProxiesClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, _ *PrivateEndpointConnectionProxiesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnectionProxies/{privateEndpointConnectionProxyName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + if privateEndpointConnectionProxyName == "" { + return nil, errors.New("parameter privateEndpointConnectionProxyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionProxyName}", url.PathEscape(privateEndpointConnectionProxyName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateEndpointConnectionProxiesClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionProxiesClientGetResponse, error) { + result := PrivateEndpointConnectionProxiesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionProxy); err != nil { + return PrivateEndpointConnectionProxiesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets the all private endpoint connections proxies. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The vault name. +// - options - PrivateEndpointConnectionProxiesClientListOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.NewListPager +// method. +func (client *PrivateEndpointConnectionProxiesClient) NewListPager(resourceGroupName string, vaultName string, options *PrivateEndpointConnectionProxiesClientListOptions) *runtime.Pager[PrivateEndpointConnectionProxiesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateEndpointConnectionProxiesClientListResponse]{ + More: func(page PrivateEndpointConnectionProxiesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionProxiesClientListResponse) (PrivateEndpointConnectionProxiesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateEndpointConnectionProxiesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, vaultName, options) + }, nil) + if err != nil { + return PrivateEndpointConnectionProxiesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *PrivateEndpointConnectionProxiesClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, _ *PrivateEndpointConnectionProxiesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnectionProxies" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PrivateEndpointConnectionProxiesClient) listHandleResponse(resp *http.Response) (PrivateEndpointConnectionProxiesClientListResponse, error) { + result := PrivateEndpointConnectionProxiesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionProxyListResult); err != nil { + return PrivateEndpointConnectionProxiesClientListResponse{}, err + } + return result, nil +} + +// Validate - Returns remote private endpoint connection information after validation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The vault name. +// - privateEndpointConnectionProxyName - The private endpoint connection proxy name. +// - body - The private endpoint connection proxy input. +// - options - PrivateEndpointConnectionProxiesClientValidateOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.Validate +// method. +func (client *PrivateEndpointConnectionProxiesClient) Validate(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, body PrivateEndpointConnectionProxy, options *PrivateEndpointConnectionProxiesClientValidateOptions) (PrivateEndpointConnectionProxiesClientValidateResponse, error) { + var err error + const operationName = "PrivateEndpointConnectionProxiesClient.Validate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.validateCreateRequest(ctx, resourceGroupName, vaultName, privateEndpointConnectionProxyName, body, options) + if err != nil { + return PrivateEndpointConnectionProxiesClientValidateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionProxiesClientValidateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionProxiesClientValidateResponse{}, err + } + resp, err := client.validateHandleResponse(httpResp) + return resp, err +} + +// validateCreateRequest creates the Validate request. +func (client *PrivateEndpointConnectionProxiesClient) validateCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, body PrivateEndpointConnectionProxy, _ *PrivateEndpointConnectionProxiesClientValidateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnectionProxies/{privateEndpointConnectionProxyName}/validate" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + if privateEndpointConnectionProxyName == "" { + return nil, errors.New("parameter privateEndpointConnectionProxyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionProxyName}", url.PathEscape(privateEndpointConnectionProxyName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// validateHandleResponse handles the Validate response. +func (client *PrivateEndpointConnectionProxiesClient) validateHandleResponse(resp *http.Response) (PrivateEndpointConnectionProxiesClientValidateResponse, error) { + result := PrivateEndpointConnectionProxiesClientValidateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionProxy); err != nil { + return PrivateEndpointConnectionProxiesClientValidateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnections_client.go similarity index 54% rename from sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnections_client.go index 140bdc5484a6..8273cbb34824 100644 --- a/sdk/resourcemanager/monitor/armmonitor/privateendpointconnections_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnections_client.go @@ -1,12 +1,9 @@ -//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 armmonitor +package armrecoveryservicesdatareplication import ( "context" @@ -28,7 +25,7 @@ type PrivateEndpointConnectionsClient struct { } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient 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 NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { @@ -43,43 +40,44 @@ func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcor return client, nil } -// BeginCreateOrUpdate - Approve or reject a private endpoint connection with a given name. +// BeginDelete - Deletes the private endpoint connection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-07-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// - privateEndpointConnectionName - The name of the private endpoint connection. -// - options - PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate +// - vaultName - The vault name. +// - privateEndpointConnectionName - The private endpoint connection name. +// - options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete // method. -func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[PrivateEndpointConnectionsClientCreateOrUpdateResponse], error) { +func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, scopeName, privateEndpointConnectionName, parameters, options) + resp, err := client.deleteOperation(ctx, resourceGroupName, vaultName, privateEndpointConnectionName, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateEndpointConnectionsClientCreateOrUpdateResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateEndpointConnectionsClientDeleteResponse]{ Tracer: client.internal.Tracer(), }) } } -// CreateOrUpdate - Approve or reject a private endpoint connection with a given name. +// Delete - Deletes the private endpoint connection. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-07-01-preview -func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { var err error - const operationName = "PrivateEndpointConnectionsClient.BeginCreateOrUpdate" + const operationName = "PrivateEndpointConnectionsClient.BeginDelete" 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, scopeName, privateEndpointConnectionName, parameters, options) + req, err := client.deleteCreateRequest(ctx, resourceGroupName, vaultName, privateEndpointConnectionName, options) if err != nil { return nil, err } @@ -87,16 +85,16 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Conte if err != nil { return nil, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { err = runtime.NewResponseError(httpResp) return nil, err } return httpResp, nil } -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, parameters PrivateEndpointConnection, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}" +// deleteCreateRequest creates the Delete request. +func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, _ *PrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -105,82 +103,59 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if scopeName == "" { - return nil, errors.New("parameter scopeName cannot be empty") + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) if privateEndpointConnectionName == "" { return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, parameters); err != nil { - return nil, err - } return req, nil } -// BeginDelete - Deletes a private endpoint connection with a given name. +// Get - Gets the private endpoint connection details. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-07-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// - privateEndpointConnectionName - The name of the private endpoint connection. -// - options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// - vaultName - The vault name. +// - privateEndpointConnectionName - The private endpoint connection name. +// - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get // method. -func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.deleteOperation(ctx, resourceGroupName, scopeName, privateEndpointConnectionName, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientDeleteResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateEndpointConnectionsClientDeleteResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Delete - Deletes a private endpoint connection with a given name. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-07-01-preview -func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { +func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { var err error - const operationName = "PrivateEndpointConnectionsClient.BeginDelete" + const operationName = "PrivateEndpointConnectionsClient.Get" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, scopeName, privateEndpointConnectionName, options) + req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, privateEndpointConnectionName, options) if err != nil { - return nil, err + return PrivateEndpointConnectionsClientGetResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return nil, err + return PrivateEndpointConnectionsClientGetResponse{}, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return nil, err + return PrivateEndpointConnectionsClientGetResponse{}, err } - return httpResp, nil + resp, err := client.getHandleResponse(httpResp) + return resp, err } -// deleteCreateRequest creates the Delete request. -func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}" +// getCreateRequest creates the Get request. +func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, _ *PrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -189,59 +164,67 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if scopeName == "" { - return nil, errors.New("parameter scopeName cannot be empty") + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) if privateEndpointConnectionName == "" { return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// Get - Gets a private endpoint connection. -// If the operation fails it returns an *azcore.ResponseError type. +// getHandleResponse handles the Get response. +func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientGetResponse, error) { + result := PrivateEndpointConnectionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return PrivateEndpointConnectionsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets the all private endpoint connections configured on the vault. // -// Generated from API version 2021-07-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// - privateEndpointConnectionName - The name of the private endpoint connection. -// - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// - vaultName - The vault name. +// - options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager // method. -func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { - var err error - const operationName = "PrivateEndpointConnectionsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, scopeName, privateEndpointConnectionName, options) - if err != nil { - return PrivateEndpointConnectionsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateEndpointConnectionsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PrivateEndpointConnectionsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err +func (client *PrivateEndpointConnectionsClient) NewListPager(resourceGroupName string, vaultName string, options *PrivateEndpointConnectionsClientListOptions) *runtime.Pager[PrivateEndpointConnectionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateEndpointConnectionsClientListResponse]{ + More: func(page PrivateEndpointConnectionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionsClientListResponse) (PrivateEndpointConnectionsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateEndpointConnectionsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, vaultName, options) + }, nil) + if err != nil { + return PrivateEndpointConnectionsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) } -// getCreateRequest creates the Get request. -func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}" +// listCreateRequest creates the List request. +func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, _ *PrivateEndpointConnectionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnections" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -250,67 +233,65 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if scopeName == "" { - return nil, errors.New("parameter scopeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - if privateEndpointConnectionName == "" { - return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// getHandleResponse handles the Get response. -func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientGetResponse, error) { - result := PrivateEndpointConnectionsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionsClientGetResponse{}, err +// listHandleResponse handles the List response. +func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientListResponse, error) { + result := PrivateEndpointConnectionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { + return PrivateEndpointConnectionsClientListResponse{}, err } return result, nil } -// ListByPrivateLinkScope - Gets all private endpoint connections on a private link scope. +// Update - Updated the private endpoint connection status (Approval/Rejected). This gets invoked by resource admin. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-07-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// - options - PrivateEndpointConnectionsClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateEndpointConnectionsClient.ListByPrivateLinkScope +// - vaultName - The vault name. +// - privateEndpointConnectionName - The private endpoint connection name. +// - body - Private endpoint connection update input. +// - options - PrivateEndpointConnectionsClientUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Update // method. -func (client *PrivateEndpointConnectionsClient) ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateEndpointConnectionsClientListByPrivateLinkScopeOptions) (PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse, error) { +func (client *PrivateEndpointConnectionsClient) Update(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, body PrivateEndpointConnection, options *PrivateEndpointConnectionsClientUpdateOptions) (PrivateEndpointConnectionsClientUpdateResponse, error) { var err error - const operationName = "PrivateEndpointConnectionsClient.ListByPrivateLinkScope" + const operationName = "PrivateEndpointConnectionsClient.Update" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.listByPrivateLinkScopeCreateRequest(ctx, resourceGroupName, scopeName, options) + req, err := client.updateCreateRequest(ctx, resourceGroupName, vaultName, privateEndpointConnectionName, body, options) if err != nil { - return PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse{}, err + return PrivateEndpointConnectionsClientUpdateResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse{}, err + return PrivateEndpointConnectionsClientUpdateResponse{}, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { err = runtime.NewResponseError(httpResp) - return PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse{}, err + return PrivateEndpointConnectionsClientUpdateResponse{}, err } - resp, err := client.listByPrivateLinkScopeHandleResponse(httpResp) + resp, err := client.updateHandleResponse(httpResp) return resp, err } -// listByPrivateLinkScopeCreateRequest creates the ListByPrivateLinkScope request. -func (client *PrivateEndpointConnectionsClient) listByPrivateLinkScopeCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateEndpointConnectionsClientListByPrivateLinkScopeOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateEndpointConnections" +// updateCreateRequest creates the Update request. +func (client *PrivateEndpointConnectionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, body PrivateEndpointConnection, _ *PrivateEndpointConnectionsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -319,26 +300,33 @@ func (client *PrivateEndpointConnectionsClient) listByPrivateLinkScopeCreateRequ return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if scopeName == "" { - return nil, errors.New("parameter scopeName cannot be empty") + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } return req, nil } -// listByPrivateLinkScopeHandleResponse handles the ListByPrivateLinkScope response. -func (client *PrivateEndpointConnectionsClient) listByPrivateLinkScopeHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse, error) { - result := PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { - return PrivateEndpointConnectionsClientListByPrivateLinkScopeResponse{}, err +// updateHandleResponse handles the Update response. +func (client *PrivateEndpointConnectionsClient) updateHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientUpdateResponse, error) { + result := PrivateEndpointConnectionsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return PrivateEndpointConnectionsClientUpdateResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privatelinkresources_client.go similarity index 55% rename from sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privatelinkresources_client.go index 748423399549..5f6ddb303e03 100644 --- a/sdk/resourcemanager/monitor/armmonitor/privatelinkresources_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privatelinkresources_client.go @@ -1,12 +1,9 @@ -//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 armmonitor +package armrecoveryservicesdatareplication import ( "context" @@ -28,7 +25,7 @@ type PrivateLinkResourcesClient struct { } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient 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 NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { @@ -43,22 +40,22 @@ func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.Toke return client, nil } -// Get - Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. +// Get - Gets the details of site recovery private link resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-07-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// - groupName - The name of the private link resource. +// - vaultName - The vault name. +// - privateLinkResourceName - The private link name. // - options - PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get // method. -func (client *PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, scopeName string, groupName string, options *PrivateLinkResourcesClientGetOptions) (PrivateLinkResourcesClientGetResponse, error) { +func (client *PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, vaultName string, privateLinkResourceName string, options *PrivateLinkResourcesClientGetOptions) (PrivateLinkResourcesClientGetResponse, error) { var err error const operationName = "PrivateLinkResourcesClient.Get" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, scopeName, groupName, options) + req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, privateLinkResourceName, options) if err != nil { return PrivateLinkResourcesClientGetResponse{}, err } @@ -75,8 +72,8 @@ func (client *PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroup } // getCreateRequest creates the Get request. -func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, groupName string, options *PrivateLinkResourcesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateLinkResources/{groupName}" +func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, privateLinkResourceName string, _ *PrivateLinkResourcesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateLinkResources/{privateLinkResourceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -85,20 +82,20 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if scopeName == "" { - return nil, errors.New("parameter scopeName cannot be empty") + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) - if groupName == "" { - return nil, errors.New("parameter groupName cannot be empty") + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + if privateLinkResourceName == "" { + return nil, errors.New("parameter privateLinkResourceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) + urlPath = strings.ReplaceAll(urlPath, "{privateLinkResourceName}", url.PathEscape(privateLinkResourceName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -113,39 +110,39 @@ func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) return result, nil } -// ListByPrivateLinkScope - Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. -// If the operation fails it returns an *azcore.ResponseError type. +// NewListPager - Gets the list of private link resources. // -// Generated from API version 2021-07-01-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - scopeName - The name of the Azure Monitor PrivateLinkScope resource. -// - options - PrivateLinkResourcesClientListByPrivateLinkScopeOptions contains the optional parameters for the PrivateLinkResourcesClient.ListByPrivateLinkScope +// - vaultName - The vault name. +// - options - PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListPager // method. -func (client *PrivateLinkResourcesClient) ListByPrivateLinkScope(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateLinkResourcesClientListByPrivateLinkScopeOptions) (PrivateLinkResourcesClientListByPrivateLinkScopeResponse, error) { - var err error - const operationName = "PrivateLinkResourcesClient.ListByPrivateLinkScope" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listByPrivateLinkScopeCreateRequest(ctx, resourceGroupName, scopeName, options) - if err != nil { - return PrivateLinkResourcesClientListByPrivateLinkScopeResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PrivateLinkResourcesClientListByPrivateLinkScopeResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PrivateLinkResourcesClientListByPrivateLinkScopeResponse{}, err - } - resp, err := client.listByPrivateLinkScopeHandleResponse(httpResp) - return resp, err +func (client *PrivateLinkResourcesClient) NewListPager(resourceGroupName string, vaultName string, options *PrivateLinkResourcesClientListOptions) *runtime.Pager[PrivateLinkResourcesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateLinkResourcesClientListResponse]{ + More: func(page PrivateLinkResourcesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateLinkResourcesClientListResponse) (PrivateLinkResourcesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateLinkResourcesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, vaultName, options) + }, nil) + if err != nil { + return PrivateLinkResourcesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) } -// listByPrivateLinkScopeCreateRequest creates the ListByPrivateLinkScope request. -func (client *PrivateLinkResourcesClient) listByPrivateLinkScopeCreateRequest(ctx context.Context, resourceGroupName string, scopeName string, options *PrivateLinkResourcesClientListByPrivateLinkScopeOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights/privateLinkScopes/{scopeName}/privateLinkResources" +// listCreateRequest creates the List request. +func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, _ *PrivateLinkResourcesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateLinkResources" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -154,26 +151,26 @@ func (client *PrivateLinkResourcesClient) listByPrivateLinkScopeCreateRequest(ct return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if scopeName == "" { - return nil, errors.New("parameter scopeName cannot be empty") + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{scopeName}", url.PathEscape(scopeName)) + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// listByPrivateLinkScopeHandleResponse handles the ListByPrivateLinkScope response. -func (client *PrivateLinkResourcesClient) listByPrivateLinkScopeHandleResponse(resp *http.Response) (PrivateLinkResourcesClientListByPrivateLinkScopeResponse, error) { - result := PrivateLinkResourcesClientListByPrivateLinkScopeResponse{} +// listHandleResponse handles the List response. +func (client *PrivateLinkResourcesClient) listHandleResponse(resp *http.Response) (PrivateLinkResourcesClientListResponse, error) { + result := PrivateLinkResourcesClientListResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { - return PrivateLinkResourcesClientListByPrivateLinkScopeResponse{}, err + return PrivateLinkResourcesClientListResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditem_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditem_client.go index 0d7def263234..f7b8745c9590 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditem_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditem_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. @@ -47,7 +44,7 @@ func NewProtectedItemClient(subscriptionID string, credential azcore.TokenCreden // BeginCreate - Creates the protected item. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - protectedItemName - The protected item name. @@ -61,7 +58,7 @@ func (client *ProtectedItemClient) BeginCreate(ctx context.Context, resourceGrou return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProtectedItemClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, Tracer: client.internal.Tracer(), }) return poller, err @@ -75,7 +72,7 @@ func (client *ProtectedItemClient) BeginCreate(ctx context.Context, resourceGrou // Create - Creates the protected item. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 func (client *ProtectedItemClient) create(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, body ProtectedItemModel, options *ProtectedItemClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "ProtectedItemClient.BeginCreate" @@ -98,7 +95,7 @@ func (client *ProtectedItemClient) create(ctx context.Context, resourceGroupName } // createCreateRequest creates the Create request. -func (client *ProtectedItemClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, body ProtectedItemModel, options *ProtectedItemClientBeginCreateOptions) (*policy.Request, error) { +func (client *ProtectedItemClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, body ProtectedItemModel, _ *ProtectedItemClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -121,7 +118,7 @@ func (client *ProtectedItemClient) createCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -133,7 +130,7 @@ func (client *ProtectedItemClient) createCreateRequest(ctx context.Context, reso // BeginDelete - Removes the protected item. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - protectedItemName - The protected item name. @@ -160,7 +157,7 @@ func (client *ProtectedItemClient) BeginDelete(ctx context.Context, resourceGrou // Delete - Removes the protected item. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 func (client *ProtectedItemClient) deleteOperation(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, options *ProtectedItemClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ProtectedItemClient.BeginDelete" @@ -206,10 +203,10 @@ func (client *ProtectedItemClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01") if options != nil && options.ForceDelete != nil { reqQP.Set("forceDelete", strconv.FormatBool(*options.ForceDelete)) } - reqQP.Set("api-version", "2021-02-16-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -218,7 +215,7 @@ func (client *ProtectedItemClient) deleteCreateRequest(ctx context.Context, reso // Get - Gets the details of the protected item. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - protectedItemName - The protected item name. @@ -246,7 +243,7 @@ func (client *ProtectedItemClient) Get(ctx context.Context, resourceGroupName st } // getCreateRequest creates the Get request. -func (client *ProtectedItemClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, options *ProtectedItemClientGetOptions) (*policy.Request, error) { +func (client *ProtectedItemClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, _ *ProtectedItemClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -269,7 +266,7 @@ func (client *ProtectedItemClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -286,7 +283,7 @@ func (client *ProtectedItemClient) getHandleResponse(resp *http.Response) (Prote // NewListPager - Gets the list of protected items in the given vault. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - options - ProtectedItemClientListOptions contains the optional parameters for the ProtectedItemClient.NewListPager method. @@ -333,7 +330,16 @@ func (client *ProtectedItemClient) listCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") + if options != nil && options.ContinuationToken != nil { + reqQP.Set("continuationToken", *options.ContinuationToken) + } + if options != nil && options.ODataOptions != nil { + reqQP.Set("odataOptions", *options.ODataOptions) + } + if options != nil && options.PageSize != nil { + reqQP.Set("pageSize", strconv.FormatInt(int64(*options.PageSize), 10)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -342,7 +348,7 @@ func (client *ProtectedItemClient) listCreateRequest(ctx context.Context, resour // listHandleResponse handles the List response. func (client *ProtectedItemClient) listHandleResponse(resp *http.Response) (ProtectedItemClientListResponse, error) { result := ProtectedItemClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ProtectedItemModelCollection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ProtectedItemModelListResult); err != nil { return ProtectedItemClientListResponse{}, err } return result, nil @@ -351,15 +357,16 @@ func (client *ProtectedItemClient) listHandleResponse(resp *http.Response) (Prot // BeginPlannedFailover - Performs the planned failover on the protected item. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - protectedItemName - The protected item name. +// - body - Planned failover model. // - options - ProtectedItemClientBeginPlannedFailoverOptions contains the optional parameters for the ProtectedItemClient.BeginPlannedFailover // method. -func (client *ProtectedItemClient) BeginPlannedFailover(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, options *ProtectedItemClientBeginPlannedFailoverOptions) (*runtime.Poller[ProtectedItemClientPlannedFailoverResponse], error) { +func (client *ProtectedItemClient) BeginPlannedFailover(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, body PlannedFailoverModel, options *ProtectedItemClientBeginPlannedFailoverOptions) (*runtime.Poller[ProtectedItemClientPlannedFailoverResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.plannedFailover(ctx, resourceGroupName, vaultName, protectedItemName, options) + resp, err := client.plannedFailover(ctx, resourceGroupName, vaultName, protectedItemName, body, options) if err != nil { return nil, err } @@ -378,14 +385,14 @@ func (client *ProtectedItemClient) BeginPlannedFailover(ctx context.Context, res // PlannedFailover - Performs the planned failover on the protected item. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview -func (client *ProtectedItemClient) plannedFailover(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, options *ProtectedItemClientBeginPlannedFailoverOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *ProtectedItemClient) plannedFailover(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, body PlannedFailoverModel, options *ProtectedItemClientBeginPlannedFailoverOptions) (*http.Response, error) { var err error const operationName = "ProtectedItemClient.BeginPlannedFailover" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.plannedFailoverCreateRequest(ctx, resourceGroupName, vaultName, protectedItemName, options) + req, err := client.plannedFailoverCreateRequest(ctx, resourceGroupName, vaultName, protectedItemName, body, options) if err != nil { return nil, err } @@ -401,7 +408,7 @@ func (client *ProtectedItemClient) plannedFailover(ctx context.Context, resource } // plannedFailoverCreateRequest creates the PlannedFailover request. -func (client *ProtectedItemClient) plannedFailoverCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, options *ProtectedItemClientBeginPlannedFailoverOptions) (*policy.Request, error) { +func (client *ProtectedItemClient) plannedFailoverCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, body PlannedFailoverModel, _ *ProtectedItemClientBeginPlannedFailoverOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/plannedFailover" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -424,14 +431,97 @@ func (client *ProtectedItemClient) plannedFailoverCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Body != nil { - if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginUpdate - Performs update on the protected item. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The vault name. +// - protectedItemName - The protected item name. +// - body - Protected item model. +// - options - ProtectedItemClientBeginUpdateOptions contains the optional parameters for the ProtectedItemClient.BeginUpdate +// method. +func (client *ProtectedItemClient) BeginUpdate(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, body ProtectedItemModelUpdate, options *ProtectedItemClientBeginUpdateOptions) (*runtime.Poller[ProtectedItemClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, vaultName, protectedItemName, body, options) + if err != nil { return nil, err } - return req, nil + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProtectedItemClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ProtectedItemClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Performs update on the protected item. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +func (client *ProtectedItemClient) update(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, body ProtectedItemModelUpdate, options *ProtectedItemClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ProtectedItemClient.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, vaultName, protectedItemName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *ProtectedItemClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, body ProtectedItemModelUpdate, _ *ProtectedItemClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + if protectedItemName == "" { + return nil, errors.New("parameter protectedItemName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{protectedItemName}", url.PathEscape(protectedItemName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err } return req, nil } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditem_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditem_client_example_test.go deleted file mode 100644 index defd9c3f155f..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditem_client_example_test.go +++ /dev/null @@ -1,485 +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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItem_Get.json -func ExampleProtectedItemClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProtectedItemClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "d", 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.ProtectedItemModel = armrecoveryservicesdatareplication.ProtectedItemModel{ - // Name: to.Ptr("t"), - // Type: to.Ptr("xlyjashandpfwivuipoplgkgsnwoh"), - // ID: to.Ptr("egmhsfbgkarlobrgybkz"), - // Properties: &armrecoveryservicesdatareplication.ProtectedItemModelProperties{ - // AllowedJobs: []*string{ - // to.Ptr("guryeoocjbvqvalfkrxecpxwynpxs")}, - // CorrelationID: to.Ptr("mvxvtcqwgp"), - // CurrentJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesCurrentJob{ - // Name: to.Ptr("kqtvbrfmqaxdgpttkbmzpwafjp"), - // DisplayName: to.Ptr("awutlqrisstqb"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("bnmbzxzyfgwh"), - // ScenarioName: to.Ptr("ljbnhbdmreowdqnlcqycvaramwuii"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("ztlpngveoqcdejpwaiudhrioskauqv"), - // }, - // CustomProperties: &armrecoveryservicesdatareplication.ProtectedItemModelCustomProperties{ - // InstanceType: to.Ptr("ProtectedItemModelCustomProperties"), - // }, - // DraID: to.Ptr("vxrmsufvxothxauhvqdowascmy"), - // FabricID: to.Ptr("ebsxoblmhlhqjzzjzdwo"), - // FabricObjectID: to.Ptr("kjcizdpahzqsrwyiywbhyzdxsufj"), - // FabricObjectName: to.Ptr("glrjwtvmejxuagjepcwaxhih"), - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, - // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), - // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ - // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), - // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), - // Severity: to.Ptr("wqxxiuaqjyagq"), - // Source: to.Ptr("wevvftugwydzzw"), - // Summary: to.Ptr("djsmgrltruljo"), - // }}, - // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), - // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), - // Source: to.Ptr("iy"), - // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // LastFailedEnableProtectionJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesLastFailedEnableProtectionJob{ - // Name: to.Ptr("hvvolptulpcxwbnjdzky"), - // DisplayName: to.Ptr("zrqjbcozwiuypjjnvy"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("hjzgyxgdy"), - // ScenarioName: to.Ptr("fhz"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("ljsixxmmcaq"), - // }, - // LastFailedPlannedFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesLastFailedPlannedFailoverJob{ - // Name: to.Ptr("ofblltxwhwzhyr"), - // DisplayName: to.Ptr("whxsvbrzdhqsepbocfzsfx"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("ndjurplurnkguwfxx"), - // ScenarioName: to.Ptr("ceksuyfiplxj"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("wpur"), - // }, - // LastSuccessfulPlannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastSuccessfulTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastSuccessfulUnplannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastTestFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesLastTestFailoverJob{ - // Name: to.Ptr("cedjijdtnznsnigghrxnsaz"), - // DisplayName: to.Ptr("lhkjfbonwdtxckwzfebfwdyu"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("cta"), - // ScenarioName: to.Ptr("dfuovvz"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("nhbzw"), - // }, - // PolicyName: to.Ptr("tjoeiynplt"), - // ProtectionState: to.Ptr(armrecoveryservicesdatareplication.ProtectionStateUnprotectedStatesBegin), - // ProtectionStateDescription: to.Ptr("lp"), - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ReplicationExtensionName: to.Ptr("jwxdo"), - // ReplicationHealth: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), - // ResyncRequired: to.Ptr(true), - // ResynchronizationState: to.Ptr(armrecoveryservicesdatareplication.ResynchronizationStateNone), - // SourceFabricProviderID: to.Ptr("srggkxaruzlegtpdalscio"), - // TargetDraID: to.Ptr("oscnhreunbyibimlpvsesu"), - // TargetFabricID: to.Ptr("fb"), - // TargetFabricProviderID: to.Ptr("sutiqezfbeiewwjezflvcitqj"), - // TestFailoverState: to.Ptr(armrecoveryservicesdatareplication.TestFailoverStateNone), - // TestFailoverStateDescription: to.Ptr("msjz"), - // }, - // SystemData: &armrecoveryservicesdatareplication.ProtectedItemModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // CreatedBy: to.Ptr("ghut"), - // CreatedByType: to.Ptr("tzczp"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastModifiedBy: to.Ptr("epo"), - // LastModifiedByType: to.Ptr("ekzmwexhjttb"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItem_Create.json -func ExampleProtectedItemClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProtectedItemClient().BeginCreate(ctx, "rgrecoveryservicesdatareplication", "4", "d", armrecoveryservicesdatareplication.ProtectedItemModel{ - Properties: &armrecoveryservicesdatareplication.ProtectedItemModelProperties{ - CustomProperties: &armrecoveryservicesdatareplication.ProtectedItemModelCustomProperties{ - InstanceType: to.Ptr("ProtectedItemModelCustomProperties"), - }, - PolicyName: to.Ptr("tjoeiynplt"), - ReplicationExtensionName: to.Ptr("jwxdo"), - }, - }, 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.ProtectedItemModel = armrecoveryservicesdatareplication.ProtectedItemModel{ - // Name: to.Ptr("t"), - // Type: to.Ptr("xlyjashandpfwivuipoplgkgsnwoh"), - // ID: to.Ptr("egmhsfbgkarlobrgybkz"), - // Properties: &armrecoveryservicesdatareplication.ProtectedItemModelProperties{ - // AllowedJobs: []*string{ - // to.Ptr("guryeoocjbvqvalfkrxecpxwynpxs")}, - // CorrelationID: to.Ptr("mvxvtcqwgp"), - // CurrentJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesCurrentJob{ - // Name: to.Ptr("kqtvbrfmqaxdgpttkbmzpwafjp"), - // DisplayName: to.Ptr("awutlqrisstqb"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("bnmbzxzyfgwh"), - // ScenarioName: to.Ptr("ljbnhbdmreowdqnlcqycvaramwuii"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("ztlpngveoqcdejpwaiudhrioskauqv"), - // }, - // CustomProperties: &armrecoveryservicesdatareplication.ProtectedItemModelCustomProperties{ - // InstanceType: to.Ptr("ProtectedItemModelCustomProperties"), - // }, - // DraID: to.Ptr("vxrmsufvxothxauhvqdowascmy"), - // FabricID: to.Ptr("ebsxoblmhlhqjzzjzdwo"), - // FabricObjectID: to.Ptr("kjcizdpahzqsrwyiywbhyzdxsufj"), - // FabricObjectName: to.Ptr("glrjwtvmejxuagjepcwaxhih"), - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, - // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), - // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ - // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), - // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), - // Severity: to.Ptr("wqxxiuaqjyagq"), - // Source: to.Ptr("wevvftugwydzzw"), - // Summary: to.Ptr("djsmgrltruljo"), - // }}, - // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), - // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), - // Source: to.Ptr("iy"), - // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // LastFailedEnableProtectionJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesLastFailedEnableProtectionJob{ - // Name: to.Ptr("hvvolptulpcxwbnjdzky"), - // DisplayName: to.Ptr("zrqjbcozwiuypjjnvy"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("hjzgyxgdy"), - // ScenarioName: to.Ptr("fhz"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("ljsixxmmcaq"), - // }, - // LastFailedPlannedFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesLastFailedPlannedFailoverJob{ - // Name: to.Ptr("ofblltxwhwzhyr"), - // DisplayName: to.Ptr("whxsvbrzdhqsepbocfzsfx"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("ndjurplurnkguwfxx"), - // ScenarioName: to.Ptr("ceksuyfiplxj"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("wpur"), - // }, - // LastSuccessfulPlannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastSuccessfulTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastSuccessfulUnplannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastTestFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesLastTestFailoverJob{ - // Name: to.Ptr("cedjijdtnznsnigghrxnsaz"), - // DisplayName: to.Ptr("lhkjfbonwdtxckwzfebfwdyu"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("cta"), - // ScenarioName: to.Ptr("dfuovvz"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("nhbzw"), - // }, - // PolicyName: to.Ptr("tjoeiynplt"), - // ProtectionState: to.Ptr(armrecoveryservicesdatareplication.ProtectionStateUnprotectedStatesBegin), - // ProtectionStateDescription: to.Ptr("lp"), - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ReplicationExtensionName: to.Ptr("jwxdo"), - // ReplicationHealth: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), - // ResyncRequired: to.Ptr(true), - // ResynchronizationState: to.Ptr(armrecoveryservicesdatareplication.ResynchronizationStateNone), - // SourceFabricProviderID: to.Ptr("srggkxaruzlegtpdalscio"), - // TargetDraID: to.Ptr("oscnhreunbyibimlpvsesu"), - // TargetFabricID: to.Ptr("fb"), - // TargetFabricProviderID: to.Ptr("sutiqezfbeiewwjezflvcitqj"), - // TestFailoverState: to.Ptr(armrecoveryservicesdatareplication.TestFailoverStateNone), - // TestFailoverStateDescription: to.Ptr("msjz"), - // }, - // SystemData: &armrecoveryservicesdatareplication.ProtectedItemModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // CreatedBy: to.Ptr("ghut"), - // CreatedByType: to.Ptr("tzczp"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastModifiedBy: to.Ptr("epo"), - // LastModifiedByType: to.Ptr("ekzmwexhjttb"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItem_Delete.json -func ExampleProtectedItemClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProtectedItemClient().BeginDelete(ctx, "rgrecoveryservicesdatareplication", "4", "d", &armrecoveryservicesdatareplication.ProtectedItemClientBeginDeleteOptions{ForceDelete: to.Ptr(true)}) - 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/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItem_List.json -func ExampleProtectedItemClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProtectedItemClient().NewListPager("rgrecoveryservicesdatareplication", "4", 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.ProtectedItemModelCollection = armrecoveryservicesdatareplication.ProtectedItemModelCollection{ - // Value: []*armrecoveryservicesdatareplication.ProtectedItemModel{ - // { - // Name: to.Ptr("t"), - // Type: to.Ptr("xlyjashandpfwivuipoplgkgsnwoh"), - // ID: to.Ptr("egmhsfbgkarlobrgybkz"), - // Properties: &armrecoveryservicesdatareplication.ProtectedItemModelProperties{ - // AllowedJobs: []*string{ - // to.Ptr("guryeoocjbvqvalfkrxecpxwynpxs")}, - // CorrelationID: to.Ptr("mvxvtcqwgp"), - // CurrentJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesCurrentJob{ - // Name: to.Ptr("kqtvbrfmqaxdgpttkbmzpwafjp"), - // DisplayName: to.Ptr("awutlqrisstqb"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("bnmbzxzyfgwh"), - // ScenarioName: to.Ptr("ljbnhbdmreowdqnlcqycvaramwuii"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("ztlpngveoqcdejpwaiudhrioskauqv"), - // }, - // CustomProperties: &armrecoveryservicesdatareplication.ProtectedItemModelCustomProperties{ - // InstanceType: to.Ptr("ProtectedItemModelCustomProperties"), - // }, - // DraID: to.Ptr("vxrmsufvxothxauhvqdowascmy"), - // FabricID: to.Ptr("ebsxoblmhlhqjzzjzdwo"), - // FabricObjectID: to.Ptr("kjcizdpahzqsrwyiywbhyzdxsufj"), - // FabricObjectName: to.Ptr("glrjwtvmejxuagjepcwaxhih"), - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, - // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), - // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ - // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), - // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), - // Severity: to.Ptr("wqxxiuaqjyagq"), - // Source: to.Ptr("wevvftugwydzzw"), - // Summary: to.Ptr("djsmgrltruljo"), - // }}, - // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), - // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), - // Source: to.Ptr("iy"), - // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // LastFailedEnableProtectionJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesLastFailedEnableProtectionJob{ - // Name: to.Ptr("hvvolptulpcxwbnjdzky"), - // DisplayName: to.Ptr("zrqjbcozwiuypjjnvy"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("hjzgyxgdy"), - // ScenarioName: to.Ptr("fhz"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("ljsixxmmcaq"), - // }, - // LastFailedPlannedFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesLastFailedPlannedFailoverJob{ - // Name: to.Ptr("ofblltxwhwzhyr"), - // DisplayName: to.Ptr("whxsvbrzdhqsepbocfzsfx"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("ndjurplurnkguwfxx"), - // ScenarioName: to.Ptr("ceksuyfiplxj"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("wpur"), - // }, - // LastSuccessfulPlannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastSuccessfulTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastSuccessfulUnplannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastTestFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesLastTestFailoverJob{ - // Name: to.Ptr("cedjijdtnznsnigghrxnsaz"), - // DisplayName: to.Ptr("lhkjfbonwdtxckwzfebfwdyu"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("cta"), - // ScenarioName: to.Ptr("dfuovvz"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("nhbzw"), - // }, - // PolicyName: to.Ptr("tjoeiynplt"), - // ProtectionState: to.Ptr(armrecoveryservicesdatareplication.ProtectionStateUnprotectedStatesBegin), - // ProtectionStateDescription: to.Ptr("lp"), - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ReplicationExtensionName: to.Ptr("jwxdo"), - // ReplicationHealth: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), - // ResyncRequired: to.Ptr(true), - // ResynchronizationState: to.Ptr(armrecoveryservicesdatareplication.ResynchronizationStateNone), - // SourceFabricProviderID: to.Ptr("srggkxaruzlegtpdalscio"), - // TargetDraID: to.Ptr("oscnhreunbyibimlpvsesu"), - // TargetFabricID: to.Ptr("fb"), - // TargetFabricProviderID: to.Ptr("sutiqezfbeiewwjezflvcitqj"), - // TestFailoverState: to.Ptr(armrecoveryservicesdatareplication.TestFailoverStateNone), - // TestFailoverStateDescription: to.Ptr("msjz"), - // }, - // SystemData: &armrecoveryservicesdatareplication.ProtectedItemModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // CreatedBy: to.Ptr("ghut"), - // CreatedByType: to.Ptr("tzczp"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastModifiedBy: to.Ptr("epo"), - // LastModifiedByType: to.Ptr("ekzmwexhjttb"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItem_PlannedFailover.json -func ExampleProtectedItemClient_BeginPlannedFailover() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProtectedItemClient().BeginPlannedFailover(ctx, "rgrecoveryservicesdatareplication", "4", "d", &armrecoveryservicesdatareplication.ProtectedItemClientBeginPlannedFailoverOptions{Body: &armrecoveryservicesdatareplication.PlannedFailoverModel{ - Properties: &armrecoveryservicesdatareplication.PlannedFailoverModelProperties{ - CustomProperties: &armrecoveryservicesdatareplication.PlannedFailoverModelCustomProperties{ - InstanceType: to.Ptr("PlannedFailoverModelCustomProperties"), - }, - }, - }, - }) - 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.PlannedFailoverModel = armrecoveryservicesdatareplication.PlannedFailoverModel{ - // Properties: &armrecoveryservicesdatareplication.PlannedFailoverModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.PlannedFailoverModelCustomProperties{ - // InstanceType: to.Ptr("PlannedFailoverModelCustomProperties"), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditemoperationstatus_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditemoperationstatus_client.go deleted file mode 100644 index 438e76551bad..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditemoperationstatus_client.go +++ /dev/null @@ -1,119 +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 armrecoveryservicesdatareplication - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// ProtectedItemOperationStatusClient contains the methods for the ProtectedItemOperationStatus group. -// Don't use this type directly, use NewProtectedItemOperationStatusClient() instead. -type ProtectedItemOperationStatusClient struct { - internal *arm.Client - subscriptionID string -} - -// NewProtectedItemOperationStatusClient creates a new instance of ProtectedItemOperationStatusClient with the specified values. -// - subscriptionID - The ID of the target subscription. The value must be an UUID. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewProtectedItemOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProtectedItemOperationStatusClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ProtectedItemOperationStatusClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Tracks the results of an asynchronous operation on the protected item. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-02-16-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - vaultName - The vault name. -// - protectedItemName - The protected item name. -// - operationID - The ID of an ongoing async operation. -// - options - ProtectedItemOperationStatusClientGetOptions contains the optional parameters for the ProtectedItemOperationStatusClient.Get -// method. -func (client *ProtectedItemOperationStatusClient) Get(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, operationID string, options *ProtectedItemOperationStatusClientGetOptions) (ProtectedItemOperationStatusClientGetResponse, error) { - var err error - const operationName = "ProtectedItemOperationStatusClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, protectedItemName, operationID, options) - if err != nil { - return ProtectedItemOperationStatusClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProtectedItemOperationStatusClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ProtectedItemOperationStatusClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ProtectedItemOperationStatusClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, operationID string, options *ProtectedItemOperationStatusClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/operations/{operationId}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - if protectedItemName == "" { - return nil, errors.New("parameter protectedItemName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{protectedItemName}", url.PathEscape(protectedItemName)) - if operationID == "" { - return nil, errors.New("parameter operationID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ProtectedItemOperationStatusClient) getHandleResponse(resp *http.Response) (ProtectedItemOperationStatusClientGetResponse, error) { - result := ProtectedItemOperationStatusClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return ProtectedItemOperationStatusClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditemoperationstatus_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditemoperationstatus_client_example_test.go deleted file mode 100644 index e9bd790c78c7..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditemoperationstatus_client_example_test.go +++ /dev/null @@ -1,45 +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 armrecoveryservicesdatareplication_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItemOperationStatus_Get.json -func ExampleProtectedItemOperationStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProtectedItemOperationStatusClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "d", "wdqacsc", 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.OperationStatus = armrecoveryservicesdatareplication.OperationStatus{ - // Name: to.Ptr("wzdasptnwlxgobklayoqapjcgcf"), - // EndTime: to.Ptr("nauyrfh"), - // ID: to.Ptr("sf"), - // StartTime: to.Ptr("xuzwmfrhluafmwwsmzqxsytyehsh"), - // Status: to.Ptr("plbnngzfppdram"), - // } -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoints_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoint_client.go similarity index 68% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoints_client.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoint_client.go index 00a263937da7..5fcb4e00aa6a 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoints_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoint_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. @@ -20,23 +17,23 @@ import ( "strings" ) -// RecoveryPointsClient contains the methods for the RecoveryPoints group. -// Don't use this type directly, use NewRecoveryPointsClient() instead. -type RecoveryPointsClient struct { +// RecoveryPointClient contains the methods for the RecoveryPoint group. +// Don't use this type directly, use NewRecoveryPointClient() instead. +type RecoveryPointClient struct { internal *arm.Client subscriptionID string } -// NewRecoveryPointsClient creates a new instance of RecoveryPointsClient with the specified values. +// NewRecoveryPointClient creates a new instance of RecoveryPointClient with the specified values. // - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. -func NewRecoveryPointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RecoveryPointsClient, error) { +func NewRecoveryPointClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RecoveryPointClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } - client := &RecoveryPointsClient{ + client := &RecoveryPointClient{ subscriptionID: subscriptionID, internal: cl, } @@ -46,36 +43,36 @@ func NewRecoveryPointsClient(subscriptionID string, credential azcore.TokenCrede // Get - Gets the details of the recovery point of a protected item. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - protectedItemName - The protected item name. // - recoveryPointName - The recovery point name. -// - options - RecoveryPointsClientGetOptions contains the optional parameters for the RecoveryPointsClient.Get method. -func (client *RecoveryPointsClient) Get(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, recoveryPointName string, options *RecoveryPointsClientGetOptions) (RecoveryPointsClientGetResponse, error) { +// - options - RecoveryPointClientGetOptions contains the optional parameters for the RecoveryPointClient.Get method. +func (client *RecoveryPointClient) Get(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, recoveryPointName string, options *RecoveryPointClientGetOptions) (RecoveryPointClientGetResponse, error) { var err error - const operationName = "RecoveryPointsClient.Get" + const operationName = "RecoveryPointClient.Get" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, protectedItemName, recoveryPointName, options) if err != nil { - return RecoveryPointsClientGetResponse{}, err + return RecoveryPointClientGetResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return RecoveryPointsClientGetResponse{}, err + return RecoveryPointClientGetResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return RecoveryPointsClientGetResponse{}, err + return RecoveryPointClientGetResponse{}, err } resp, err := client.getHandleResponse(httpResp) return resp, err } // getCreateRequest creates the Get request. -func (client *RecoveryPointsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, recoveryPointName string, options *RecoveryPointsClientGetOptions) (*policy.Request, error) { +func (client *RecoveryPointClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, recoveryPointName string, _ *RecoveryPointClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -102,35 +99,35 @@ func (client *RecoveryPointsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // getHandleResponse handles the Get response. -func (client *RecoveryPointsClient) getHandleResponse(resp *http.Response) (RecoveryPointsClientGetResponse, error) { - result := RecoveryPointsClientGetResponse{} +func (client *RecoveryPointClient) getHandleResponse(resp *http.Response) (RecoveryPointClientGetResponse, error) { + result := RecoveryPointClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.RecoveryPointModel); err != nil { - return RecoveryPointsClientGetResponse{}, err + return RecoveryPointClientGetResponse{}, err } return result, nil } // NewListPager - Gets the list of recovery points of the given protected item. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - protectedItemName - The protected item name. -// - options - RecoveryPointsClientListOptions contains the optional parameters for the RecoveryPointsClient.NewListPager method. -func (client *RecoveryPointsClient) NewListPager(resourceGroupName string, vaultName string, protectedItemName string, options *RecoveryPointsClientListOptions) *runtime.Pager[RecoveryPointsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[RecoveryPointsClientListResponse]{ - More: func(page RecoveryPointsClientListResponse) bool { +// - options - RecoveryPointClientListOptions contains the optional parameters for the RecoveryPointClient.NewListPager method. +func (client *RecoveryPointClient) NewListPager(resourceGroupName string, vaultName string, protectedItemName string, options *RecoveryPointClientListOptions) *runtime.Pager[RecoveryPointClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[RecoveryPointClientListResponse]{ + More: func(page RecoveryPointClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *RecoveryPointsClientListResponse) (RecoveryPointsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RecoveryPointsClient.NewListPager") + Fetcher: func(ctx context.Context, page *RecoveryPointClientListResponse) (RecoveryPointClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RecoveryPointClient.NewListPager") nextLink := "" if page != nil { nextLink = *page.NextLink @@ -139,7 +136,7 @@ func (client *RecoveryPointsClient) NewListPager(resourceGroupName string, vault return client.listCreateRequest(ctx, resourceGroupName, vaultName, protectedItemName, options) }, nil) if err != nil { - return RecoveryPointsClientListResponse{}, err + return RecoveryPointClientListResponse{}, err } return client.listHandleResponse(resp) }, @@ -148,7 +145,7 @@ func (client *RecoveryPointsClient) NewListPager(resourceGroupName string, vault } // listCreateRequest creates the List request. -func (client *RecoveryPointsClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, options *RecoveryPointsClientListOptions) (*policy.Request, error) { +func (client *RecoveryPointClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, _ *RecoveryPointClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/recoveryPoints" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -171,17 +168,17 @@ func (client *RecoveryPointsClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // listHandleResponse handles the List response. -func (client *RecoveryPointsClient) listHandleResponse(resp *http.Response) (RecoveryPointsClientListResponse, error) { - result := RecoveryPointsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RecoveryPointModelCollection); err != nil { - return RecoveryPointsClientListResponse{}, err +func (client *RecoveryPointClient) listHandleResponse(resp *http.Response) (RecoveryPointClientListResponse, error) { + result := RecoveryPointClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RecoveryPointModelListResult); err != nil { + return RecoveryPointClientListResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoints_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoints_client_example_test.go deleted file mode 100644 index 45e9d3e92d8e..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoints_client_example_test.go +++ /dev/null @@ -1,106 +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 armrecoveryservicesdatareplication_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/RecoveryPoints_Get.json -func ExampleRecoveryPointsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecoveryPointsClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "d", "1X", 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.RecoveryPointModel = armrecoveryservicesdatareplication.RecoveryPointModel{ - // Name: to.Ptr("mfnjlwvvfnrsllcyyeslxxcchhvld"), - // Type: to.Ptr("zoeadplqxtonvqgwfqmeblh"), - // ID: to.Ptr("yrnzjckvljjffam"), - // Properties: &armrecoveryservicesdatareplication.RecoveryPointModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.RecoveryPointModelCustomProperties{ - // InstanceType: to.Ptr("RecoveryPointModelCustomProperties"), - // }, - // RecoveryPointTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.403Z"); return t}()), - // RecoveryPointType: to.Ptr(armrecoveryservicesdatareplication.RecoveryPointTypeApplicationConsistent), - // }, - // SystemData: &armrecoveryservicesdatareplication.RecoveryPointModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.403Z"); return t}()), - // CreatedBy: to.Ptr("nykpygxolffv"), - // CreatedByType: to.Ptr("agdgovroryjiwioytnnps"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.404Z"); return t}()), - // LastModifiedBy: to.Ptr("tipxxgz"), - // LastModifiedByType: to.Ptr("v"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/RecoveryPoints_List.json -func ExampleRecoveryPointsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRecoveryPointsClient().NewListPager("rgrecoveryservicesdatareplication", "4", "d", 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.RecoveryPointModelCollection = armrecoveryservicesdatareplication.RecoveryPointModelCollection{ - // Value: []*armrecoveryservicesdatareplication.RecoveryPointModel{ - // { - // Name: to.Ptr("mfnjlwvvfnrsllcyyeslxxcchhvld"), - // Type: to.Ptr("zoeadplqxtonvqgwfqmeblh"), - // ID: to.Ptr("yrnzjckvljjffam"), - // Properties: &armrecoveryservicesdatareplication.RecoveryPointModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.RecoveryPointModelCustomProperties{ - // InstanceType: to.Ptr("RecoveryPointModelCustomProperties"), - // }, - // RecoveryPointTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.403Z"); return t}()), - // RecoveryPointType: to.Ptr(armrecoveryservicesdatareplication.RecoveryPointTypeApplicationConsistent), - // }, - // SystemData: &armrecoveryservicesdatareplication.RecoveryPointModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.403Z"); return t}()), - // CreatedBy: to.Ptr("nykpygxolffv"), - // CreatedByType: to.Ptr("agdgovroryjiwioytnnps"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.404Z"); return t}()), - // LastModifiedBy: to.Ptr("tipxxgz"), - // LastModifiedByType: to.Ptr("v"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextension_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextension_client.go index 054f989c1c2b..ef81e9f4d79e 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextension_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextension_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. @@ -46,7 +43,7 @@ func NewReplicationExtensionClient(subscriptionID string, credential azcore.Toke // BeginCreate - Creates the replication extension in the given vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - replicationExtensionName - The replication extension name. @@ -60,7 +57,7 @@ func (client *ReplicationExtensionClient) BeginCreate(ctx context.Context, resou return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReplicationExtensionClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, Tracer: client.internal.Tracer(), }) return poller, err @@ -74,7 +71,7 @@ func (client *ReplicationExtensionClient) BeginCreate(ctx context.Context, resou // Create - Creates the replication extension in the given vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 func (client *ReplicationExtensionClient) create(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, body ReplicationExtensionModel, options *ReplicationExtensionClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "ReplicationExtensionClient.BeginCreate" @@ -97,7 +94,7 @@ func (client *ReplicationExtensionClient) create(ctx context.Context, resourceGr } // createCreateRequest creates the Create request. -func (client *ReplicationExtensionClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, body ReplicationExtensionModel, options *ReplicationExtensionClientBeginCreateOptions) (*policy.Request, error) { +func (client *ReplicationExtensionClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, body ReplicationExtensionModel, _ *ReplicationExtensionClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -120,7 +117,7 @@ func (client *ReplicationExtensionClient) createCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -132,7 +129,7 @@ func (client *ReplicationExtensionClient) createCreateRequest(ctx context.Contex // BeginDelete - Deletes the replication extension in the given vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - replicationExtensionName - The replication extension name. @@ -159,7 +156,7 @@ func (client *ReplicationExtensionClient) BeginDelete(ctx context.Context, resou // Delete - Deletes the replication extension in the given vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 func (client *ReplicationExtensionClient) deleteOperation(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, options *ReplicationExtensionClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ReplicationExtensionClient.BeginDelete" @@ -182,7 +179,7 @@ func (client *ReplicationExtensionClient) deleteOperation(ctx context.Context, r } // deleteCreateRequest creates the Delete request. -func (client *ReplicationExtensionClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, options *ReplicationExtensionClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ReplicationExtensionClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, _ *ReplicationExtensionClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -205,7 +202,7 @@ func (client *ReplicationExtensionClient) deleteCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -214,7 +211,7 @@ func (client *ReplicationExtensionClient) deleteCreateRequest(ctx context.Contex // Get - Gets the details of the replication extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - replicationExtensionName - The replication extension name. @@ -243,7 +240,7 @@ func (client *ReplicationExtensionClient) Get(ctx context.Context, resourceGroup } // getCreateRequest creates the Get request. -func (client *ReplicationExtensionClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, options *ReplicationExtensionClientGetOptions) (*policy.Request, error) { +func (client *ReplicationExtensionClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, _ *ReplicationExtensionClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -266,7 +263,7 @@ func (client *ReplicationExtensionClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -283,7 +280,7 @@ func (client *ReplicationExtensionClient) getHandleResponse(resp *http.Response) // NewListPager - Gets the list of replication extensions in the given vault. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - options - ReplicationExtensionClientListOptions contains the optional parameters for the ReplicationExtensionClient.NewListPager @@ -312,7 +309,7 @@ func (client *ReplicationExtensionClient) NewListPager(resourceGroupName string, } // listCreateRequest creates the List request. -func (client *ReplicationExtensionClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *ReplicationExtensionClientListOptions) (*policy.Request, error) { +func (client *ReplicationExtensionClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, _ *ReplicationExtensionClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -331,7 +328,7 @@ func (client *ReplicationExtensionClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -340,7 +337,7 @@ func (client *ReplicationExtensionClient) listCreateRequest(ctx context.Context, // listHandleResponse handles the List response. func (client *ReplicationExtensionClient) listHandleResponse(resp *http.Response) (ReplicationExtensionClientListResponse, error) { result := ReplicationExtensionClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ReplicationExtensionModelCollection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ReplicationExtensionModelListResult); err != nil { return ReplicationExtensionClientListResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextension_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextension_client_example_test.go deleted file mode 100644 index cdaae3f83073..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextension_client_example_test.go +++ /dev/null @@ -1,175 +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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ReplicationExtension_Get.json -func ExampleReplicationExtensionClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewReplicationExtensionClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "g16yjJ", 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.ReplicationExtensionModel = armrecoveryservicesdatareplication.ReplicationExtensionModel{ - // Name: to.Ptr("xvjffbiecsd"), - // Type: to.Ptr("miadbgilpheilzfoonveznybthgdwh"), - // ID: to.Ptr("awu"), - // Properties: &armrecoveryservicesdatareplication.ReplicationExtensionModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.ReplicationExtensionModelCustomProperties{ - // InstanceType: to.Ptr("ReplicationExtensionModelCustomProperties"), - // }, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // }, - // SystemData: &armrecoveryservicesdatareplication.ReplicationExtensionModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.732Z"); return t}()), - // CreatedBy: to.Ptr("lagtinqhksctfdxmfbpf"), - // CreatedByType: to.Ptr("dsqllpglanwztdmisrknjtqz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.732Z"); return t}()), - // LastModifiedBy: to.Ptr("suwjpejlaya"), - // LastModifiedByType: to.Ptr("nrfjuyghtbivwihr"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ReplicationExtension_Create.json -func ExampleReplicationExtensionClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewReplicationExtensionClient().BeginCreate(ctx, "rgrecoveryservicesdatareplication", "4", "g16yjJ", armrecoveryservicesdatareplication.ReplicationExtensionModel{ - Properties: &armrecoveryservicesdatareplication.ReplicationExtensionModelProperties{ - CustomProperties: &armrecoveryservicesdatareplication.ReplicationExtensionModelCustomProperties{ - InstanceType: to.Ptr("ReplicationExtensionModelCustomProperties"), - }, - }, - }, 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.ReplicationExtensionModel = armrecoveryservicesdatareplication.ReplicationExtensionModel{ - // Name: to.Ptr("xvjffbiecsd"), - // Type: to.Ptr("miadbgilpheilzfoonveznybthgdwh"), - // ID: to.Ptr("awu"), - // Properties: &armrecoveryservicesdatareplication.ReplicationExtensionModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.ReplicationExtensionModelCustomProperties{ - // InstanceType: to.Ptr("ReplicationExtensionModelCustomProperties"), - // }, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // }, - // SystemData: &armrecoveryservicesdatareplication.ReplicationExtensionModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.732Z"); return t}()), - // CreatedBy: to.Ptr("lagtinqhksctfdxmfbpf"), - // CreatedByType: to.Ptr("dsqllpglanwztdmisrknjtqz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.732Z"); return t}()), - // LastModifiedBy: to.Ptr("suwjpejlaya"), - // LastModifiedByType: to.Ptr("nrfjuyghtbivwihr"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ReplicationExtension_Delete.json -func ExampleReplicationExtensionClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewReplicationExtensionClient().BeginDelete(ctx, "rgrecoveryservicesdatareplication", "4", "g16yjJ", 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/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ReplicationExtension_List.json -func ExampleReplicationExtensionClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewReplicationExtensionClient().NewListPager("rgrecoveryservicesdatareplication", "4", 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.ReplicationExtensionModelCollection = armrecoveryservicesdatareplication.ReplicationExtensionModelCollection{ - // Value: []*armrecoveryservicesdatareplication.ReplicationExtensionModel{ - // { - // Name: to.Ptr("xvjffbiecsd"), - // Type: to.Ptr("miadbgilpheilzfoonveznybthgdwh"), - // ID: to.Ptr("awu"), - // Properties: &armrecoveryservicesdatareplication.ReplicationExtensionModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.ReplicationExtensionModelCustomProperties{ - // InstanceType: to.Ptr("ReplicationExtensionModelCustomProperties"), - // }, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // }, - // SystemData: &armrecoveryservicesdatareplication.ReplicationExtensionModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.732Z"); return t}()), - // CreatedBy: to.Ptr("lagtinqhksctfdxmfbpf"), - // CreatedByType: to.Ptr("dsqllpglanwztdmisrknjtqz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.732Z"); return t}()), - // LastModifiedBy: to.Ptr("suwjpejlaya"), - // LastModifiedByType: to.Ptr("nrfjuyghtbivwihr"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextensionoperationstatus_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextensionoperationstatus_client.go deleted file mode 100644 index 43840cb3a36b..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextensionoperationstatus_client.go +++ /dev/null @@ -1,119 +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 armrecoveryservicesdatareplication - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// ReplicationExtensionOperationStatusClient contains the methods for the ReplicationExtensionOperationStatus group. -// Don't use this type directly, use NewReplicationExtensionOperationStatusClient() instead. -type ReplicationExtensionOperationStatusClient struct { - internal *arm.Client - subscriptionID string -} - -// NewReplicationExtensionOperationStatusClient creates a new instance of ReplicationExtensionOperationStatusClient with the specified values. -// - subscriptionID - The ID of the target subscription. The value must be an UUID. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewReplicationExtensionOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationExtensionOperationStatusClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ReplicationExtensionOperationStatusClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Tracks the results of an asynchronous operation on the replication extension. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-02-16-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - vaultName - The vault name. -// - replicationExtensionName - The replication extension name. -// - operationID - The ID of an ongoing async operation. -// - options - ReplicationExtensionOperationStatusClientGetOptions contains the optional parameters for the ReplicationExtensionOperationStatusClient.Get -// method. -func (client *ReplicationExtensionOperationStatusClient) Get(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, operationID string, options *ReplicationExtensionOperationStatusClientGetOptions) (ReplicationExtensionOperationStatusClientGetResponse, error) { - var err error - const operationName = "ReplicationExtensionOperationStatusClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, replicationExtensionName, operationID, options) - if err != nil { - return ReplicationExtensionOperationStatusClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ReplicationExtensionOperationStatusClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ReplicationExtensionOperationStatusClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ReplicationExtensionOperationStatusClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, operationID string, options *ReplicationExtensionOperationStatusClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}/operations/{operationId}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - if replicationExtensionName == "" { - return nil, errors.New("parameter replicationExtensionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{replicationExtensionName}", url.PathEscape(replicationExtensionName)) - if operationID == "" { - return nil, errors.New("parameter operationID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ReplicationExtensionOperationStatusClient) getHandleResponse(resp *http.Response) (ReplicationExtensionOperationStatusClientGetResponse, error) { - result := ReplicationExtensionOperationStatusClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return ReplicationExtensionOperationStatusClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextensionoperationstatus_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextensionoperationstatus_client_example_test.go deleted file mode 100644 index 1dbd0fffc7f6..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextensionoperationstatus_client_example_test.go +++ /dev/null @@ -1,45 +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 armrecoveryservicesdatareplication_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ReplicationExtensionOperationStatus_Get.json -func ExampleReplicationExtensionOperationStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewReplicationExtensionOperationStatusClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "g16yjJ", "wqdqc", 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.OperationStatus = armrecoveryservicesdatareplication.OperationStatus{ - // Name: to.Ptr("wzdasptnwlxgobklayoqapjcgcf"), - // EndTime: to.Ptr("nauyrfh"), - // ID: to.Ptr("sf"), - // StartTime: to.Ptr("xuzwmfrhluafmwwsmzqxsytyehsh"), - // Status: to.Ptr("plbnngzfppdram"), - // } -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/response_types.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/responses.go similarity index 51% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/response_types.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/responses.go index 8d3e756a0220..9d20ad55f34a 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/response_types.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/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. @@ -8,47 +5,18 @@ package armrecoveryservicesdatareplication -// AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityResponse contains the response from method AzureSiteRecoveryManagementServiceAPIClient.CheckNameAvailability. -type AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityResponse struct { +// CheckNameAvailabilityClientPostResponse contains the response from method CheckNameAvailabilityClient.Post. +type CheckNameAvailabilityClientPostResponse struct { // Check name availability response model. CheckNameAvailabilityResponseModel } -// AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightResponse contains the response from method AzureSiteRecoveryManagementServiceAPIClient.DeploymentPreflight. -type AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightResponse struct { +// DeploymentPreflightClientPostResponse contains the response from method DeploymentPreflightClient.Post. +type DeploymentPreflightClientPostResponse struct { // Deployment preflight model. DeploymentPreflightModel } -// DraClientCreateResponse contains the response from method DraClient.BeginCreate. -type DraClientCreateResponse struct { - // Dra model. - DraModel -} - -// DraClientDeleteResponse contains the response from method DraClient.BeginDelete. -type DraClientDeleteResponse struct { - // placeholder for future response values -} - -// DraClientGetResponse contains the response from method DraClient.Get. -type DraClientGetResponse struct { - // Dra model. - DraModel -} - -// DraClientListResponse contains the response from method DraClient.NewListPager. -type DraClientListResponse struct { - // Dra model collection. - DraModelCollection -} - -// DraOperationStatusClientGetResponse contains the response from method DraOperationStatusClient.Get. -type DraOperationStatusClientGetResponse struct { - // Defines the operation status. - OperationStatus -} - // EmailConfigurationClientCreateResponse contains the response from method EmailConfigurationClient.Create. type EmailConfigurationClientCreateResponse struct { // Email configuration model. @@ -63,8 +31,8 @@ type EmailConfigurationClientGetResponse struct { // EmailConfigurationClientListResponse contains the response from method EmailConfigurationClient.NewListPager. type EmailConfigurationClientListResponse struct { - // Email configuration model collection. - EmailConfigurationModelCollection + // The response of a EmailConfigurationModel list operation. + EmailConfigurationModelListResult } // EventClientGetResponse contains the response from method EventClient.Get. @@ -75,8 +43,31 @@ type EventClientGetResponse struct { // EventClientListResponse contains the response from method EventClient.NewListPager. type EventClientListResponse struct { - // Event model collection. - EventModelCollection + // The response of a EventModel list operation. + EventModelListResult +} + +// FabricAgentClientCreateResponse contains the response from method FabricAgentClient.BeginCreate. +type FabricAgentClientCreateResponse struct { + // Fabric agent model. + FabricAgentModel +} + +// FabricAgentClientDeleteResponse contains the response from method FabricAgentClient.BeginDelete. +type FabricAgentClientDeleteResponse struct { + // placeholder for future response values +} + +// FabricAgentClientGetResponse contains the response from method FabricAgentClient.Get. +type FabricAgentClientGetResponse struct { + // Fabric agent model. + FabricAgentModel +} + +// FabricAgentClientListResponse contains the response from method FabricAgentClient.NewListPager. +type FabricAgentClientListResponse struct { + // The response of a FabricAgentModel list operation. + FabricAgentModelListResult } // FabricClientCreateResponse contains the response from method FabricClient.BeginCreate. @@ -98,14 +89,14 @@ type FabricClientGetResponse struct { // FabricClientListBySubscriptionResponse contains the response from method FabricClient.NewListBySubscriptionPager. type FabricClientListBySubscriptionResponse struct { - // Fabric model collection. - FabricModelCollection + // The response of a FabricModel list operation. + FabricModelListResult } // FabricClientListResponse contains the response from method FabricClient.NewListPager. type FabricClientListResponse struct { - // Fabric model collection. - FabricModelCollection + // The response of a FabricModel list operation. + FabricModelListResult } // FabricClientUpdateResponse contains the response from method FabricClient.BeginUpdate. @@ -114,8 +105,26 @@ type FabricClientUpdateResponse struct { FabricModel } -// FabricOperationsStatusClientGetResponse contains the response from method FabricOperationsStatusClient.Get. -type FabricOperationsStatusClientGetResponse struct { +// JobClientGetResponse contains the response from method JobClient.Get. +type JobClientGetResponse struct { + // Job model. + JobModel +} + +// JobClientListResponse contains the response from method JobClient.NewListPager. +type JobClientListResponse struct { + // The response of a JobModel list operation. + JobModelListResult +} + +// LocationBasedOperationResultsClientGetResponse contains the response from method LocationBasedOperationResultsClient.Get. +type LocationBasedOperationResultsClientGetResponse struct { + // Defines the operation status. + OperationStatus +} + +// OperationResultsClientGetResponse contains the response from method OperationResultsClient.Get. +type OperationResultsClientGetResponse struct { // Defines the operation status. OperationStatus } @@ -145,14 +154,72 @@ type PolicyClientGetResponse struct { // PolicyClientListResponse contains the response from method PolicyClient.NewListPager. type PolicyClientListResponse struct { - // Policy model collection. - PolicyModelCollection + // The response of a PolicyModel list operation. + PolicyModelListResult } -// PolicyOperationStatusClientGetResponse contains the response from method PolicyOperationStatusClient.Get. -type PolicyOperationStatusClientGetResponse struct { - // Defines the operation status. - OperationStatus +// PrivateEndpointConnectionProxiesClientCreateResponse contains the response from method PrivateEndpointConnectionProxiesClient.Create. +type PrivateEndpointConnectionProxiesClientCreateResponse struct { + // Represents private endpoint connection proxy request. + PrivateEndpointConnectionProxy +} + +// PrivateEndpointConnectionProxiesClientDeleteResponse contains the response from method PrivateEndpointConnectionProxiesClient.BeginDelete. +type PrivateEndpointConnectionProxiesClientDeleteResponse struct { + // placeholder for future response values +} + +// PrivateEndpointConnectionProxiesClientGetResponse contains the response from method PrivateEndpointConnectionProxiesClient.Get. +type PrivateEndpointConnectionProxiesClientGetResponse struct { + // Represents private endpoint connection proxy request. + PrivateEndpointConnectionProxy +} + +// PrivateEndpointConnectionProxiesClientListResponse contains the response from method PrivateEndpointConnectionProxiesClient.NewListPager. +type PrivateEndpointConnectionProxiesClientListResponse struct { + // The response of a PrivateEndpointConnectionProxy list operation. + PrivateEndpointConnectionProxyListResult +} + +// PrivateEndpointConnectionProxiesClientValidateResponse contains the response from method PrivateEndpointConnectionProxiesClient.Validate. +type PrivateEndpointConnectionProxiesClientValidateResponse struct { + // Represents private endpoint connection proxy request. + PrivateEndpointConnectionProxy +} + +// PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.BeginDelete. +type PrivateEndpointConnectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. +type PrivateEndpointConnectionsClientGetResponse struct { + // Represents private endpoint connection. + PrivateEndpointConnection +} + +// PrivateEndpointConnectionsClientListResponse contains the response from method PrivateEndpointConnectionsClient.NewListPager. +type PrivateEndpointConnectionsClientListResponse struct { + // The response of a PrivateEndpointConnection list operation. + PrivateEndpointConnectionListResult +} + +// PrivateEndpointConnectionsClientUpdateResponse contains the response from method PrivateEndpointConnectionsClient.Update. +type PrivateEndpointConnectionsClientUpdateResponse struct { + // Represents private endpoint connection. + PrivateEndpointConnection +} + +// PrivateLinkResourcesClientGetResponse contains the response from method PrivateLinkResourcesClient.Get. +type PrivateLinkResourcesClientGetResponse struct { + // Represents private link resource. + PrivateLinkResource +} + +// PrivateLinkResourcesClientListResponse contains the response from method PrivateLinkResourcesClient.NewListPager. +type PrivateLinkResourcesClientListResponse struct { + // The response of a PrivateLinkResource list operation. + PrivateLinkResourceListResult } // ProtectedItemClientCreateResponse contains the response from method ProtectedItemClient.BeginCreate. @@ -174,8 +241,8 @@ type ProtectedItemClientGetResponse struct { // ProtectedItemClientListResponse contains the response from method ProtectedItemClient.NewListPager. type ProtectedItemClientListResponse struct { - // Protected item model collection. - ProtectedItemModelCollection + // The response of a ProtectedItemModel list operation. + ProtectedItemModelListResult } // ProtectedItemClientPlannedFailoverResponse contains the response from method ProtectedItemClient.BeginPlannedFailover. @@ -184,22 +251,22 @@ type ProtectedItemClientPlannedFailoverResponse struct { PlannedFailoverModel } -// ProtectedItemOperationStatusClientGetResponse contains the response from method ProtectedItemOperationStatusClient.Get. -type ProtectedItemOperationStatusClientGetResponse struct { - // Defines the operation status. - OperationStatus +// ProtectedItemClientUpdateResponse contains the response from method ProtectedItemClient.BeginUpdate. +type ProtectedItemClientUpdateResponse struct { + // Protected item model. + ProtectedItemModel } -// RecoveryPointsClientGetResponse contains the response from method RecoveryPointsClient.Get. -type RecoveryPointsClientGetResponse struct { +// RecoveryPointClientGetResponse contains the response from method RecoveryPointClient.Get. +type RecoveryPointClientGetResponse struct { // Recovery point model. RecoveryPointModel } -// RecoveryPointsClientListResponse contains the response from method RecoveryPointsClient.NewListPager. -type RecoveryPointsClientListResponse struct { - // Recovery point model collection. - RecoveryPointModelCollection +// RecoveryPointClientListResponse contains the response from method RecoveryPointClient.NewListPager. +type RecoveryPointClientListResponse struct { + // The response of a RecoveryPointModel list operation. + RecoveryPointModelListResult } // ReplicationExtensionClientCreateResponse contains the response from method ReplicationExtensionClient.BeginCreate. @@ -221,14 +288,8 @@ type ReplicationExtensionClientGetResponse struct { // ReplicationExtensionClientListResponse contains the response from method ReplicationExtensionClient.NewListPager. type ReplicationExtensionClientListResponse struct { - // Replication extension model collection. - ReplicationExtensionModelCollection -} - -// ReplicationExtensionOperationStatusClientGetResponse contains the response from method ReplicationExtensionOperationStatusClient.Get. -type ReplicationExtensionOperationStatusClientGetResponse struct { - // Defines the operation status. - OperationStatus + // The response of a ReplicationExtensionModel list operation. + ReplicationExtensionModelListResult } // VaultClientCreateResponse contains the response from method VaultClient.BeginCreate. @@ -250,14 +311,14 @@ type VaultClientGetResponse struct { // VaultClientListBySubscriptionResponse contains the response from method VaultClient.NewListBySubscriptionPager. type VaultClientListBySubscriptionResponse struct { - // Vault model collection. - VaultModelCollection + // The response of a VaultModel list operation. + VaultModelListResult } // VaultClientListResponse contains the response from method VaultClient.NewListPager. type VaultClientListResponse struct { - // Vault model collection. - VaultModelCollection + // The response of a VaultModel list operation. + VaultModelListResult } // VaultClientUpdateResponse contains the response from method VaultClient.BeginUpdate. @@ -265,27 +326,3 @@ type VaultClientUpdateResponse struct { // Vault model. VaultModel } - -// VaultOperationStatusClientGetResponse contains the response from method VaultOperationStatusClient.Get. -type VaultOperationStatusClientGetResponse struct { - // Defines the operation status. - OperationStatus -} - -// WorkflowClientGetResponse contains the response from method WorkflowClient.Get. -type WorkflowClientGetResponse struct { - // Workflow model. - WorkflowModel -} - -// WorkflowClientListResponse contains the response from method WorkflowClient.NewListPager. -type WorkflowClientListResponse struct { - // Workflow model collection. - WorkflowModelCollection -} - -// WorkflowOperationStatusClientGetResponse contains the response from method WorkflowOperationStatusClient.Get. -type WorkflowOperationStatusClientGetResponse struct { - // Defines the operation status. - OperationStatus -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/time_rfc3339.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/time_rfc3339.go index 228806e55873..8b29d83e2ee7 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/time_rfc3339.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/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 diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vault_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vault_client.go index 260141445348..a67b0408ae74 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vault_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vault_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. @@ -46,7 +43,7 @@ func NewVaultClient(subscriptionID string, credential azcore.TokenCredential, op // BeginCreate - Creates the vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - body - Vault properties. @@ -58,7 +55,7 @@ func (client *VaultClient) BeginCreate(ctx context.Context, resourceGroupName st return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VaultClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, Tracer: client.internal.Tracer(), }) return poller, err @@ -72,7 +69,7 @@ func (client *VaultClient) BeginCreate(ctx context.Context, resourceGroupName st // Create - Creates the vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 func (client *VaultClient) create(ctx context.Context, resourceGroupName string, vaultName string, body VaultModel, options *VaultClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "VaultClient.BeginCreate" @@ -95,7 +92,7 @@ func (client *VaultClient) create(ctx context.Context, resourceGroupName string, } // createCreateRequest creates the Create request. -func (client *VaultClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, body VaultModel, options *VaultClientBeginCreateOptions) (*policy.Request, error) { +func (client *VaultClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, body VaultModel, _ *VaultClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -114,7 +111,7 @@ func (client *VaultClient) createCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -126,7 +123,7 @@ func (client *VaultClient) createCreateRequest(ctx context.Context, resourceGrou // BeginDelete - Removes the vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - options - VaultClientBeginDeleteOptions contains the optional parameters for the VaultClient.BeginDelete method. @@ -151,7 +148,7 @@ func (client *VaultClient) BeginDelete(ctx context.Context, resourceGroupName st // Delete - Removes the vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 func (client *VaultClient) deleteOperation(ctx context.Context, resourceGroupName string, vaultName string, options *VaultClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "VaultClient.BeginDelete" @@ -174,7 +171,7 @@ func (client *VaultClient) deleteOperation(ctx context.Context, resourceGroupNam } // deleteCreateRequest creates the Delete request. -func (client *VaultClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *VaultClientBeginDeleteOptions) (*policy.Request, error) { +func (client *VaultClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, _ *VaultClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -193,7 +190,7 @@ func (client *VaultClient) deleteCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -202,7 +199,7 @@ func (client *VaultClient) deleteCreateRequest(ctx context.Context, resourceGrou // Get - Gets the details of the vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - options - VaultClientGetOptions contains the optional parameters for the VaultClient.Get method. @@ -229,7 +226,7 @@ func (client *VaultClient) Get(ctx context.Context, resourceGroupName string, va } // getCreateRequest creates the Get request. -func (client *VaultClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *VaultClientGetOptions) (*policy.Request, error) { +func (client *VaultClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, _ *VaultClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -248,7 +245,7 @@ func (client *VaultClient) getCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -265,7 +262,7 @@ func (client *VaultClient) getHandleResponse(resp *http.Response) (VaultClientGe // NewListPager - Gets the list of vaults in the given subscription and resource group. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - VaultClientListOptions contains the optional parameters for the VaultClient.NewListPager method. func (client *VaultClient) NewListPager(resourceGroupName string, options *VaultClientListOptions) *runtime.Pager[VaultClientListResponse] { @@ -307,10 +304,10 @@ func (client *VaultClient) listCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01") if options != nil && options.ContinuationToken != nil { reqQP.Set("continuationToken", *options.ContinuationToken) } - reqQP.Set("api-version", "2021-02-16-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -319,7 +316,7 @@ func (client *VaultClient) listCreateRequest(ctx context.Context, resourceGroupN // listHandleResponse handles the List response. func (client *VaultClient) listHandleResponse(resp *http.Response) (VaultClientListResponse, error) { result := VaultClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.VaultModelCollection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.VaultModelListResult); err != nil { return VaultClientListResponse{}, err } return result, nil @@ -327,7 +324,7 @@ func (client *VaultClient) listHandleResponse(resp *http.Response) (VaultClientL // NewListBySubscriptionPager - Gets the list of vaults in the given subscription. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - options - VaultClientListBySubscriptionOptions contains the optional parameters for the VaultClient.NewListBySubscriptionPager // method. func (client *VaultClient) NewListBySubscriptionPager(options *VaultClientListBySubscriptionOptions) *runtime.Pager[VaultClientListBySubscriptionResponse] { @@ -354,7 +351,7 @@ func (client *VaultClient) NewListBySubscriptionPager(options *VaultClientListBy } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *VaultClient) listBySubscriptionCreateRequest(ctx context.Context, options *VaultClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *VaultClient) listBySubscriptionCreateRequest(ctx context.Context, _ *VaultClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationVaults" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -365,10 +362,7 @@ func (client *VaultClient) listBySubscriptionCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - if options != nil && options.ContinuationToken != nil { - reqQP.Set("continuationToken", *options.ContinuationToken) - } - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -377,7 +371,7 @@ func (client *VaultClient) listBySubscriptionCreateRequest(ctx context.Context, // listBySubscriptionHandleResponse handles the ListBySubscription response. func (client *VaultClient) listBySubscriptionHandleResponse(resp *http.Response) (VaultClientListBySubscriptionResponse, error) { result := VaultClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.VaultModelCollection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.VaultModelListResult); err != nil { return VaultClientListBySubscriptionResponse{}, err } return result, nil @@ -386,7 +380,7 @@ func (client *VaultClient) listBySubscriptionHandleResponse(resp *http.Response) // BeginUpdate - Performs update on the vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - body - Vault properties. @@ -412,7 +406,7 @@ func (client *VaultClient) BeginUpdate(ctx context.Context, resourceGroupName st // Update - Performs update on the vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 func (client *VaultClient) update(ctx context.Context, resourceGroupName string, vaultName string, body VaultModelUpdate, options *VaultClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "VaultClient.BeginUpdate" @@ -435,7 +429,7 @@ func (client *VaultClient) update(ctx context.Context, resourceGroupName string, } // updateCreateRequest creates the Update request. -func (client *VaultClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, body VaultModelUpdate, options *VaultClientBeginUpdateOptions) (*policy.Request, error) { +func (client *VaultClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, body VaultModelUpdate, _ *VaultClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -454,7 +448,7 @@ func (client *VaultClient) updateCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vault_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vault_client_example_test.go deleted file mode 100644 index f58f7c6cee70..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vault_client_example_test.go +++ /dev/null @@ -1,289 +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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_Get.json -func ExampleVaultClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVaultClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", 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.VaultModel = armrecoveryservicesdatareplication.VaultModel{ - // Name: to.Ptr("bqgyqxmnlgwqxbmajddqwtao"), - // Type: to.Ptr("xtcicpcmjvocohaznrk"), - // ID: to.Ptr("hbccseewgiagaxsjozxgwydjgy"), - // Location: to.Ptr("eck"), - // Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ServiceResourceID: to.Ptr("mksumcmksgdsghojszxq"), - // VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), - // }, - // SystemData: &armrecoveryservicesdatareplication.VaultModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), - // CreatedBy: to.Ptr("rm"), - // CreatedByType: to.Ptr("uojlfokjrhzgqoodsvgz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), - // LastModifiedBy: to.Ptr("gkojzu"), - // LastModifiedByType: to.Ptr("jua"), - // }, - // Tags: map[string]*string{ - // "key5359": to.Ptr("ljfilxolxzuxrauopwtyxghrp"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_Create.json -func ExampleVaultClient_BeginCreate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVaultClient().BeginCreate(ctx, "rgrecoveryservicesdatareplication", "4", armrecoveryservicesdatareplication.VaultModel{ - Location: to.Ptr("eck"), - Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ - VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), - }, - Tags: map[string]*string{ - "key5359": to.Ptr("ljfilxolxzuxrauopwtyxghrp"), - }, - }, 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.VaultModel = armrecoveryservicesdatareplication.VaultModel{ - // Name: to.Ptr("bqgyqxmnlgwqxbmajddqwtao"), - // Type: to.Ptr("xtcicpcmjvocohaznrk"), - // ID: to.Ptr("hbccseewgiagaxsjozxgwydjgy"), - // Location: to.Ptr("eck"), - // Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ServiceResourceID: to.Ptr("mksumcmksgdsghojszxq"), - // VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), - // }, - // SystemData: &armrecoveryservicesdatareplication.VaultModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), - // CreatedBy: to.Ptr("rm"), - // CreatedByType: to.Ptr("uojlfokjrhzgqoodsvgz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), - // LastModifiedBy: to.Ptr("gkojzu"), - // LastModifiedByType: to.Ptr("jua"), - // }, - // Tags: map[string]*string{ - // "key5359": to.Ptr("ljfilxolxzuxrauopwtyxghrp"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_Update.json -func ExampleVaultClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVaultClient().BeginUpdate(ctx, "rgrecoveryservicesdatareplication", "4", armrecoveryservicesdatareplication.VaultModelUpdate{ - Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ - VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), - }, - Tags: map[string]*string{ - "key8872": to.Ptr("pvtc"), - }, - }, 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.VaultModel = armrecoveryservicesdatareplication.VaultModel{ - // Name: to.Ptr("bqgyqxmnlgwqxbmajddqwtao"), - // Type: to.Ptr("xtcicpcmjvocohaznrk"), - // ID: to.Ptr("hbccseewgiagaxsjozxgwydjgy"), - // Location: to.Ptr("eck"), - // Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ServiceResourceID: to.Ptr("mksumcmksgdsghojszxq"), - // VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), - // }, - // SystemData: &armrecoveryservicesdatareplication.VaultModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), - // CreatedBy: to.Ptr("rm"), - // CreatedByType: to.Ptr("uojlfokjrhzgqoodsvgz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), - // LastModifiedBy: to.Ptr("gkojzu"), - // LastModifiedByType: to.Ptr("jua"), - // }, - // Tags: map[string]*string{ - // "key5359": to.Ptr("ljfilxolxzuxrauopwtyxghrp"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_Delete.json -func ExampleVaultClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVaultClient().BeginDelete(ctx, "rgrecoveryservicesdatareplication", "4", 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/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_ListBySubscription.json -func ExampleVaultClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVaultClient().NewListBySubscriptionPager(&armrecoveryservicesdatareplication.VaultClientListBySubscriptionOptions{ContinuationToken: to.Ptr("dqsjhseyugyexxrlrln")}) - 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.VaultModelCollection = armrecoveryservicesdatareplication.VaultModelCollection{ - // Value: []*armrecoveryservicesdatareplication.VaultModel{ - // { - // Name: to.Ptr("bqgyqxmnlgwqxbmajddqwtao"), - // Type: to.Ptr("xtcicpcmjvocohaznrk"), - // ID: to.Ptr("hbccseewgiagaxsjozxgwydjgy"), - // Location: to.Ptr("eck"), - // Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ServiceResourceID: to.Ptr("mksumcmksgdsghojszxq"), - // VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), - // }, - // SystemData: &armrecoveryservicesdatareplication.VaultModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), - // CreatedBy: to.Ptr("rm"), - // CreatedByType: to.Ptr("uojlfokjrhzgqoodsvgz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), - // LastModifiedBy: to.Ptr("gkojzu"), - // LastModifiedByType: to.Ptr("jua"), - // }, - // Tags: map[string]*string{ - // "key5359": to.Ptr("ljfilxolxzuxrauopwtyxghrp"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_List.json -func ExampleVaultClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVaultClient().NewListPager("rgrecoveryservicesdatareplication", &armrecoveryservicesdatareplication.VaultClientListOptions{ContinuationToken: to.Ptr("mwculdaqndp")}) - 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.VaultModelCollection = armrecoveryservicesdatareplication.VaultModelCollection{ - // Value: []*armrecoveryservicesdatareplication.VaultModel{ - // { - // Name: to.Ptr("bqgyqxmnlgwqxbmajddqwtao"), - // Type: to.Ptr("xtcicpcmjvocohaznrk"), - // ID: to.Ptr("hbccseewgiagaxsjozxgwydjgy"), - // Location: to.Ptr("eck"), - // Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ServiceResourceID: to.Ptr("mksumcmksgdsghojszxq"), - // VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), - // }, - // SystemData: &armrecoveryservicesdatareplication.VaultModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), - // CreatedBy: to.Ptr("rm"), - // CreatedByType: to.Ptr("uojlfokjrhzgqoodsvgz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), - // LastModifiedBy: to.Ptr("gkojzu"), - // LastModifiedByType: to.Ptr("jua"), - // }, - // Tags: map[string]*string{ - // "key5359": to.Ptr("ljfilxolxzuxrauopwtyxghrp"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vaultoperationstatus_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vaultoperationstatus_client_example_test.go deleted file mode 100644 index 19de2a72b6a0..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vaultoperationstatus_client_example_test.go +++ /dev/null @@ -1,45 +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 armrecoveryservicesdatareplication_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/VaultOperationStatus_Get.json -func ExampleVaultOperationStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVaultOperationStatusClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "vsdvwe", 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.OperationStatus = armrecoveryservicesdatareplication.OperationStatus{ - // Name: to.Ptr("wzdasptnwlxgobklayoqapjcgcf"), - // EndTime: to.Ptr("nauyrfh"), - // ID: to.Ptr("sf"), - // StartTime: to.Ptr("xuzwmfrhluafmwwsmzqxsytyehsh"), - // Status: to.Ptr("plbnngzfppdram"), - // } -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflow_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflow_client_example_test.go deleted file mode 100644 index 8d903c16530e..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflow_client_example_test.go +++ /dev/null @@ -1,185 +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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Workflow_Get.json -func ExampleWorkflowClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkflowClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "ZGH4y", 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.WorkflowModel = armrecoveryservicesdatareplication.WorkflowModel{ - // Name: to.Ptr("ukii"), - // Type: to.Ptr("cswros"), - // ID: to.Ptr("zsyhbwznbkaia"), - // Properties: &armrecoveryservicesdatareplication.WorkflowModelProperties{ - // ActivityID: to.Ptr("esjvxsa"), - // AllowedActions: []*string{ - // to.Ptr("mfsyvxzgmcpgdzfbbhoxrzhya")}, - // CustomProperties: &armrecoveryservicesdatareplication.WorkflowModelCustomProperties{ - // AffectedObjectDetails: map[string]*string{ - // "key7245": to.Ptr("yllr"), - // }, - // InstanceType: to.Ptr("WorkflowModelCustomProperties"), - // }, - // DisplayName: to.Ptr("dhopzytkd"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), - // Errors: []*armrecoveryservicesdatareplication.ErrorModel{ - // { - // Type: to.Ptr("iyktxohrtrkshbjdhboscsu"), - // Causes: to.Ptr("iffxig"), - // Code: to.Ptr("ndcxzieiuwoxoklilcvjmglml"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), - // Message: to.Ptr("ltuufmxomfecqeyvzrfjqlelytkdwr"), - // Recommendation: to.Ptr("brridkskflo"), - // Severity: to.Ptr("ldgmfmbzmjtqjg"), - // }}, - // ObjectID: to.Ptr("wvtmwiyxqrpqvljzn"), - // ObjectInternalID: to.Ptr("ahbtlwmbeivmlbj"), - // ObjectInternalName: to.Ptr("mxikyrinkeyj"), - // ObjectName: to.Ptr("ieieqaw"), - // ObjectType: to.Ptr(armrecoveryservicesdatareplication.WorkflowObjectTypeAvsDiskPool), - // ReplicationProviderID: to.Ptr("ghxsbnvdkx"), - // SourceFabricProviderID: to.Ptr("yqlertkmzdsgsplzgkmwcttsiagsa"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), - // State: to.Ptr(armrecoveryservicesdatareplication.WorkflowStatePending), - // TargetFabricProviderID: to.Ptr("stjlmqzpgnrug"), - // Tasks: []*armrecoveryservicesdatareplication.TaskModel{ - // { - // ChildrenWorkflows: []*armrecoveryservicesdatareplication.WorkflowModel{ - // }, - // CustomProperties: &armrecoveryservicesdatareplication.TaskModelCustomProperties{ - // InstanceType: to.Ptr("aaqgqvnhskxpsbnrdekxaghweon"), - // }, - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), - // State: to.Ptr(armrecoveryservicesdatareplication.TaskStatePending), - // TaskName: to.Ptr("flkzfbbpngqbbjsdqysqfon"), - // }}, - // }, - // SystemData: &armrecoveryservicesdatareplication.WorkflowModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.270Z"); return t}()), - // CreatedBy: to.Ptr("jurgsdagntjg"), - // CreatedByType: to.Ptr("zowfl"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.270Z"); return t}()), - // LastModifiedBy: to.Ptr("vuw"), - // LastModifiedByType: to.Ptr("h"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Workflow_List.json -func ExampleWorkflowClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWorkflowClient().NewListPager("rgrecoveryservicesdatareplication", "4", &armrecoveryservicesdatareplication.WorkflowClientListOptions{Filter: to.Ptr("mnebpgmjcitjleipnttx"), - ContinuationToken: to.Ptr("rdavrzbethhslmkqgajontnxsue"), - }) - 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.WorkflowModelCollection = armrecoveryservicesdatareplication.WorkflowModelCollection{ - // Value: []*armrecoveryservicesdatareplication.WorkflowModel{ - // { - // Name: to.Ptr("ukii"), - // Type: to.Ptr("cswros"), - // ID: to.Ptr("zsyhbwznbkaia"), - // Properties: &armrecoveryservicesdatareplication.WorkflowModelProperties{ - // ActivityID: to.Ptr("esjvxsa"), - // AllowedActions: []*string{ - // to.Ptr("mfsyvxzgmcpgdzfbbhoxrzhya")}, - // CustomProperties: &armrecoveryservicesdatareplication.WorkflowModelCustomProperties{ - // AffectedObjectDetails: map[string]*string{ - // "key7245": to.Ptr("yllr"), - // }, - // InstanceType: to.Ptr("WorkflowModelCustomProperties"), - // }, - // DisplayName: to.Ptr("dhopzytkd"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), - // Errors: []*armrecoveryservicesdatareplication.ErrorModel{ - // { - // Type: to.Ptr("iyktxohrtrkshbjdhboscsu"), - // Causes: to.Ptr("iffxig"), - // Code: to.Ptr("ndcxzieiuwoxoklilcvjmglml"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), - // Message: to.Ptr("ltuufmxomfecqeyvzrfjqlelytkdwr"), - // Recommendation: to.Ptr("brridkskflo"), - // Severity: to.Ptr("ldgmfmbzmjtqjg"), - // }}, - // ObjectID: to.Ptr("wvtmwiyxqrpqvljzn"), - // ObjectInternalID: to.Ptr("ahbtlwmbeivmlbj"), - // ObjectInternalName: to.Ptr("mxikyrinkeyj"), - // ObjectName: to.Ptr("ieieqaw"), - // ObjectType: to.Ptr(armrecoveryservicesdatareplication.WorkflowObjectTypeAvsDiskPool), - // ReplicationProviderID: to.Ptr("ghxsbnvdkx"), - // SourceFabricProviderID: to.Ptr("yqlertkmzdsgsplzgkmwcttsiagsa"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), - // State: to.Ptr(armrecoveryservicesdatareplication.WorkflowStatePending), - // TargetFabricProviderID: to.Ptr("stjlmqzpgnrug"), - // Tasks: []*armrecoveryservicesdatareplication.TaskModel{ - // { - // ChildrenWorkflows: []*armrecoveryservicesdatareplication.WorkflowModel{ - // }, - // CustomProperties: &armrecoveryservicesdatareplication.TaskModelCustomProperties{ - // InstanceType: to.Ptr("aaqgqvnhskxpsbnrdekxaghweon"), - // }, - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), - // State: to.Ptr(armrecoveryservicesdatareplication.TaskStatePending), - // TaskName: to.Ptr("flkzfbbpngqbbjsdqysqfon"), - // }}, - // }, - // SystemData: &armrecoveryservicesdatareplication.WorkflowModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.270Z"); return t}()), - // CreatedBy: to.Ptr("jurgsdagntjg"), - // CreatedByType: to.Ptr("zowfl"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.270Z"); return t}()), - // LastModifiedBy: to.Ptr("vuw"), - // LastModifiedByType: to.Ptr("h"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflowoperationstatus_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflowoperationstatus_client.go deleted file mode 100644 index 169e213fbda4..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflowoperationstatus_client.go +++ /dev/null @@ -1,119 +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 armrecoveryservicesdatareplication - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// WorkflowOperationStatusClient contains the methods for the WorkflowOperationStatus group. -// Don't use this type directly, use NewWorkflowOperationStatusClient() instead. -type WorkflowOperationStatusClient struct { - internal *arm.Client - subscriptionID string -} - -// NewWorkflowOperationStatusClient creates a new instance of WorkflowOperationStatusClient with the specified values. -// - subscriptionID - The ID of the target subscription. The value must be an UUID. -// - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. -func NewWorkflowOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkflowOperationStatusClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &WorkflowOperationStatusClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Tracks the results of an asynchronous operation on the job. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-02-16-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - vaultName - The vault name. -// - jobName - The job (workflow) name. -// - operationID - The ID of an ongoing async operation. -// - options - WorkflowOperationStatusClientGetOptions contains the optional parameters for the WorkflowOperationStatusClient.Get -// method. -func (client *WorkflowOperationStatusClient) Get(ctx context.Context, resourceGroupName string, vaultName string, jobName string, operationID string, options *WorkflowOperationStatusClientGetOptions) (WorkflowOperationStatusClientGetResponse, error) { - var err error - const operationName = "WorkflowOperationStatusClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, vaultName, jobName, operationID, options) - if err != nil { - return WorkflowOperationStatusClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return WorkflowOperationStatusClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return WorkflowOperationStatusClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *WorkflowOperationStatusClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, jobName string, operationID string, options *WorkflowOperationStatusClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs/{jobName}/operations/{operationId}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - if jobName == "" { - return nil, errors.New("parameter jobName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) - if operationID == "" { - return nil, errors.New("parameter operationID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *WorkflowOperationStatusClient) getHandleResponse(resp *http.Response) (WorkflowOperationStatusClientGetResponse, error) { - result := WorkflowOperationStatusClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return WorkflowOperationStatusClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflowoperationstatus_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflowoperationstatus_client_example_test.go deleted file mode 100644 index 1ce990863bc7..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflowoperationstatus_client_example_test.go +++ /dev/null @@ -1,45 +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 armrecoveryservicesdatareplication_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/WorkflowOperationStatus_Get.json -func ExampleWorkflowOperationStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkflowOperationStatusClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "ZGH4y", "wdqcxc", 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.OperationStatus = armrecoveryservicesdatareplication.OperationStatus{ - // Name: to.Ptr("wzdasptnwlxgobklayoqapjcgcf"), - // EndTime: to.Ptr("nauyrfh"), - // ID: to.Ptr("sf"), - // StartTime: to.Ptr("xuzwmfrhluafmwwsmzqxsytyehsh"), - // Status: to.Ptr("plbnngzfppdram"), - // } -} diff --git a/sdk/resourcemanager/scvmm/armscvmm/CHANGELOG.md b/sdk/resourcemanager/scvmm/armscvmm/CHANGELOG.md index 4b4702a05b07..34cf7692a278 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/CHANGELOG.md +++ b/sdk/resourcemanager/scvmm/armscvmm/CHANGELOG.md @@ -1,5 +1,19 @@ # Release History +## 2.0.0 (2025-04-27) +### Breaking Changes + +- Function `*VirtualMachineInstancesClient.BeginStop` parameter(s) have been changed from `(context.Context, string, StopVirtualMachineOptions, *VirtualMachineInstancesClientBeginStopOptions)` to `(context.Context, string, *VirtualMachineInstancesClientBeginStopOptions)` + +### Features Added + +- New field `StorageGB` in struct `CloudCapacity` +- New field `PrivateLinkScopeResourceID` in struct `GuestAgentProperties` +- New field `AdminUsername`, `DomainName`, `DomainPassword`, `DomainUsername`, `ProductKey`, `RunOnceCommands`, `Timezone`, `Workgroup` in struct `OsProfileForVMInstance` +- New field `Body` in struct `VirtualMachineInstancesClientBeginStopOptions` +- New field `Generation` in struct `VirtualMachineInventoryItem` + + ## 1.0.0 (2024-06-28) ### Breaking Changes diff --git a/sdk/resourcemanager/scvmm/armscvmm/README.md b/sdk/resourcemanager/scvmm/armscvmm/README.md index 180217e2a9f8..f885b9c9d3c0 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/README.md +++ b/sdk/resourcemanager/scvmm/armscvmm/README.md @@ -18,7 +18,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure Scvmm module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/scvmm/armscvmm +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/scvmm/armscvmm/v2 ``` ## Authorization diff --git a/sdk/resourcemanager/scvmm/armscvmm/autorest.md b/sdk/resourcemanager/scvmm/armscvmm/autorest.md index be912d6e1c0c..60d923df049d 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/autorest.md +++ b/sdk/resourcemanager/scvmm/armscvmm/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/scvmm/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/scvmm/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 -tag: package-2023-10 +module-version: 2.0.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/scvmm/armscvmm/availabilitysets_client.go b/sdk/resourcemanager/scvmm/armscvmm/availabilitysets_client.go index cea845178f08..f5c279e695ef 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/availabilitysets_client.go +++ b/sdk/resourcemanager/scvmm/armscvmm/availabilitysets_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. @@ -46,7 +43,7 @@ func NewAvailabilitySetsClient(subscriptionID string, credential azcore.TokenCre // BeginCreateOrUpdate - Onboards the ScVmm availability set as an Azure resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - availabilitySetResourceName - Name of the AvailabilitySet. // - resource - Resource create parameters. @@ -73,7 +70,7 @@ func (client *AvailabilitySetsClient) BeginCreateOrUpdate(ctx context.Context, r // CreateOrUpdate - Onboards the ScVmm availability set as an Azure resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 func (client *AvailabilitySetsClient) createOrUpdate(ctx context.Context, resourceGroupName string, availabilitySetResourceName string, resource AvailabilitySet, options *AvailabilitySetsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "AvailabilitySetsClient.BeginCreateOrUpdate" @@ -96,7 +93,7 @@ func (client *AvailabilitySetsClient) createOrUpdate(ctx context.Context, resour } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *AvailabilitySetsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, availabilitySetResourceName string, resource AvailabilitySet, options *AvailabilitySetsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *AvailabilitySetsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, availabilitySetResourceName string, resource AvailabilitySet, _ *AvailabilitySetsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetResourceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -115,7 +112,7 @@ func (client *AvailabilitySetsClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -127,7 +124,7 @@ func (client *AvailabilitySetsClient) createOrUpdateCreateRequest(ctx context.Co // BeginDelete - Deregisters the ScVmm availability set from Azure. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - availabilitySetResourceName - Name of the AvailabilitySet. // - options - AvailabilitySetsClientBeginDeleteOptions contains the optional parameters for the AvailabilitySetsClient.BeginDelete @@ -153,7 +150,7 @@ func (client *AvailabilitySetsClient) BeginDelete(ctx context.Context, resourceG // Delete - Deregisters the ScVmm availability set from Azure. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 func (client *AvailabilitySetsClient) deleteOperation(ctx context.Context, resourceGroupName string, availabilitySetResourceName string, options *AvailabilitySetsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "AvailabilitySetsClient.BeginDelete" @@ -195,7 +192,7 @@ func (client *AvailabilitySetsClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") if options != nil && options.Force != nil { reqQP.Set("force", string(*options.Force)) } @@ -207,7 +204,7 @@ func (client *AvailabilitySetsClient) deleteCreateRequest(ctx context.Context, r // Get - Implements AvailabilitySet GET method. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - availabilitySetResourceName - Name of the AvailabilitySet. // - options - AvailabilitySetsClientGetOptions contains the optional parameters for the AvailabilitySetsClient.Get method. @@ -234,7 +231,7 @@ func (client *AvailabilitySetsClient) Get(ctx context.Context, resourceGroupName } // getCreateRequest creates the Get request. -func (client *AvailabilitySetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, availabilitySetResourceName string, options *AvailabilitySetsClientGetOptions) (*policy.Request, error) { +func (client *AvailabilitySetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, availabilitySetResourceName string, _ *AvailabilitySetsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetResourceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -253,7 +250,7 @@ func (client *AvailabilitySetsClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -270,7 +267,7 @@ func (client *AvailabilitySetsClient) getHandleResponse(resp *http.Response) (Av // NewListByResourceGroupPager - List of AvailabilitySets in a resource group. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - AvailabilitySetsClientListByResourceGroupOptions contains the optional parameters for the AvailabilitySetsClient.NewListByResourceGroupPager // method. @@ -298,7 +295,7 @@ func (client *AvailabilitySetsClient) NewListByResourceGroupPager(resourceGroupN } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *AvailabilitySetsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AvailabilitySetsClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *AvailabilitySetsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *AvailabilitySetsClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -313,7 +310,7 @@ func (client *AvailabilitySetsClient) listByResourceGroupCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -330,7 +327,7 @@ func (client *AvailabilitySetsClient) listByResourceGroupHandleResponse(resp *ht // NewListBySubscriptionPager - List of AvailabilitySets in a subscription. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - options - AvailabilitySetsClientListBySubscriptionOptions contains the optional parameters for the AvailabilitySetsClient.NewListBySubscriptionPager // method. func (client *AvailabilitySetsClient) NewListBySubscriptionPager(options *AvailabilitySetsClientListBySubscriptionOptions) *runtime.Pager[AvailabilitySetsClientListBySubscriptionResponse] { @@ -357,7 +354,7 @@ func (client *AvailabilitySetsClient) NewListBySubscriptionPager(options *Availa } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *AvailabilitySetsClient) listBySubscriptionCreateRequest(ctx context.Context, options *AvailabilitySetsClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *AvailabilitySetsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *AvailabilitySetsClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/availabilitySets" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -368,7 +365,7 @@ func (client *AvailabilitySetsClient) listBySubscriptionCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -386,7 +383,7 @@ func (client *AvailabilitySetsClient) listBySubscriptionHandleResponse(resp *htt // BeginUpdate - Updates the AvailabilitySets resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - availabilitySetResourceName - Name of the AvailabilitySet. // - properties - The resource properties to be updated. @@ -413,7 +410,7 @@ func (client *AvailabilitySetsClient) BeginUpdate(ctx context.Context, resourceG // Update - Updates the AvailabilitySets resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 func (client *AvailabilitySetsClient) update(ctx context.Context, resourceGroupName string, availabilitySetResourceName string, properties AvailabilitySetTagsUpdate, options *AvailabilitySetsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "AvailabilitySetsClient.BeginUpdate" @@ -436,7 +433,7 @@ func (client *AvailabilitySetsClient) update(ctx context.Context, resourceGroupN } // updateCreateRequest creates the Update request. -func (client *AvailabilitySetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, availabilitySetResourceName string, properties AvailabilitySetTagsUpdate, options *AvailabilitySetsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *AvailabilitySetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, availabilitySetResourceName string, properties AvailabilitySetTagsUpdate, _ *AvailabilitySetsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/availabilitySets/{availabilitySetResourceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -455,7 +452,7 @@ func (client *AvailabilitySetsClient) updateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, properties); err != nil { diff --git a/sdk/resourcemanager/scvmm/armscvmm/availabilitysets_client_example_test.go b/sdk/resourcemanager/scvmm/armscvmm/availabilitysets_client_example_test.go deleted file mode 100644 index de9ef8437cfa..000000000000 --- a/sdk/resourcemanager/scvmm/armscvmm/availabilitysets_client_example_test.go +++ /dev/null @@ -1,488 +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 armscvmm_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/scvmm/armscvmm" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/AvailabilitySets_ListBySubscription_MaximumSet_Gen.json -func ExampleAvailabilitySetsClient_NewListBySubscriptionPager_availabilitySetsListBySubscriptionMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAvailabilitySetsClient().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.AvailabilitySetListResult = armscvmm.AvailabilitySetListResult{ - // Value: []*armscvmm.AvailabilitySet{ - // { - // Name: to.Ptr("dibfuxyuidzxcfik"), - // Type: to.Ptr("xwzjruksexpuqgtreexm"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/availabilitySets/availabilitySetResourceName"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Location: to.Ptr("jelevilan"), - // Tags: map[string]*string{ - // "key5701": to.Ptr("cldtxloqh"), - // }, - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - // Type: to.Ptr("customLocation"), - // }, - // Properties: &armscvmm.AvailabilitySetProperties{ - // AvailabilitySetName: to.Ptr("njrpftunzo"), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // VmmServerID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/AvailabilitySets_ListBySubscription_MinimumSet_Gen.json -func ExampleAvailabilitySetsClient_NewListBySubscriptionPager_availabilitySetsListBySubscriptionMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAvailabilitySetsClient().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.AvailabilitySetListResult = armscvmm.AvailabilitySetListResult{ - // Value: []*armscvmm.AvailabilitySet{ - // { - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/availabilitySets/availabilitySetResourceName"), - // Location: to.Ptr("jelevilan"), - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/AvailabilitySets_ListByResourceGroup_MaximumSet_Gen.json -func ExampleAvailabilitySetsClient_NewListByResourceGroupPager_availabilitySetsListByResourceGroupMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAvailabilitySetsClient().NewListByResourceGroupPager("rgscvmm", 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.AvailabilitySetListResult = armscvmm.AvailabilitySetListResult{ - // Value: []*armscvmm.AvailabilitySet{ - // { - // Name: to.Ptr("dibfuxyuidzxcfik"), - // Type: to.Ptr("xwzjruksexpuqgtreexm"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/availabilitySets/availabilitySetResourceName"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Location: to.Ptr("jelevilan"), - // Tags: map[string]*string{ - // "key5701": to.Ptr("cldtxloqh"), - // }, - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - // Type: to.Ptr("customLocation"), - // }, - // Properties: &armscvmm.AvailabilitySetProperties{ - // AvailabilitySetName: to.Ptr("njrpftunzo"), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // VmmServerID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/AvailabilitySets_ListByResourceGroup_MinimumSet_Gen.json -func ExampleAvailabilitySetsClient_NewListByResourceGroupPager_availabilitySetsListByResourceGroupMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAvailabilitySetsClient().NewListByResourceGroupPager("rgscvmm", 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.AvailabilitySetListResult = armscvmm.AvailabilitySetListResult{ - // Value: []*armscvmm.AvailabilitySet{ - // { - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/availabilitySets/availabilitySetResourceName"), - // Location: to.Ptr("jelevilan"), - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/AvailabilitySets_Get_MaximumSet_Gen.json -func ExampleAvailabilitySetsClient_Get_availabilitySetsGetMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAvailabilitySetsClient().Get(ctx, "rgscvmm", "-", 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.AvailabilitySet = armscvmm.AvailabilitySet{ - // Name: to.Ptr("dibfuxyuidzxcfik"), - // Type: to.Ptr("xwzjruksexpuqgtreexm"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/availabilitySets/availabilitySetResourceName"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Location: to.Ptr("jelevilan"), - // Tags: map[string]*string{ - // "key5701": to.Ptr("cldtxloqh"), - // }, - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - // Type: to.Ptr("customLocation"), - // }, - // Properties: &armscvmm.AvailabilitySetProperties{ - // AvailabilitySetName: to.Ptr("njrpftunzo"), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // VmmServerID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/AvailabilitySets_Get_MinimumSet_Gen.json -func ExampleAvailabilitySetsClient_Get_availabilitySetsGetMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAvailabilitySetsClient().Get(ctx, "rgscvmm", "V", 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.AvailabilitySet = armscvmm.AvailabilitySet{ - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/availabilitySets/availabilitySetResourceName"), - // Location: to.Ptr("jelevilan"), - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/AvailabilitySets_CreateOrUpdate_MaximumSet_Gen.json -func ExampleAvailabilitySetsClient_BeginCreateOrUpdate_availabilitySetsCreateOrUpdateMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAvailabilitySetsClient().BeginCreateOrUpdate(ctx, "rgscvmm", "-", armscvmm.AvailabilitySet{ - Location: to.Ptr("jelevilan"), - Tags: map[string]*string{ - "key5701": to.Ptr("cldtxloqh"), - }, - ExtendedLocation: &armscvmm.ExtendedLocation{ - Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - Type: to.Ptr("customLocation"), - }, - Properties: &armscvmm.AvailabilitySetProperties{ - AvailabilitySetName: to.Ptr("njrpftunzo"), - VmmServerID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - }, - }, 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.AvailabilitySet = armscvmm.AvailabilitySet{ - // Name: to.Ptr("dibfuxyuidzxcfik"), - // Type: to.Ptr("xwzjruksexpuqgtreexm"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/availabilitySets/availabilitySetResourceName"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Location: to.Ptr("jelevilan"), - // Tags: map[string]*string{ - // "key5701": to.Ptr("cldtxloqh"), - // }, - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - // Type: to.Ptr("customLocation"), - // }, - // Properties: &armscvmm.AvailabilitySetProperties{ - // AvailabilitySetName: to.Ptr("njrpftunzo"), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // VmmServerID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/AvailabilitySets_CreateOrUpdate_MinimumSet_Gen.json -func ExampleAvailabilitySetsClient_BeginCreateOrUpdate_availabilitySetsCreateOrUpdateMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAvailabilitySetsClient().BeginCreateOrUpdate(ctx, "rgscvmm", "_", armscvmm.AvailabilitySet{ - Location: to.Ptr("jelevilan"), - ExtendedLocation: &armscvmm.ExtendedLocation{}, - }, 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.AvailabilitySet = armscvmm.AvailabilitySet{ - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/availabilitySets/availabilitySetResourceName"), - // Location: to.Ptr("jelevilan"), - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/AvailabilitySets_Update_MaximumSet_Gen.json -func ExampleAvailabilitySetsClient_BeginUpdate_availabilitySetsUpdateMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAvailabilitySetsClient().BeginUpdate(ctx, "rgscvmm", "-", armscvmm.AvailabilitySetTagsUpdate{ - Tags: map[string]*string{ - "key1460": to.Ptr("vcbwibkvr"), - }, - }, 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.AvailabilitySet = armscvmm.AvailabilitySet{ - // Name: to.Ptr("dibfuxyuidzxcfik"), - // Type: to.Ptr("xwzjruksexpuqgtreexm"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/availabilitySets/availabilitySetResourceName"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Location: to.Ptr("jelevilan"), - // Tags: map[string]*string{ - // "key5701": to.Ptr("cldtxloqh"), - // }, - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - // Type: to.Ptr("customLocation"), - // }, - // Properties: &armscvmm.AvailabilitySetProperties{ - // AvailabilitySetName: to.Ptr("njrpftunzo"), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // VmmServerID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/AvailabilitySets_Update_MinimumSet_Gen.json -func ExampleAvailabilitySetsClient_BeginUpdate_availabilitySetsUpdateMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAvailabilitySetsClient().BeginUpdate(ctx, "rgscvmm", "1", armscvmm.AvailabilitySetTagsUpdate{}, 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.AvailabilitySet = armscvmm.AvailabilitySet{ - // Location: to.Ptr("jelevilan"), - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/AvailabilitySets_Delete_MaximumSet_Gen.json -func ExampleAvailabilitySetsClient_BeginDelete_availabilitySetsDeleteMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAvailabilitySetsClient().BeginDelete(ctx, "rgscvmm", "_", &armscvmm.AvailabilitySetsClientBeginDeleteOptions{Force: to.Ptr(armscvmm.ForceDeleteTrue)}) - 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/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/AvailabilitySets_Delete_MinimumSet_Gen.json -func ExampleAvailabilitySetsClient_BeginDelete_availabilitySetsDeleteMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAvailabilitySetsClient().BeginDelete(ctx, "rgscvmm", "6", &armscvmm.AvailabilitySetsClientBeginDeleteOptions{Force: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/scvmm/armscvmm/client_factory.go b/sdk/resourcemanager/scvmm/armscvmm/client_factory.go index 09d6b51885d0..f3376127ef61 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/client_factory.go +++ b/sdk/resourcemanager/scvmm/armscvmm/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. diff --git a/sdk/resourcemanager/scvmm/armscvmm/clouds_client.go b/sdk/resourcemanager/scvmm/armscvmm/clouds_client.go index defd671ed809..24cfdf0ccb69 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/clouds_client.go +++ b/sdk/resourcemanager/scvmm/armscvmm/clouds_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. @@ -46,7 +43,7 @@ func NewCloudsClient(subscriptionID string, credential azcore.TokenCredential, o // BeginCreateOrUpdate - Onboards the ScVmm fabric cloud as an Azure cloud resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudResourceName - Name of the Cloud. // - resource - Resource create parameters. @@ -73,7 +70,7 @@ func (client *CloudsClient) BeginCreateOrUpdate(ctx context.Context, resourceGro // CreateOrUpdate - Onboards the ScVmm fabric cloud as an Azure cloud resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 func (client *CloudsClient) createOrUpdate(ctx context.Context, resourceGroupName string, cloudResourceName string, resource Cloud, options *CloudsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "CloudsClient.BeginCreateOrUpdate" @@ -96,7 +93,7 @@ func (client *CloudsClient) createOrUpdate(ctx context.Context, resourceGroupNam } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *CloudsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, cloudResourceName string, resource Cloud, options *CloudsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *CloudsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, cloudResourceName string, resource Cloud, _ *CloudsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudResourceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -115,7 +112,7 @@ func (client *CloudsClient) createOrUpdateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -127,7 +124,7 @@ func (client *CloudsClient) createOrUpdateCreateRequest(ctx context.Context, res // BeginDelete - Deregisters the ScVmm fabric cloud from Azure. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudResourceName - Name of the Cloud. // - options - CloudsClientBeginDeleteOptions contains the optional parameters for the CloudsClient.BeginDelete method. @@ -152,7 +149,7 @@ func (client *CloudsClient) BeginDelete(ctx context.Context, resourceGroupName s // Delete - Deregisters the ScVmm fabric cloud from Azure. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 func (client *CloudsClient) deleteOperation(ctx context.Context, resourceGroupName string, cloudResourceName string, options *CloudsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "CloudsClient.BeginDelete" @@ -194,7 +191,7 @@ func (client *CloudsClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") if options != nil && options.Force != nil { reqQP.Set("force", string(*options.Force)) } @@ -206,7 +203,7 @@ func (client *CloudsClient) deleteCreateRequest(ctx context.Context, resourceGro // Get - Implements Cloud GET method. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudResourceName - Name of the Cloud. // - options - CloudsClientGetOptions contains the optional parameters for the CloudsClient.Get method. @@ -233,7 +230,7 @@ func (client *CloudsClient) Get(ctx context.Context, resourceGroupName string, c } // getCreateRequest creates the Get request. -func (client *CloudsClient) getCreateRequest(ctx context.Context, resourceGroupName string, cloudResourceName string, options *CloudsClientGetOptions) (*policy.Request, error) { +func (client *CloudsClient) getCreateRequest(ctx context.Context, resourceGroupName string, cloudResourceName string, _ *CloudsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudResourceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -252,7 +249,7 @@ func (client *CloudsClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -269,7 +266,7 @@ func (client *CloudsClient) getHandleResponse(resp *http.Response) (CloudsClient // NewListByResourceGroupPager - List of Clouds in a resource group. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - CloudsClientListByResourceGroupOptions contains the optional parameters for the CloudsClient.NewListByResourceGroupPager // method. @@ -297,7 +294,7 @@ func (client *CloudsClient) NewListByResourceGroupPager(resourceGroupName string } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *CloudsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *CloudsClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *CloudsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *CloudsClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -312,7 +309,7 @@ func (client *CloudsClient) listByResourceGroupCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -329,7 +326,7 @@ func (client *CloudsClient) listByResourceGroupHandleResponse(resp *http.Respons // NewListBySubscriptionPager - List of Clouds in a subscription. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - options - CloudsClientListBySubscriptionOptions contains the optional parameters for the CloudsClient.NewListBySubscriptionPager // method. func (client *CloudsClient) NewListBySubscriptionPager(options *CloudsClientListBySubscriptionOptions) *runtime.Pager[CloudsClientListBySubscriptionResponse] { @@ -356,7 +353,7 @@ func (client *CloudsClient) NewListBySubscriptionPager(options *CloudsClientList } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *CloudsClient) listBySubscriptionCreateRequest(ctx context.Context, options *CloudsClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *CloudsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *CloudsClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/clouds" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -367,7 +364,7 @@ func (client *CloudsClient) listBySubscriptionCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -385,7 +382,7 @@ func (client *CloudsClient) listBySubscriptionHandleResponse(resp *http.Response // BeginUpdate - Updates the Clouds resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudResourceName - Name of the Cloud. // - properties - The resource properties to be updated. @@ -411,7 +408,7 @@ func (client *CloudsClient) BeginUpdate(ctx context.Context, resourceGroupName s // Update - Updates the Clouds resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 func (client *CloudsClient) update(ctx context.Context, resourceGroupName string, cloudResourceName string, properties CloudTagsUpdate, options *CloudsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "CloudsClient.BeginUpdate" @@ -434,7 +431,7 @@ func (client *CloudsClient) update(ctx context.Context, resourceGroupName string } // updateCreateRequest creates the Update request. -func (client *CloudsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, cloudResourceName string, properties CloudTagsUpdate, options *CloudsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *CloudsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, cloudResourceName string, properties CloudTagsUpdate, _ *CloudsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/clouds/{cloudResourceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -453,7 +450,7 @@ func (client *CloudsClient) updateCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, properties); err != nil { diff --git a/sdk/resourcemanager/scvmm/armscvmm/clouds_client_example_test.go b/sdk/resourcemanager/scvmm/armscvmm/clouds_client_example_test.go deleted file mode 100644 index 13b1ecee71db..000000000000 --- a/sdk/resourcemanager/scvmm/armscvmm/clouds_client_example_test.go +++ /dev/null @@ -1,570 +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 armscvmm_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/scvmm/armscvmm" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/Clouds_ListBySubscription_MaximumSet_Gen.json -func ExampleCloudsClient_NewListBySubscriptionPager_cloudsListBySubscriptionMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudsClient().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.CloudListResult = armscvmm.CloudListResult{ - // Value: []*armscvmm.Cloud{ - // { - // Name: to.Ptr("wwcwalpiufsfbnydxpr"), - // Type: to.Ptr("qnaaimszbuokldohwrdfuiitpy"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/clouds/cloudResourceName"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Location: to.Ptr("khwsdmaxfhmbu"), - // Tags: map[string]*string{ - // "key4295": to.Ptr("wngosgcbdifaxdobufuuqxtho"), - // }, - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - // Type: to.Ptr("customLocation"), - // }, - // Properties: &armscvmm.CloudProperties{ - // CloudCapacity: &armscvmm.CloudCapacity{ - // CPUCount: to.Ptr[int64](4), - // MemoryMB: to.Ptr[int64](19), - // VMCount: to.Ptr[int64](28), - // }, - // CloudName: to.Ptr("menarjsplhcqvnkjdwieroir"), - // InventoryItemID: to.Ptr("qjd"), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // StorageQosPolicies: []*armscvmm.StorageQosPolicy{ - // { - // Name: to.Ptr("hvqcentnbwcunxhzfavyewhwlo"), - // BandwidthLimit: to.Ptr[int64](26), - // ID: to.Ptr("oclhgkydaw"), - // IopsMaximum: to.Ptr[int64](6), - // IopsMinimum: to.Ptr[int64](25), - // PolicyID: to.Ptr("lvcylbmxrqjgarvhfny"), - // }}, - // UUID: to.Ptr("12345678-1234-1234-1234-12345678abcd"), - // VmmServerID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/Clouds_ListBySubscription_MinimumSet_Gen.json -func ExampleCloudsClient_NewListBySubscriptionPager_cloudsListBySubscriptionMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudsClient().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.CloudListResult = armscvmm.CloudListResult{ - // Value: []*armscvmm.Cloud{ - // { - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/clouds/cloudResourceName"), - // Location: to.Ptr("khwsdmaxfhmbu"), - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/Clouds_ListByResourceGroup_MaximumSet_Gen.json -func ExampleCloudsClient_NewListByResourceGroupPager_cloudsListByResourceGroupMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudsClient().NewListByResourceGroupPager("rgscvmm", 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.CloudListResult = armscvmm.CloudListResult{ - // Value: []*armscvmm.Cloud{ - // { - // Name: to.Ptr("wwcwalpiufsfbnydxpr"), - // Type: to.Ptr("qnaaimszbuokldohwrdfuiitpy"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/clouds/cloudResourceName"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Location: to.Ptr("khwsdmaxfhmbu"), - // Tags: map[string]*string{ - // "key4295": to.Ptr("wngosgcbdifaxdobufuuqxtho"), - // }, - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - // Type: to.Ptr("customLocation"), - // }, - // Properties: &armscvmm.CloudProperties{ - // CloudCapacity: &armscvmm.CloudCapacity{ - // CPUCount: to.Ptr[int64](4), - // MemoryMB: to.Ptr[int64](19), - // VMCount: to.Ptr[int64](28), - // }, - // CloudName: to.Ptr("menarjsplhcqvnkjdwieroir"), - // InventoryItemID: to.Ptr("qjd"), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // StorageQosPolicies: []*armscvmm.StorageQosPolicy{ - // { - // Name: to.Ptr("hvqcentnbwcunxhzfavyewhwlo"), - // BandwidthLimit: to.Ptr[int64](26), - // ID: to.Ptr("oclhgkydaw"), - // IopsMaximum: to.Ptr[int64](6), - // IopsMinimum: to.Ptr[int64](25), - // PolicyID: to.Ptr("lvcylbmxrqjgarvhfny"), - // }}, - // UUID: to.Ptr("12345678-1234-1234-1234-12345678abcd"), - // VmmServerID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/Clouds_ListByResourceGroup_MinimumSet_Gen.json -func ExampleCloudsClient_NewListByResourceGroupPager_cloudsListByResourceGroupMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudsClient().NewListByResourceGroupPager("rgscvmm", 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.CloudListResult = armscvmm.CloudListResult{ - // Value: []*armscvmm.Cloud{ - // { - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/clouds/cloudResourceName"), - // Location: to.Ptr("khwsdmaxfhmbu"), - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/Clouds_Get_MaximumSet_Gen.json -func ExampleCloudsClient_Get_cloudsGetMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudsClient().Get(ctx, "rgscvmm", "_", 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.Cloud = armscvmm.Cloud{ - // Name: to.Ptr("wwcwalpiufsfbnydxpr"), - // Type: to.Ptr("qnaaimszbuokldohwrdfuiitpy"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/clouds/cloudResourceName"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Location: to.Ptr("khwsdmaxfhmbu"), - // Tags: map[string]*string{ - // "key4295": to.Ptr("wngosgcbdifaxdobufuuqxtho"), - // }, - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - // Type: to.Ptr("customLocation"), - // }, - // Properties: &armscvmm.CloudProperties{ - // CloudCapacity: &armscvmm.CloudCapacity{ - // CPUCount: to.Ptr[int64](4), - // MemoryMB: to.Ptr[int64](19), - // VMCount: to.Ptr[int64](28), - // }, - // CloudName: to.Ptr("menarjsplhcqvnkjdwieroir"), - // InventoryItemID: to.Ptr("qjd"), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // StorageQosPolicies: []*armscvmm.StorageQosPolicy{ - // { - // Name: to.Ptr("hvqcentnbwcunxhzfavyewhwlo"), - // BandwidthLimit: to.Ptr[int64](26), - // ID: to.Ptr("oclhgkydaw"), - // IopsMaximum: to.Ptr[int64](6), - // IopsMinimum: to.Ptr[int64](25), - // PolicyID: to.Ptr("lvcylbmxrqjgarvhfny"), - // }}, - // UUID: to.Ptr("12345678-1234-1234-1234-12345678abcd"), - // VmmServerID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/Clouds_Get_MinimumSet_Gen.json -func ExampleCloudsClient_Get_cloudsGetMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudsClient().Get(ctx, "rgscvmm", "i", 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.Cloud = armscvmm.Cloud{ - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/clouds/cloudResourceName"), - // Location: to.Ptr("khwsdmaxfhmbu"), - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/Clouds_CreateOrUpdate_MaximumSet_Gen.json -func ExampleCloudsClient_BeginCreateOrUpdate_cloudsCreateOrUpdateMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudsClient().BeginCreateOrUpdate(ctx, "rgscvmm", "2", armscvmm.Cloud{ - Location: to.Ptr("khwsdmaxfhmbu"), - Tags: map[string]*string{ - "key4295": to.Ptr("wngosgcbdifaxdobufuuqxtho"), - }, - ExtendedLocation: &armscvmm.ExtendedLocation{ - Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - Type: to.Ptr("customLocation"), - }, - Properties: &armscvmm.CloudProperties{ - CloudCapacity: &armscvmm.CloudCapacity{}, - InventoryItemID: to.Ptr("qjd"), - UUID: to.Ptr("12345678-1234-1234-1234-12345678abcd"), - VmmServerID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - }, - }, 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.Cloud = armscvmm.Cloud{ - // Name: to.Ptr("wwcwalpiufsfbnydxpr"), - // Type: to.Ptr("qnaaimszbuokldohwrdfuiitpy"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/clouds/cloudResourceName"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Location: to.Ptr("khwsdmaxfhmbu"), - // Tags: map[string]*string{ - // "key4295": to.Ptr("wngosgcbdifaxdobufuuqxtho"), - // }, - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - // Type: to.Ptr("customLocation"), - // }, - // Properties: &armscvmm.CloudProperties{ - // CloudCapacity: &armscvmm.CloudCapacity{ - // CPUCount: to.Ptr[int64](4), - // MemoryMB: to.Ptr[int64](19), - // VMCount: to.Ptr[int64](28), - // }, - // CloudName: to.Ptr("menarjsplhcqvnkjdwieroir"), - // InventoryItemID: to.Ptr("qjd"), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // StorageQosPolicies: []*armscvmm.StorageQosPolicy{ - // { - // Name: to.Ptr("hvqcentnbwcunxhzfavyewhwlo"), - // BandwidthLimit: to.Ptr[int64](26), - // ID: to.Ptr("oclhgkydaw"), - // IopsMaximum: to.Ptr[int64](6), - // IopsMinimum: to.Ptr[int64](25), - // PolicyID: to.Ptr("lvcylbmxrqjgarvhfny"), - // }}, - // UUID: to.Ptr("12345678-1234-1234-1234-12345678abcd"), - // VmmServerID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/Clouds_CreateOrUpdate_MinimumSet_Gen.json -func ExampleCloudsClient_BeginCreateOrUpdate_cloudsCreateOrUpdateMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudsClient().BeginCreateOrUpdate(ctx, "rgscvmm", "-", armscvmm.Cloud{ - Location: to.Ptr("khwsdmaxfhmbu"), - ExtendedLocation: &armscvmm.ExtendedLocation{}, - }, 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.Cloud = armscvmm.Cloud{ - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/clouds/cloudResourceName"), - // Location: to.Ptr("khwsdmaxfhmbu"), - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/Clouds_Update_MaximumSet_Gen.json -func ExampleCloudsClient_BeginUpdate_cloudsUpdateMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudsClient().BeginUpdate(ctx, "rgscvmm", "P", armscvmm.CloudTagsUpdate{ - Tags: map[string]*string{ - "key5266": to.Ptr("hjpcnwmpnixsolrxnbl"), - }, - }, 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.Cloud = armscvmm.Cloud{ - // Name: to.Ptr("wwcwalpiufsfbnydxpr"), - // Type: to.Ptr("qnaaimszbuokldohwrdfuiitpy"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/clouds/cloudResourceName"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Location: to.Ptr("khwsdmaxfhmbu"), - // Tags: map[string]*string{ - // "key4295": to.Ptr("wngosgcbdifaxdobufuuqxtho"), - // }, - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - // Type: to.Ptr("customLocation"), - // }, - // Properties: &armscvmm.CloudProperties{ - // CloudCapacity: &armscvmm.CloudCapacity{ - // CPUCount: to.Ptr[int64](4), - // MemoryMB: to.Ptr[int64](19), - // VMCount: to.Ptr[int64](28), - // }, - // CloudName: to.Ptr("menarjsplhcqvnkjdwieroir"), - // InventoryItemID: to.Ptr("qjd"), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // StorageQosPolicies: []*armscvmm.StorageQosPolicy{ - // { - // Name: to.Ptr("hvqcentnbwcunxhzfavyewhwlo"), - // BandwidthLimit: to.Ptr[int64](26), - // ID: to.Ptr("oclhgkydaw"), - // IopsMaximum: to.Ptr[int64](6), - // IopsMinimum: to.Ptr[int64](25), - // PolicyID: to.Ptr("lvcylbmxrqjgarvhfny"), - // }}, - // UUID: to.Ptr("12345678-1234-1234-1234-12345678abcd"), - // VmmServerID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/Clouds_Update_MinimumSet_Gen.json -func ExampleCloudsClient_BeginUpdate_cloudsUpdateMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudsClient().BeginUpdate(ctx, "rgscvmm", "_", armscvmm.CloudTagsUpdate{}, 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.Cloud = armscvmm.Cloud{ - // Location: to.Ptr("khwsdmaxfhmbu"), - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/Clouds_Delete_MaximumSet_Gen.json -func ExampleCloudsClient_BeginDelete_cloudsDeleteMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudsClient().BeginDelete(ctx, "rgscvmm", "-", &armscvmm.CloudsClientBeginDeleteOptions{Force: to.Ptr(armscvmm.ForceDeleteTrue)}) - 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/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/Clouds_Delete_MinimumSet_Gen.json -func ExampleCloudsClient_BeginDelete_cloudsDeleteMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudsClient().BeginDelete(ctx, "rgscvmm", "1", &armscvmm.CloudsClientBeginDeleteOptions{Force: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/scvmm/armscvmm/constants.go b/sdk/resourcemanager/scvmm/armscvmm/constants.go index 7c68e179fa2f..191ce77a8684 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/constants.go +++ b/sdk/resourcemanager/scvmm/armscvmm/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 armscvmm const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/scvmm/armscvmm" - moduleVersion = "v1.0.0" + moduleVersion = "v2.0.0" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/scvmm/armscvmm/fake/availabilitysets_server.go b/sdk/resourcemanager/scvmm/armscvmm/fake/availabilitysets_server.go index a3357a05ca99..8371d01815d5 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/fake/availabilitysets_server.go +++ b/sdk/resourcemanager/scvmm/armscvmm/fake/availabilitysets_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/scvmm/armscvmm" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/scvmm/armscvmm/v2" "net/http" "net/url" "regexp" @@ -29,7 +26,7 @@ type AvailabilitySetsServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, availabilitySetResourceName string, resource armscvmm.AvailabilitySet, options *armscvmm.AvailabilitySetsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armscvmm.AvailabilitySetsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method AvailabilitySetsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, availabilitySetResourceName string, options *armscvmm.AvailabilitySetsClientBeginDeleteOptions) (resp azfake.PollerResponder[armscvmm.AvailabilitySetsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method AvailabilitySetsClient.Get @@ -82,31 +79,50 @@ func (a *AvailabilitySetsServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - switch method { - case "AvailabilitySetsClient.BeginCreateOrUpdate": - resp, err = a.dispatchBeginCreateOrUpdate(req) - case "AvailabilitySetsClient.BeginDelete": - resp, err = a.dispatchBeginDelete(req) - case "AvailabilitySetsClient.Get": - resp, err = a.dispatchGet(req) - case "AvailabilitySetsClient.NewListByResourceGroupPager": - resp, err = a.dispatchNewListByResourceGroupPager(req) - case "AvailabilitySetsClient.NewListBySubscriptionPager": - resp, err = a.dispatchNewListBySubscriptionPager(req) - case "AvailabilitySetsClient.BeginUpdate": - resp, err = a.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *AvailabilitySetsServerTransport) 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 availabilitySetsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = availabilitySetsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AvailabilitySetsClient.BeginCreateOrUpdate": + res.resp, res.err = a.dispatchBeginCreateOrUpdate(req) + case "AvailabilitySetsClient.BeginDelete": + res.resp, res.err = a.dispatchBeginDelete(req) + case "AvailabilitySetsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AvailabilitySetsClient.NewListByResourceGroupPager": + res.resp, res.err = a.dispatchNewListByResourceGroupPager(req) + case "AvailabilitySetsClient.NewListBySubscriptionPager": + res.resp, res.err = a.dispatchNewListBySubscriptionPager(req) + case "AvailabilitySetsClient.BeginUpdate": + res.resp, res.err = a.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *AvailabilitySetsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -202,9 +218,9 @@ func (a *AvailabilitySetsServerTransport) dispatchBeginDelete(req *http.Request) return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { a.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { a.beginDelete.remove(req) @@ -363,3 +379,9 @@ func (a *AvailabilitySetsServerTransport) dispatchBeginUpdate(req *http.Request) return resp, nil } + +// set this to conditionally intercept incoming requests to AvailabilitySetsServerTransport +var availabilitySetsServerTransportInterceptor 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/scvmm/armscvmm/fake/clouds_server.go b/sdk/resourcemanager/scvmm/armscvmm/fake/clouds_server.go index e5bb28aaa5d6..5db2dd62499a 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/fake/clouds_server.go +++ b/sdk/resourcemanager/scvmm/armscvmm/fake/clouds_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/scvmm/armscvmm" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/scvmm/armscvmm/v2" "net/http" "net/url" "regexp" @@ -29,7 +26,7 @@ type CloudsServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, cloudResourceName string, resource armscvmm.Cloud, options *armscvmm.CloudsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armscvmm.CloudsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method CloudsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, cloudResourceName string, options *armscvmm.CloudsClientBeginDeleteOptions) (resp azfake.PollerResponder[armscvmm.CloudsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method CloudsClient.Get @@ -82,31 +79,50 @@ func (c *CloudsServerTransport) 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 c.dispatchToMethodFake(req, method) +} - switch method { - case "CloudsClient.BeginCreateOrUpdate": - resp, err = c.dispatchBeginCreateOrUpdate(req) - case "CloudsClient.BeginDelete": - resp, err = c.dispatchBeginDelete(req) - case "CloudsClient.Get": - resp, err = c.dispatchGet(req) - case "CloudsClient.NewListByResourceGroupPager": - resp, err = c.dispatchNewListByResourceGroupPager(req) - case "CloudsClient.NewListBySubscriptionPager": - resp, err = c.dispatchNewListBySubscriptionPager(req) - case "CloudsClient.BeginUpdate": - resp, err = c.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (c *CloudsServerTransport) 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 cloudsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = cloudsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CloudsClient.BeginCreateOrUpdate": + res.resp, res.err = c.dispatchBeginCreateOrUpdate(req) + case "CloudsClient.BeginDelete": + res.resp, res.err = c.dispatchBeginDelete(req) + case "CloudsClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "CloudsClient.NewListByResourceGroupPager": + res.resp, res.err = c.dispatchNewListByResourceGroupPager(req) + case "CloudsClient.NewListBySubscriptionPager": + res.resp, res.err = c.dispatchNewListBySubscriptionPager(req) + case "CloudsClient.BeginUpdate": + res.resp, res.err = c.dispatchBeginUpdate(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 (c *CloudsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -202,9 +218,9 @@ func (c *CloudsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Re return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { c.beginDelete.remove(req) @@ -363,3 +379,9 @@ func (c *CloudsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Re return resp, nil } + +// set this to conditionally intercept incoming requests to CloudsServerTransport +var cloudsServerTransportInterceptor 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/scvmm/armscvmm/fake/guestagents_server.go b/sdk/resourcemanager/scvmm/armscvmm/fake/guestagents_server.go index 1d9302b83e5b..0ad7c09db780 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/fake/guestagents_server.go +++ b/sdk/resourcemanager/scvmm/armscvmm/fake/guestagents_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/scvmm/armscvmm" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/scvmm/armscvmm/v2" "net/http" "net/url" "regexp" @@ -68,27 +65,46 @@ func (g *GuestAgentsServerTransport) Do(req *http.Request) (*http.Response, erro return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return g.dispatchToMethodFake(req, method) +} - switch method { - case "GuestAgentsClient.BeginCreate": - resp, err = g.dispatchBeginCreate(req) - case "GuestAgentsClient.Delete": - resp, err = g.dispatchDelete(req) - case "GuestAgentsClient.Get": - resp, err = g.dispatchGet(req) - case "GuestAgentsClient.NewListByVirtualMachineInstancePager": - resp, err = g.dispatchNewListByVirtualMachineInstancePager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (g *GuestAgentsServerTransport) 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 guestAgentsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = guestAgentsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "GuestAgentsClient.BeginCreate": + res.resp, res.err = g.dispatchBeginCreate(req) + case "GuestAgentsClient.Delete": + res.resp, res.err = g.dispatchDelete(req) + case "GuestAgentsClient.Get": + res.resp, res.err = g.dispatchGet(req) + case "GuestAgentsClient.NewListByVirtualMachineInstancePager": + res.resp, res.err = g.dispatchNewListByVirtualMachineInstancePager(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 (g *GuestAgentsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -229,3 +245,9 @@ func (g *GuestAgentsServerTransport) dispatchNewListByVirtualMachineInstancePage } return resp, nil } + +// set this to conditionally intercept incoming requests to GuestAgentsServerTransport +var guestAgentsServerTransportInterceptor 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/scvmm/armscvmm/fake/internal.go b/sdk/resourcemanager/scvmm/armscvmm/fake/internal.go index 94e060e89dbd..486a30a014e6 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/fake/internal.go +++ b/sdk/resourcemanager/scvmm/armscvmm/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. @@ -15,6 +12,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/scvmm/armscvmm/fake/inventoryitems_server.go b/sdk/resourcemanager/scvmm/armscvmm/fake/inventoryitems_server.go index f8df37d81ce9..3e49e5f8a631 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/fake/inventoryitems_server.go +++ b/sdk/resourcemanager/scvmm/armscvmm/fake/inventoryitems_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/scvmm/armscvmm" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/scvmm/armscvmm/v2" "net/http" "net/url" "regexp" @@ -66,27 +63,46 @@ func (i *InventoryItemsServerTransport) Do(req *http.Request) (*http.Response, e return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return i.dispatchToMethodFake(req, method) +} - switch method { - case "InventoryItemsClient.Create": - resp, err = i.dispatchCreate(req) - case "InventoryItemsClient.Delete": - resp, err = i.dispatchDelete(req) - case "InventoryItemsClient.Get": - resp, err = i.dispatchGet(req) - case "InventoryItemsClient.NewListByVmmServerPager": - resp, err = i.dispatchNewListByVmmServerPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (i *InventoryItemsServerTransport) 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 inventoryItemsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = inventoryItemsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "InventoryItemsClient.Create": + res.resp, res.err = i.dispatchCreate(req) + case "InventoryItemsClient.Delete": + res.resp, res.err = i.dispatchDelete(req) + case "InventoryItemsClient.Get": + res.resp, res.err = i.dispatchGet(req) + case "InventoryItemsClient.NewListByVmmServerPager": + res.resp, res.err = i.dispatchNewListByVmmServerPager(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 (i *InventoryItemsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { @@ -244,3 +260,9 @@ func (i *InventoryItemsServerTransport) dispatchNewListByVmmServerPager(req *htt } return resp, nil } + +// set this to conditionally intercept incoming requests to InventoryItemsServerTransport +var inventoryItemsServerTransportInterceptor 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/scvmm/armscvmm/fake/operations_server.go b/sdk/resourcemanager/scvmm/armscvmm/fake/operations_server.go index 477592a51cf1..91799cec2644 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/fake/operations_server.go +++ b/sdk/resourcemanager/scvmm/armscvmm/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/scvmm/armscvmm" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/scvmm/armscvmm/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/scvmm/armscvmm/fake/server_factory.go b/sdk/resourcemanager/scvmm/armscvmm/fake/server_factory.go index df22ef4394fd..1319322a859b 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/fake/server_factory.go +++ b/sdk/resourcemanager/scvmm/armscvmm/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,16 +16,35 @@ import ( // ServerFactory is a fake server for instances of the armscvmm.ClientFactory type. type ServerFactory struct { - AvailabilitySetsServer AvailabilitySetsServer - CloudsServer CloudsServer - GuestAgentsServer GuestAgentsServer - InventoryItemsServer InventoryItemsServer - OperationsServer OperationsServer + // AvailabilitySetsServer contains the fakes for client AvailabilitySetsClient + AvailabilitySetsServer AvailabilitySetsServer + + // CloudsServer contains the fakes for client CloudsClient + CloudsServer CloudsServer + + // GuestAgentsServer contains the fakes for client GuestAgentsClient + GuestAgentsServer GuestAgentsServer + + // InventoryItemsServer contains the fakes for client InventoryItemsClient + InventoryItemsServer InventoryItemsServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // VMInstanceHybridIdentityMetadatasServer contains the fakes for client VMInstanceHybridIdentityMetadatasClient VMInstanceHybridIdentityMetadatasServer VMInstanceHybridIdentityMetadatasServer - VirtualMachineInstancesServer VirtualMachineInstancesServer - VirtualMachineTemplatesServer VirtualMachineTemplatesServer - VirtualNetworksServer VirtualNetworksServer - VmmServersServer VmmServersServer + + // VirtualMachineInstancesServer contains the fakes for client VirtualMachineInstancesClient + VirtualMachineInstancesServer VirtualMachineInstancesServer + + // VirtualMachineTemplatesServer contains the fakes for client VirtualMachineTemplatesClient + VirtualMachineTemplatesServer VirtualMachineTemplatesServer + + // VirtualNetworksServer contains the fakes for client VirtualNetworksClient + VirtualNetworksServer VirtualNetworksServer + + // VmmServersServer contains the fakes for client VmmServersClient + VmmServersServer VmmServersServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. diff --git a/sdk/resourcemanager/scvmm/armscvmm/fake/time_rfc3339.go b/sdk/resourcemanager/scvmm/armscvmm/fake/time_rfc3339.go deleted file mode 100644 index 81f308b0d343..000000000000 --- a/sdk/resourcemanager/scvmm/armscvmm/fake/time_rfc3339.go +++ /dev/null @@ -1,110 +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 ( - utcDateTime = "2006-01-02T15:04:05.999999999" - utcDateTimeJSON = `"` + utcDateTime + `"` - utcDateTimeNoT = "2006-01-02 15:04:05.999999999" - utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` - dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` - dateTimeJSON = `"` + time.RFC3339Nano + `"` - dateTimeJSONNoT = `"` + dateTimeNoT + `"` -) - -type dateTimeRFC3339 time.Time - -func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalJSON() -} - -func (t dateTimeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalText() -} - -func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = dateTimeJSON - } else if tzOffset { - layout = dateTimeJSONNoT - } else if hasT { - layout = utcDateTimeJSON - } else { - layout = utcDateTimeJSONNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = time.RFC3339Nano - } else if tzOffset { - layout = dateTimeNoT - } else if hasT { - layout = utcDateTime - } else { - layout = utcDateTimeNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = dateTimeRFC3339(p) - return err -} - -func (t dateTimeRFC3339) String() string { - return time.Time(t).Format(time.RFC3339Nano) -} - -func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*dateTimeRFC3339)(t) -} - -func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || string(data) == "null" { - return nil - } - var aux dateTimeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/scvmm/armscvmm/fake/virtualmachineinstances_server.go b/sdk/resourcemanager/scvmm/armscvmm/fake/virtualmachineinstances_server.go index eabd181b08ba..b7f61db5f358 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/fake/virtualmachineinstances_server.go +++ b/sdk/resourcemanager/scvmm/armscvmm/fake/virtualmachineinstances_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,16 +13,17 @@ 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/scvmm/armscvmm" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/scvmm/armscvmm/v2" "net/http" "net/url" + "reflect" "regexp" ) // VirtualMachineInstancesServer is a fake server for instances of the armscvmm.VirtualMachineInstancesClient type. type VirtualMachineInstancesServer struct { // BeginCreateCheckpoint is the fake for method VirtualMachineInstancesClient.BeginCreateCheckpoint - // HTTP status codes to indicate success: http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginCreateCheckpoint func(ctx context.Context, resourceURI string, body armscvmm.VirtualMachineCreateCheckpoint, options *armscvmm.VirtualMachineInstancesClientBeginCreateCheckpointOptions) (resp azfake.PollerResponder[armscvmm.VirtualMachineInstancesClientCreateCheckpointResponse], errResp azfake.ErrorResponder) // BeginCreateOrUpdate is the fake for method VirtualMachineInstancesClient.BeginCreateOrUpdate @@ -33,11 +31,11 @@ type VirtualMachineInstancesServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceURI string, resource armscvmm.VirtualMachineInstance, options *armscvmm.VirtualMachineInstancesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armscvmm.VirtualMachineInstancesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method VirtualMachineInstancesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceURI string, options *armscvmm.VirtualMachineInstancesClientBeginDeleteOptions) (resp azfake.PollerResponder[armscvmm.VirtualMachineInstancesClientDeleteResponse], errResp azfake.ErrorResponder) // BeginDeleteCheckpoint is the fake for method VirtualMachineInstancesClient.BeginDeleteCheckpoint - // HTTP status codes to indicate success: http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDeleteCheckpoint func(ctx context.Context, resourceURI string, body armscvmm.VirtualMachineDeleteCheckpoint, options *armscvmm.VirtualMachineInstancesClientBeginDeleteCheckpointOptions) (resp azfake.PollerResponder[armscvmm.VirtualMachineInstancesClientDeleteCheckpointResponse], errResp azfake.ErrorResponder) // Get is the fake for method VirtualMachineInstancesClient.Get @@ -49,20 +47,20 @@ type VirtualMachineInstancesServer struct { NewListPager func(resourceURI string, options *armscvmm.VirtualMachineInstancesClientListOptions) (resp azfake.PagerResponder[armscvmm.VirtualMachineInstancesClientListResponse]) // BeginRestart is the fake for method VirtualMachineInstancesClient.BeginRestart - // HTTP status codes to indicate success: http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginRestart func(ctx context.Context, resourceURI string, options *armscvmm.VirtualMachineInstancesClientBeginRestartOptions) (resp azfake.PollerResponder[armscvmm.VirtualMachineInstancesClientRestartResponse], errResp azfake.ErrorResponder) // BeginRestoreCheckpoint is the fake for method VirtualMachineInstancesClient.BeginRestoreCheckpoint - // HTTP status codes to indicate success: http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginRestoreCheckpoint func(ctx context.Context, resourceURI string, body armscvmm.VirtualMachineRestoreCheckpoint, options *armscvmm.VirtualMachineInstancesClientBeginRestoreCheckpointOptions) (resp azfake.PollerResponder[armscvmm.VirtualMachineInstancesClientRestoreCheckpointResponse], errResp azfake.ErrorResponder) // BeginStart is the fake for method VirtualMachineInstancesClient.BeginStart - // HTTP status codes to indicate success: http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginStart func(ctx context.Context, resourceURI string, options *armscvmm.VirtualMachineInstancesClientBeginStartOptions) (resp azfake.PollerResponder[armscvmm.VirtualMachineInstancesClientStartResponse], errResp azfake.ErrorResponder) // BeginStop is the fake for method VirtualMachineInstancesClient.BeginStop - // HTTP status codes to indicate success: http.StatusAccepted - BeginStop func(ctx context.Context, resourceURI string, body armscvmm.StopVirtualMachineOptions, options *armscvmm.VirtualMachineInstancesClientBeginStopOptions) (resp azfake.PollerResponder[armscvmm.VirtualMachineInstancesClientStopResponse], errResp azfake.ErrorResponder) + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginStop func(ctx context.Context, resourceURI string, options *armscvmm.VirtualMachineInstancesClientBeginStopOptions) (resp azfake.PollerResponder[armscvmm.VirtualMachineInstancesClientStopResponse], errResp azfake.ErrorResponder) // BeginUpdate is the fake for method VirtualMachineInstancesClient.BeginUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted @@ -112,41 +110,60 @@ func (v *VirtualMachineInstancesServerTransport) Do(req *http.Request) (*http.Re return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "VirtualMachineInstancesClient.BeginCreateCheckpoint": - resp, err = v.dispatchBeginCreateCheckpoint(req) - case "VirtualMachineInstancesClient.BeginCreateOrUpdate": - resp, err = v.dispatchBeginCreateOrUpdate(req) - case "VirtualMachineInstancesClient.BeginDelete": - resp, err = v.dispatchBeginDelete(req) - case "VirtualMachineInstancesClient.BeginDeleteCheckpoint": - resp, err = v.dispatchBeginDeleteCheckpoint(req) - case "VirtualMachineInstancesClient.Get": - resp, err = v.dispatchGet(req) - case "VirtualMachineInstancesClient.NewListPager": - resp, err = v.dispatchNewListPager(req) - case "VirtualMachineInstancesClient.BeginRestart": - resp, err = v.dispatchBeginRestart(req) - case "VirtualMachineInstancesClient.BeginRestoreCheckpoint": - resp, err = v.dispatchBeginRestoreCheckpoint(req) - case "VirtualMachineInstancesClient.BeginStart": - resp, err = v.dispatchBeginStart(req) - case "VirtualMachineInstancesClient.BeginStop": - resp, err = v.dispatchBeginStop(req) - case "VirtualMachineInstancesClient.BeginUpdate": - resp, err = v.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return v.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (v *VirtualMachineInstancesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if virtualMachineInstancesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = virtualMachineInstancesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "VirtualMachineInstancesClient.BeginCreateCheckpoint": + res.resp, res.err = v.dispatchBeginCreateCheckpoint(req) + case "VirtualMachineInstancesClient.BeginCreateOrUpdate": + res.resp, res.err = v.dispatchBeginCreateOrUpdate(req) + case "VirtualMachineInstancesClient.BeginDelete": + res.resp, res.err = v.dispatchBeginDelete(req) + case "VirtualMachineInstancesClient.BeginDeleteCheckpoint": + res.resp, res.err = v.dispatchBeginDeleteCheckpoint(req) + case "VirtualMachineInstancesClient.Get": + res.resp, res.err = v.dispatchGet(req) + case "VirtualMachineInstancesClient.NewListPager": + res.resp, res.err = v.dispatchNewListPager(req) + case "VirtualMachineInstancesClient.BeginRestart": + res.resp, res.err = v.dispatchBeginRestart(req) + case "VirtualMachineInstancesClient.BeginRestoreCheckpoint": + res.resp, res.err = v.dispatchBeginRestoreCheckpoint(req) + case "VirtualMachineInstancesClient.BeginStart": + res.resp, res.err = v.dispatchBeginStart(req) + case "VirtualMachineInstancesClient.BeginStop": + res.resp, res.err = v.dispatchBeginStop(req) + case "VirtualMachineInstancesClient.BeginUpdate": + res.resp, res.err = v.dispatchBeginUpdate(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 (v *VirtualMachineInstancesServerTransport) dispatchBeginCreateCheckpoint(req *http.Request) (*http.Response, error) { @@ -182,9 +199,9 @@ func (v *VirtualMachineInstancesServerTransport) dispatchBeginCreateCheckpoint(r return nil, err } - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { v.beginCreateCheckpoint.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginCreateCheckpoint) { v.beginCreateCheckpoint.remove(req) @@ -284,9 +301,9 @@ func (v *VirtualMachineInstancesServerTransport) dispatchBeginDelete(req *http.R return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { v.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { v.beginDelete.remove(req) @@ -328,9 +345,9 @@ func (v *VirtualMachineInstancesServerTransport) dispatchBeginDeleteCheckpoint(r return nil, err } - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { v.beginDeleteCheckpoint.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDeleteCheckpoint) { v.beginDeleteCheckpoint.remove(req) @@ -434,9 +451,9 @@ func (v *VirtualMachineInstancesServerTransport) dispatchBeginRestart(req *http. return nil, err } - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { v.beginRestart.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginRestart) { v.beginRestart.remove(req) @@ -478,9 +495,9 @@ func (v *VirtualMachineInstancesServerTransport) dispatchBeginRestoreCheckpoint( return nil, err } - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { v.beginRestoreCheckpoint.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginRestoreCheckpoint) { v.beginRestoreCheckpoint.remove(req) @@ -518,9 +535,9 @@ func (v *VirtualMachineInstancesServerTransport) dispatchBeginStart(req *http.Re return nil, err } - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { v.beginStart.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginStart) { v.beginStart.remove(req) @@ -549,7 +566,13 @@ func (v *VirtualMachineInstancesServerTransport) dispatchBeginStop(req *http.Req if err != nil { return nil, err } - respr, errRespr := v.srv.BeginStop(req.Context(), resourceURIParam, body, nil) + var options *armscvmm.VirtualMachineInstancesClientBeginStopOptions + if !reflect.ValueOf(body).IsZero() { + options = &armscvmm.VirtualMachineInstancesClientBeginStopOptions{ + Body: &body, + } + } + respr, errRespr := v.srv.BeginStop(req.Context(), resourceURIParam, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -562,9 +585,9 @@ func (v *VirtualMachineInstancesServerTransport) dispatchBeginStop(req *http.Req return nil, err } - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { v.beginStop.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginStop) { v.beginStop.remove(req) @@ -616,3 +639,9 @@ func (v *VirtualMachineInstancesServerTransport) dispatchBeginUpdate(req *http.R return resp, nil } + +// set this to conditionally intercept incoming requests to VirtualMachineInstancesServerTransport +var virtualMachineInstancesServerTransportInterceptor 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/scvmm/armscvmm/fake/virtualmachinetemplates_server.go b/sdk/resourcemanager/scvmm/armscvmm/fake/virtualmachinetemplates_server.go index 9a4308e8cbc8..796cfdb9977b 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/fake/virtualmachinetemplates_server.go +++ b/sdk/resourcemanager/scvmm/armscvmm/fake/virtualmachinetemplates_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/scvmm/armscvmm" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/scvmm/armscvmm/v2" "net/http" "net/url" "regexp" @@ -29,7 +26,7 @@ type VirtualMachineTemplatesServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, virtualMachineTemplateName string, resource armscvmm.VirtualMachineTemplate, options *armscvmm.VirtualMachineTemplatesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armscvmm.VirtualMachineTemplatesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method VirtualMachineTemplatesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, virtualMachineTemplateName string, options *armscvmm.VirtualMachineTemplatesClientBeginDeleteOptions) (resp azfake.PollerResponder[armscvmm.VirtualMachineTemplatesClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method VirtualMachineTemplatesClient.Get @@ -82,31 +79,50 @@ func (v *VirtualMachineTemplatesServerTransport) Do(req *http.Request) (*http.Re return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return v.dispatchToMethodFake(req, method) +} - switch method { - case "VirtualMachineTemplatesClient.BeginCreateOrUpdate": - resp, err = v.dispatchBeginCreateOrUpdate(req) - case "VirtualMachineTemplatesClient.BeginDelete": - resp, err = v.dispatchBeginDelete(req) - case "VirtualMachineTemplatesClient.Get": - resp, err = v.dispatchGet(req) - case "VirtualMachineTemplatesClient.NewListByResourceGroupPager": - resp, err = v.dispatchNewListByResourceGroupPager(req) - case "VirtualMachineTemplatesClient.NewListBySubscriptionPager": - resp, err = v.dispatchNewListBySubscriptionPager(req) - case "VirtualMachineTemplatesClient.BeginUpdate": - resp, err = v.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (v *VirtualMachineTemplatesServerTransport) 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 virtualMachineTemplatesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = virtualMachineTemplatesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "VirtualMachineTemplatesClient.BeginCreateOrUpdate": + res.resp, res.err = v.dispatchBeginCreateOrUpdate(req) + case "VirtualMachineTemplatesClient.BeginDelete": + res.resp, res.err = v.dispatchBeginDelete(req) + case "VirtualMachineTemplatesClient.Get": + res.resp, res.err = v.dispatchGet(req) + case "VirtualMachineTemplatesClient.NewListByResourceGroupPager": + res.resp, res.err = v.dispatchNewListByResourceGroupPager(req) + case "VirtualMachineTemplatesClient.NewListBySubscriptionPager": + res.resp, res.err = v.dispatchNewListBySubscriptionPager(req) + case "VirtualMachineTemplatesClient.BeginUpdate": + res.resp, res.err = v.dispatchBeginUpdate(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 (v *VirtualMachineTemplatesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -202,9 +218,9 @@ func (v *VirtualMachineTemplatesServerTransport) dispatchBeginDelete(req *http.R return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { v.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { v.beginDelete.remove(req) @@ -363,3 +379,9 @@ func (v *VirtualMachineTemplatesServerTransport) dispatchBeginUpdate(req *http.R return resp, nil } + +// set this to conditionally intercept incoming requests to VirtualMachineTemplatesServerTransport +var virtualMachineTemplatesServerTransportInterceptor 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/scvmm/armscvmm/fake/virtualnetworks_server.go b/sdk/resourcemanager/scvmm/armscvmm/fake/virtualnetworks_server.go index 33c8a6cb93c1..d5cf64ee8b3d 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/fake/virtualnetworks_server.go +++ b/sdk/resourcemanager/scvmm/armscvmm/fake/virtualnetworks_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/scvmm/armscvmm" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/scvmm/armscvmm/v2" "net/http" "net/url" "regexp" @@ -29,7 +26,7 @@ type VirtualNetworksServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, virtualNetworkName string, resource armscvmm.VirtualNetwork, options *armscvmm.VirtualNetworksClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armscvmm.VirtualNetworksClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method VirtualNetworksClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *armscvmm.VirtualNetworksClientBeginDeleteOptions) (resp azfake.PollerResponder[armscvmm.VirtualNetworksClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method VirtualNetworksClient.Get @@ -82,31 +79,50 @@ func (v *VirtualNetworksServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return v.dispatchToMethodFake(req, method) +} - switch method { - case "VirtualNetworksClient.BeginCreateOrUpdate": - resp, err = v.dispatchBeginCreateOrUpdate(req) - case "VirtualNetworksClient.BeginDelete": - resp, err = v.dispatchBeginDelete(req) - case "VirtualNetworksClient.Get": - resp, err = v.dispatchGet(req) - case "VirtualNetworksClient.NewListByResourceGroupPager": - resp, err = v.dispatchNewListByResourceGroupPager(req) - case "VirtualNetworksClient.NewListBySubscriptionPager": - resp, err = v.dispatchNewListBySubscriptionPager(req) - case "VirtualNetworksClient.BeginUpdate": - resp, err = v.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (v *VirtualNetworksServerTransport) 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 virtualNetworksServerTransportInterceptor != nil { + res.resp, res.err, intercepted = virtualNetworksServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "VirtualNetworksClient.BeginCreateOrUpdate": + res.resp, res.err = v.dispatchBeginCreateOrUpdate(req) + case "VirtualNetworksClient.BeginDelete": + res.resp, res.err = v.dispatchBeginDelete(req) + case "VirtualNetworksClient.Get": + res.resp, res.err = v.dispatchGet(req) + case "VirtualNetworksClient.NewListByResourceGroupPager": + res.resp, res.err = v.dispatchNewListByResourceGroupPager(req) + case "VirtualNetworksClient.NewListBySubscriptionPager": + res.resp, res.err = v.dispatchNewListBySubscriptionPager(req) + case "VirtualNetworksClient.BeginUpdate": + res.resp, res.err = v.dispatchBeginUpdate(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 (v *VirtualNetworksServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -202,9 +218,9 @@ func (v *VirtualNetworksServerTransport) dispatchBeginDelete(req *http.Request) return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { v.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { v.beginDelete.remove(req) @@ -363,3 +379,9 @@ func (v *VirtualNetworksServerTransport) dispatchBeginUpdate(req *http.Request) return resp, nil } + +// set this to conditionally intercept incoming requests to VirtualNetworksServerTransport +var virtualNetworksServerTransportInterceptor 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/scvmm/armscvmm/fake/vminstancehybrididentitymetadatas_server.go b/sdk/resourcemanager/scvmm/armscvmm/fake/vminstancehybrididentitymetadatas_server.go index 5b8d55a3702d..ce0bad20a16d 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/fake/vminstancehybrididentitymetadatas_server.go +++ b/sdk/resourcemanager/scvmm/armscvmm/fake/vminstancehybrididentitymetadatas_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/scvmm/armscvmm" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/scvmm/armscvmm/v2" "net/http" "net/url" "regexp" @@ -58,23 +55,42 @@ func (v *VMInstanceHybridIdentityMetadatasServerTransport) Do(req *http.Request) return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return v.dispatchToMethodFake(req, method) +} - switch method { - case "VMInstanceHybridIdentityMetadatasClient.Get": - resp, err = v.dispatchGet(req) - case "VMInstanceHybridIdentityMetadatasClient.NewListByVirtualMachineInstancePager": - resp, err = v.dispatchNewListByVirtualMachineInstancePager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (v *VMInstanceHybridIdentityMetadatasServerTransport) 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 vmInstanceHybridIdentityMetadatasServerTransportInterceptor != nil { + res.resp, res.err, intercepted = vmInstanceHybridIdentityMetadatasServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "VMInstanceHybridIdentityMetadatasClient.Get": + res.resp, res.err = v.dispatchGet(req) + case "VMInstanceHybridIdentityMetadatasClient.NewListByVirtualMachineInstancePager": + res.resp, res.err = v.dispatchNewListByVirtualMachineInstancePager(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 (v *VMInstanceHybridIdentityMetadatasServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -142,3 +158,9 @@ func (v *VMInstanceHybridIdentityMetadatasServerTransport) dispatchNewListByVirt } return resp, nil } + +// set this to conditionally intercept incoming requests to VMInstanceHybridIdentityMetadatasServerTransport +var vmInstanceHybridIdentityMetadatasServerTransportInterceptor 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/scvmm/armscvmm/fake/vmmservers_server.go b/sdk/resourcemanager/scvmm/armscvmm/fake/vmmservers_server.go index 1f21f887f115..a5472dad1a6f 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/fake/vmmservers_server.go +++ b/sdk/resourcemanager/scvmm/armscvmm/fake/vmmservers_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/scvmm/armscvmm" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/scvmm/armscvmm/v2" "net/http" "net/url" "regexp" @@ -29,7 +26,7 @@ type VmmServersServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, vmmServerName string, resource armscvmm.VmmServer, options *armscvmm.VmmServersClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armscvmm.VmmServersClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method VmmServersClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, vmmServerName string, options *armscvmm.VmmServersClientBeginDeleteOptions) (resp azfake.PollerResponder[armscvmm.VmmServersClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method VmmServersClient.Get @@ -82,31 +79,50 @@ func (v *VmmServersServerTransport) 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 v.dispatchToMethodFake(req, method) +} - switch method { - case "VmmServersClient.BeginCreateOrUpdate": - resp, err = v.dispatchBeginCreateOrUpdate(req) - case "VmmServersClient.BeginDelete": - resp, err = v.dispatchBeginDelete(req) - case "VmmServersClient.Get": - resp, err = v.dispatchGet(req) - case "VmmServersClient.NewListByResourceGroupPager": - resp, err = v.dispatchNewListByResourceGroupPager(req) - case "VmmServersClient.NewListBySubscriptionPager": - resp, err = v.dispatchNewListBySubscriptionPager(req) - case "VmmServersClient.BeginUpdate": - resp, err = v.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (v *VmmServersServerTransport) 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 vmmServersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = vmmServersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "VmmServersClient.BeginCreateOrUpdate": + res.resp, res.err = v.dispatchBeginCreateOrUpdate(req) + case "VmmServersClient.BeginDelete": + res.resp, res.err = v.dispatchBeginDelete(req) + case "VmmServersClient.Get": + res.resp, res.err = v.dispatchGet(req) + case "VmmServersClient.NewListByResourceGroupPager": + res.resp, res.err = v.dispatchNewListByResourceGroupPager(req) + case "VmmServersClient.NewListBySubscriptionPager": + res.resp, res.err = v.dispatchNewListBySubscriptionPager(req) + case "VmmServersClient.BeginUpdate": + res.resp, res.err = v.dispatchBeginUpdate(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 (v *VmmServersServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -202,9 +218,9 @@ func (v *VmmServersServerTransport) dispatchBeginDelete(req *http.Request) (*htt return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { v.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { v.beginDelete.remove(req) @@ -363,3 +379,9 @@ func (v *VmmServersServerTransport) dispatchBeginUpdate(req *http.Request) (*htt return resp, nil } + +// set this to conditionally intercept incoming requests to VmmServersServerTransport +var vmmServersServerTransportInterceptor 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/scvmm/armscvmm/go.mod b/sdk/resourcemanager/scvmm/armscvmm/go.mod index 648fcf90aeca..8459f2b198ee 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/go.mod +++ b/sdk/resourcemanager/scvmm/armscvmm/go.mod @@ -1,21 +1,11 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/scvmm/armscvmm +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/scvmm/armscvmm/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 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.2 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.36.0 // indirect golang.org/x/net v0.38.0 // indirect - golang.org/x/sys v0.31.0 // indirect golang.org/x/text v0.23.0 // indirect ) diff --git a/sdk/resourcemanager/scvmm/armscvmm/go.sum b/sdk/resourcemanager/scvmm/armscvmm/go.sum index 4bacf756f06c..4de695d9e23a 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/go.sum +++ b/sdk/resourcemanager/scvmm/armscvmm/go.sum @@ -1,44 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 h1:DSDNVxqkoXJiko6x8a90zidoYqnYYa6c1MTzDKzKkTo= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1/go.mod h1:zGqV2R4Cr/k8Uye5w+dgQ06WJtEcbQG/8J7BB6hnCr4= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 h1:F0gBpfdPLGsw+nsgk6aqqkZS1jiixa5WwFe3fk/T3Ys= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2/go.mod h1:SqINnQ9lVVdRlyC8cd1lCI0SdX4n2paeABd2K8ggfnE= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2 h1:yz1bePFlP5Vws5+8ez6T3HWXPmwOK7Yvq8QxDBD3SKY= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2/go.mod h1:Pa9ZNPuoNu/GztvBSKk9J1cDJW6vk/n0zLtV4mgd8N8= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= -github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 h1:oygO0locgZJe7PpYPXT5A29ZkwJaPqcva7BVeemZOZs= -github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= -github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= -github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8= -github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6 h1:IsMZxCuZqKuao2vNdfD82fjjgPLfyHLpR41Z88viRWs= -github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6/go.mod h1:3VeWNIJaW+O5xpRQbPp0Ybqu1vJd/pm7s2F473HRrkw= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E= -github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= -golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= -golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/scvmm/armscvmm/guestagents_client.go b/sdk/resourcemanager/scvmm/armscvmm/guestagents_client.go index abaabf3a1784..ecb7e40fd9a8 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/guestagents_client.go +++ b/sdk/resourcemanager/scvmm/armscvmm/guestagents_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. @@ -41,7 +38,7 @@ func NewGuestAgentsClient(credential azcore.TokenCredential, options *arm.Client // BeginCreate - Create Or Update GuestAgent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceURI - The fully qualified Azure Resource manager identifier of the resource. // - resource - Resource create parameters. // - options - GuestAgentsClientBeginCreateOptions contains the optional parameters for the GuestAgentsClient.BeginCreate method. @@ -66,7 +63,7 @@ func (client *GuestAgentsClient) BeginCreate(ctx context.Context, resourceURI st // Create - Create Or Update GuestAgent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 func (client *GuestAgentsClient) create(ctx context.Context, resourceURI string, resource GuestAgent, options *GuestAgentsClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "GuestAgentsClient.BeginCreate" @@ -89,7 +86,7 @@ func (client *GuestAgentsClient) create(ctx context.Context, resourceURI string, } // createCreateRequest creates the Create request. -func (client *GuestAgentsClient) createCreateRequest(ctx context.Context, resourceURI string, resource GuestAgent, options *GuestAgentsClientBeginCreateOptions) (*policy.Request, error) { +func (client *GuestAgentsClient) createCreateRequest(ctx context.Context, resourceURI string, resource GuestAgent, _ *GuestAgentsClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents/default" urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -97,7 +94,7 @@ func (client *GuestAgentsClient) createCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -109,7 +106,7 @@ func (client *GuestAgentsClient) createCreateRequest(ctx context.Context, resour // Delete - Implements GuestAgent DELETE method. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceURI - The fully qualified Azure Resource manager identifier of the resource. // - options - GuestAgentsClientDeleteOptions contains the optional parameters for the GuestAgentsClient.Delete method. func (client *GuestAgentsClient) Delete(ctx context.Context, resourceURI string, options *GuestAgentsClientDeleteOptions) (GuestAgentsClientDeleteResponse, error) { @@ -134,7 +131,7 @@ func (client *GuestAgentsClient) Delete(ctx context.Context, resourceURI string, } // deleteCreateRequest creates the Delete request. -func (client *GuestAgentsClient) deleteCreateRequest(ctx context.Context, resourceURI string, options *GuestAgentsClientDeleteOptions) (*policy.Request, error) { +func (client *GuestAgentsClient) deleteCreateRequest(ctx context.Context, resourceURI string, _ *GuestAgentsClientDeleteOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents/default" urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -142,7 +139,7 @@ func (client *GuestAgentsClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -151,7 +148,7 @@ func (client *GuestAgentsClient) deleteCreateRequest(ctx context.Context, resour // Get - Implements GuestAgent GET method. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceURI - The fully qualified Azure Resource manager identifier of the resource. // - options - GuestAgentsClientGetOptions contains the optional parameters for the GuestAgentsClient.Get method. func (client *GuestAgentsClient) Get(ctx context.Context, resourceURI string, options *GuestAgentsClientGetOptions) (GuestAgentsClientGetResponse, error) { @@ -177,7 +174,7 @@ func (client *GuestAgentsClient) Get(ctx context.Context, resourceURI string, op } // getCreateRequest creates the Get request. -func (client *GuestAgentsClient) getCreateRequest(ctx context.Context, resourceURI string, options *GuestAgentsClientGetOptions) (*policy.Request, error) { +func (client *GuestAgentsClient) getCreateRequest(ctx context.Context, resourceURI string, _ *GuestAgentsClientGetOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents/default" urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -185,7 +182,7 @@ func (client *GuestAgentsClient) getCreateRequest(ctx context.Context, resourceU return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -202,7 +199,7 @@ func (client *GuestAgentsClient) getHandleResponse(resp *http.Response) (GuestAg // NewListByVirtualMachineInstancePager - Returns the list of GuestAgent of the given vm. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceURI - The fully qualified Azure Resource manager identifier of the resource. // - options - GuestAgentsClientListByVirtualMachineInstanceOptions contains the optional parameters for the GuestAgentsClient.NewListByVirtualMachineInstancePager // method. @@ -230,7 +227,7 @@ func (client *GuestAgentsClient) NewListByVirtualMachineInstancePager(resourceUR } // listByVirtualMachineInstanceCreateRequest creates the ListByVirtualMachineInstance request. -func (client *GuestAgentsClient) listByVirtualMachineInstanceCreateRequest(ctx context.Context, resourceURI string, options *GuestAgentsClientListByVirtualMachineInstanceOptions) (*policy.Request, error) { +func (client *GuestAgentsClient) listByVirtualMachineInstanceCreateRequest(ctx context.Context, resourceURI string, _ *GuestAgentsClientListByVirtualMachineInstanceOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents" urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -238,7 +235,7 @@ func (client *GuestAgentsClient) listByVirtualMachineInstanceCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/scvmm/armscvmm/guestagents_client_example_test.go b/sdk/resourcemanager/scvmm/armscvmm/guestagents_client_example_test.go deleted file mode 100644 index 0ea7db384610..000000000000 --- a/sdk/resourcemanager/scvmm/armscvmm/guestagents_client_example_test.go +++ /dev/null @@ -1,293 +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 armscvmm_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/scvmm/armscvmm" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/GuestAgents_ListByVirtualMachineInstance_MaximumSet_Gen.json -func ExampleGuestAgentsClient_NewListByVirtualMachineInstancePager_guestAgentsListByVirtualMachineInstanceMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGuestAgentsClient().NewListByVirtualMachineInstancePager("gtgclehcbsyave", 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.GuestAgentListResult = armscvmm.GuestAgentListResult{ - // Value: []*armscvmm.GuestAgent{ - // { - // Name: to.Ptr("rwecpthzyt"), - // Type: to.Ptr("dkcgcbtlwtsedxzhvtu"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents/default"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Properties: &armscvmm.GuestAgentProperties{ - // Credentials: &armscvmm.GuestCredential{ - // Username: to.Ptr("jqxuwirrcpfv"), - // }, - // CustomResourceName: to.Ptr("mhqymxkapuvsugd"), - // HTTPProxyConfig: &armscvmm.HTTPProxyConfiguration{ - // HTTPSProxy: to.Ptr("uoyzyticmohohomlkwct"), - // }, - // ProvisioningAction: to.Ptr(armscvmm.ProvisioningActionInstall), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // Status: to.Ptr("jpoukrzfenzrmjdahimkl"), - // UUID: to.Ptr("hbsgztyakewtgbuxbesezncnzu"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/GuestAgents_ListByVirtualMachineInstance_MinimumSet_Gen.json -func ExampleGuestAgentsClient_NewListByVirtualMachineInstancePager_guestAgentsListByVirtualMachineInstanceMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewGuestAgentsClient().NewListByVirtualMachineInstancePager("gtgclehcbsyave", 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.GuestAgentListResult = armscvmm.GuestAgentListResult{ - // Value: []*armscvmm.GuestAgent{ - // { - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents/default"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/GuestAgents_Get_MaximumSet_Gen.json -func ExampleGuestAgentsClient_Get_guestAgentsGetMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGuestAgentsClient().Get(ctx, "gtgclehcbsyave", 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.GuestAgent = armscvmm.GuestAgent{ - // Name: to.Ptr("rwecpthzyt"), - // Type: to.Ptr("dkcgcbtlwtsedxzhvtu"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents/default"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Properties: &armscvmm.GuestAgentProperties{ - // Credentials: &armscvmm.GuestCredential{ - // Username: to.Ptr("jqxuwirrcpfv"), - // }, - // CustomResourceName: to.Ptr("mhqymxkapuvsugd"), - // HTTPProxyConfig: &armscvmm.HTTPProxyConfiguration{ - // HTTPSProxy: to.Ptr("uoyzyticmohohomlkwct"), - // }, - // ProvisioningAction: to.Ptr(armscvmm.ProvisioningActionInstall), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // Status: to.Ptr("jpoukrzfenzrmjdahimkl"), - // UUID: to.Ptr("hbsgztyakewtgbuxbesezncnzu"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/GuestAgents_Get_MinimumSet_Gen.json -func ExampleGuestAgentsClient_Get_guestAgentsGetMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewGuestAgentsClient().Get(ctx, "gtgclehcbsyave", 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.GuestAgent = armscvmm.GuestAgent{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/GuestAgents_Create_MaximumSet_Gen.json -func ExampleGuestAgentsClient_BeginCreate_guestAgentsCreateMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGuestAgentsClient().BeginCreate(ctx, "gtgclehcbsyave", armscvmm.GuestAgent{ - Properties: &armscvmm.GuestAgentProperties{ - Credentials: &armscvmm.GuestCredential{ - Password: to.Ptr("gkvbnmuahumuoibvscoxzfdqwvfuf"), - Username: to.Ptr("jqxuwirrcpfv"), - }, - HTTPProxyConfig: &armscvmm.HTTPProxyConfiguration{ - HTTPSProxy: to.Ptr("uoyzyticmohohomlkwct"), - }, - ProvisioningAction: to.Ptr(armscvmm.ProvisioningActionInstall), - }, - }, 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.GuestAgent = armscvmm.GuestAgent{ - // Name: to.Ptr("rwecpthzyt"), - // Type: to.Ptr("dkcgcbtlwtsedxzhvtu"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents/default"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Properties: &armscvmm.GuestAgentProperties{ - // Credentials: &armscvmm.GuestCredential{ - // Username: to.Ptr("jqxuwirrcpfv"), - // }, - // CustomResourceName: to.Ptr("mhqymxkapuvsugd"), - // HTTPProxyConfig: &armscvmm.HTTPProxyConfiguration{ - // HTTPSProxy: to.Ptr("uoyzyticmohohomlkwct"), - // }, - // ProvisioningAction: to.Ptr(armscvmm.ProvisioningActionInstall), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // Status: to.Ptr("jpoukrzfenzrmjdahimkl"), - // UUID: to.Ptr("hbsgztyakewtgbuxbesezncnzu"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/GuestAgents_Create_MinimumSet_Gen.json -func ExampleGuestAgentsClient_BeginCreate_guestAgentsCreateMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewGuestAgentsClient().BeginCreate(ctx, "gtgclehcbsyave", armscvmm.GuestAgent{}, 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.GuestAgent = armscvmm.GuestAgent{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/GuestAgents_Delete_MaximumSet_Gen.json -func ExampleGuestAgentsClient_Delete_guestAgentsDeleteMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewGuestAgentsClient().Delete(ctx, "gtgclehcbsyave", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/GuestAgents_Delete_MinimumSet_Gen.json -func ExampleGuestAgentsClient_Delete_guestAgentsDeleteMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewGuestAgentsClient().Delete(ctx, "gtgclehcbsyave", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/scvmm/armscvmm/interfaces.go b/sdk/resourcemanager/scvmm/armscvmm/interfaces.go index 963d33f39002..22346c1b8ff7 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/interfaces.go +++ b/sdk/resourcemanager/scvmm/armscvmm/interfaces.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. diff --git a/sdk/resourcemanager/scvmm/armscvmm/inventoryitems_client.go b/sdk/resourcemanager/scvmm/armscvmm/inventoryitems_client.go index 33d02089cc34..166a205c10fb 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/inventoryitems_client.go +++ b/sdk/resourcemanager/scvmm/armscvmm/inventoryitems_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. @@ -46,7 +43,7 @@ func NewInventoryItemsClient(subscriptionID string, credential azcore.TokenCrede // Create - Create Or Update InventoryItem. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vmmServerName - Name of the VmmServer. // - inventoryItemResourceName - Name of the inventoryItem. @@ -75,7 +72,7 @@ func (client *InventoryItemsClient) Create(ctx context.Context, resourceGroupNam } // createCreateRequest creates the Create request. -func (client *InventoryItemsClient) createCreateRequest(ctx context.Context, resourceGroupName string, vmmServerName string, inventoryItemResourceName string, resource InventoryItem, options *InventoryItemsClientCreateOptions) (*policy.Request, error) { +func (client *InventoryItemsClient) createCreateRequest(ctx context.Context, resourceGroupName string, vmmServerName string, inventoryItemResourceName string, resource InventoryItem, _ *InventoryItemsClientCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}/inventoryItems/{inventoryItemResourceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -98,7 +95,7 @@ func (client *InventoryItemsClient) createCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -119,7 +116,7 @@ func (client *InventoryItemsClient) createHandleResponse(resp *http.Response) (I // Delete - Deletes an inventoryItem. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vmmServerName - Name of the VmmServer. // - inventoryItemResourceName - Name of the inventoryItem. @@ -146,7 +143,7 @@ func (client *InventoryItemsClient) Delete(ctx context.Context, resourceGroupNam } // deleteCreateRequest creates the Delete request. -func (client *InventoryItemsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vmmServerName string, inventoryItemResourceName string, options *InventoryItemsClientDeleteOptions) (*policy.Request, error) { +func (client *InventoryItemsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vmmServerName string, inventoryItemResourceName string, _ *InventoryItemsClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}/inventoryItems/{inventoryItemResourceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -169,7 +166,7 @@ func (client *InventoryItemsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -178,7 +175,7 @@ func (client *InventoryItemsClient) deleteCreateRequest(ctx context.Context, res // Get - Shows an inventory item. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vmmServerName - Name of the VmmServer. // - inventoryItemResourceName - Name of the inventoryItem. @@ -206,7 +203,7 @@ func (client *InventoryItemsClient) Get(ctx context.Context, resourceGroupName s } // getCreateRequest creates the Get request. -func (client *InventoryItemsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vmmServerName string, inventoryItemResourceName string, options *InventoryItemsClientGetOptions) (*policy.Request, error) { +func (client *InventoryItemsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vmmServerName string, inventoryItemResourceName string, _ *InventoryItemsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}/inventoryItems/{inventoryItemResourceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -229,7 +226,7 @@ func (client *InventoryItemsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -246,7 +243,7 @@ func (client *InventoryItemsClient) getHandleResponse(resp *http.Response) (Inve // NewListByVmmServerPager - Returns the list of inventoryItems in the given VmmServer. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vmmServerName - Name of the VmmServer. // - options - InventoryItemsClientListByVmmServerOptions contains the optional parameters for the InventoryItemsClient.NewListByVmmServerPager @@ -275,7 +272,7 @@ func (client *InventoryItemsClient) NewListByVmmServerPager(resourceGroupName st } // listByVmmServerCreateRequest creates the ListByVmmServer request. -func (client *InventoryItemsClient) listByVmmServerCreateRequest(ctx context.Context, resourceGroupName string, vmmServerName string, options *InventoryItemsClientListByVmmServerOptions) (*policy.Request, error) { +func (client *InventoryItemsClient) listByVmmServerCreateRequest(ctx context.Context, resourceGroupName string, vmmServerName string, _ *InventoryItemsClientListByVmmServerOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}/inventoryItems" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -294,7 +291,7 @@ func (client *InventoryItemsClient) listByVmmServerCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/scvmm/armscvmm/inventoryitems_client_example_test.go b/sdk/resourcemanager/scvmm/armscvmm/inventoryitems_client_example_test.go deleted file mode 100644 index 72dfbef0933f..000000000000 --- a/sdk/resourcemanager/scvmm/armscvmm/inventoryitems_client_example_test.go +++ /dev/null @@ -1,264 +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 armscvmm_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/scvmm/armscvmm" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/InventoryItems_ListByVmmServer_MaximumSet_Gen.json -func ExampleInventoryItemsClient_NewListByVmmServerPager_inventoryItemsListByVmmServerMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewInventoryItemsClient().NewListByVmmServerPager("rgscvmm", "X", 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.InventoryItemListResult = armscvmm.InventoryItemListResult{ - // Value: []*armscvmm.InventoryItem{ - // { - // Name: to.Ptr("oimmcgxagnhmasgsmhdaigznub"), - // Type: to.Ptr("lfhuayaplzxdqzubmjvtgcan"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}/inventoryItems/inventoryItemResourceName"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Kind: to.Ptr("M\\d_,V."), - // Properties: &armscvmm.InventoryItemProperties{ - // InventoryItemName: to.Ptr("kspgdhmlmycalwrepfmshoaoumna"), - // InventoryType: to.Ptr(armscvmm.InventoryType("InventoryItemProperties")), - // ManagedResourceID: to.Ptr("ictxvjzvurnkdgwabqyyfyckkkdx"), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // UUID: to.Ptr("jolmoxfopwfoje"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/InventoryItems_ListByVmmServer_MinimumSet_Gen.json -func ExampleInventoryItemsClient_NewListByVmmServerPager_inventoryItemsListByVmmServerMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewInventoryItemsClient().NewListByVmmServerPager("rgscvmm", "H", 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.InventoryItemListResult = armscvmm.InventoryItemListResult{ - // Value: []*armscvmm.InventoryItem{ - // { - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}/inventoryItems/inventoryItemResourceName"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/InventoryItems_Get_MaximumSet_Gen.json -func ExampleInventoryItemsClient_Get_inventoryItemsGetMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewInventoryItemsClient().Get(ctx, "rgscvmm", "1", "2bFBede6-EEf8-becB-dBbd-B96DbBFdB3f3", 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.InventoryItem = armscvmm.InventoryItem{ - // Name: to.Ptr("oimmcgxagnhmasgsmhdaigznub"), - // Type: to.Ptr("lfhuayaplzxdqzubmjvtgcan"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}/inventoryItems/inventoryItemResourceName"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Kind: to.Ptr("M\\d_,V."), - // Properties: &armscvmm.InventoryItemProperties{ - // InventoryItemName: to.Ptr("kspgdhmlmycalwrepfmshoaoumna"), - // InventoryType: to.Ptr(armscvmm.InventoryType("InventoryItemProperties")), - // ManagedResourceID: to.Ptr("ictxvjzvurnkdgwabqyyfyckkkdx"), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // UUID: to.Ptr("jolmoxfopwfoje"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/InventoryItems_Get_MinimumSet_Gen.json -func ExampleInventoryItemsClient_Get_inventoryItemsGetMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewInventoryItemsClient().Get(ctx, "rgscvmm", "_", "cacb8Ceb-efAC-bebb-ae7C-dec8C5Bb7100", 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.InventoryItem = armscvmm.InventoryItem{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/InventoryItems_Create_MaximumSet_Gen.json -func ExampleInventoryItemsClient_Create_inventoryItemsCreateMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewInventoryItemsClient().Create(ctx, "rgscvmm", "O", "1BdDc2Ab-bDd9-Ebd6-bfdb-C0dbbdB5DEDf", armscvmm.InventoryItem{ - Kind: to.Ptr("M\\d_,V."), - Properties: &armscvmm.InventoryItemProperties{ - InventoryType: to.Ptr(armscvmm.InventoryType("InventoryItemProperties")), - }, - }, 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.InventoryItem = armscvmm.InventoryItem{ - // Name: to.Ptr("oimmcgxagnhmasgsmhdaigznub"), - // Type: to.Ptr("lfhuayaplzxdqzubmjvtgcan"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}/inventoryItems/inventoryItemResourceName"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Kind: to.Ptr("M\\d_,V."), - // Properties: &armscvmm.InventoryItemProperties{ - // InventoryItemName: to.Ptr("kspgdhmlmycalwrepfmshoaoumna"), - // InventoryType: to.Ptr(armscvmm.InventoryType("InventoryItemProperties")), - // ManagedResourceID: to.Ptr("ictxvjzvurnkdgwabqyyfyckkkdx"), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // UUID: to.Ptr("jolmoxfopwfoje"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/InventoryItems_Create_MinimumSet_Gen.json -func ExampleInventoryItemsClient_Create_inventoryItemsCreateMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewInventoryItemsClient().Create(ctx, "rgscvmm", ".", "bbFb0cBb-50ce-4bfc-3eeD-bC26AbCC257a", armscvmm.InventoryItem{}, 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.InventoryItem = armscvmm.InventoryItem{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/InventoryItems_Delete_MaximumSet_Gen.json -func ExampleInventoryItemsClient_Delete_inventoryItemsDeleteMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewInventoryItemsClient().Delete(ctx, "rgscvmm", "b", "EcECadfd-Eaaa-e5Ce-ebdA-badeEd3c6af1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/InventoryItems_Delete_MinimumSet_Gen.json -func ExampleInventoryItemsClient_Delete_inventoryItemsDeleteMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewInventoryItemsClient().Delete(ctx, "rgscvmm", "_", "cDBcbae6-BC3d-52fe-CedC-7eFeaBFabb82", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/scvmm/armscvmm/models.go b/sdk/resourcemanager/scvmm/armscvmm/models.go index 954137ee3c26..41881898f5d5 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/models.go +++ b/sdk/resourcemanager/scvmm/armscvmm/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. @@ -123,6 +120,9 @@ type CloudCapacity struct { // READ-ONLY; MemoryMB specifies a memory usage limit in megabytes. MemoryMB *int64 + // READ-ONLY; StorageGB gives the storage in GB present in the cloud. + StorageGB *int64 + // READ-ONLY; VMCount gives the max number of VMs that can be deployed in the cloud. VMCount *int64 } @@ -239,6 +239,9 @@ type GuestAgentProperties struct { // HTTP Proxy configuration for the VM. HTTPProxyConfig *HTTPProxyConfiguration + // The resource id of the private link scope this machine is assigned to, if any. + PrivateLinkScopeResourceID *string + // Gets or sets the guest agent provisioning action. ProvisioningAction *ProvisioningAction @@ -546,9 +549,33 @@ type OsProfileForVMInstance struct { // Admin password of the virtual machine. AdminPassword *string + // Gets or sets the admin username. + AdminUsername *string + // Gets or sets computer name. ComputerName *string + // Gets or sets the domain name. + DomainName *string + + // Password of the domain the VM has to join. + DomainPassword *string + + // Gets or sets the domain username. + DomainUsername *string + + // Gets or sets the product key.Input format xxxxx-xxxxx-xxxxx-xxxxx-xxxxx + ProductKey *string + + // Get or sets the commands to be run once at the time of creation separated by semicolons. + RunOnceCommands *string + + // Gets or sets the index value of the timezone. + Timezone *int32 + + // Gets or sets the workgroup. + Workgroup *string + // READ-ONLY; Gets os sku. OSSKU *string @@ -851,6 +878,9 @@ type VirtualMachineInventoryItem struct { // READ-ONLY; Gets the bios guid. BiosGUID *string + // READ-ONLY; Gets vm generation. + Generation *int64 + // READ-ONLY; Gets the Managed Object name in Vmm for the inventory item. InventoryItemName *string diff --git a/sdk/resourcemanager/scvmm/armscvmm/models_serde.go b/sdk/resourcemanager/scvmm/armscvmm/models_serde.go index a0c75adc8c61..542dd201b363 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/models_serde.go +++ b/sdk/resourcemanager/scvmm/armscvmm/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. @@ -293,6 +290,7 @@ func (c CloudCapacity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "cpuCount", c.CPUCount) populate(objectMap, "memoryMB", c.MemoryMB) + populate(objectMap, "storageGB", c.StorageGB) populate(objectMap, "vmCount", c.VMCount) return json.Marshal(objectMap) } @@ -312,6 +310,9 @@ func (c *CloudCapacity) UnmarshalJSON(data []byte) error { case "memoryMB": err = unpopulate(val, "MemoryMB", &c.MemoryMB) delete(rawMsg, key) + case "storageGB": + err = unpopulate(val, "StorageGB", &c.StorageGB) + delete(rawMsg, key) case "vmCount": err = unpopulate(val, "VMCount", &c.VMCount) delete(rawMsg, key) @@ -586,6 +587,7 @@ func (g GuestAgentProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "credentials", g.Credentials) populate(objectMap, "customResourceName", g.CustomResourceName) populate(objectMap, "httpProxyConfig", g.HTTPProxyConfig) + populate(objectMap, "privateLinkScopeResourceId", g.PrivateLinkScopeResourceID) populate(objectMap, "provisioningAction", g.ProvisioningAction) populate(objectMap, "provisioningState", g.ProvisioningState) populate(objectMap, "status", g.Status) @@ -611,6 +613,9 @@ func (g *GuestAgentProperties) UnmarshalJSON(data []byte) error { case "httpProxyConfig": err = unpopulate(val, "HTTPProxyConfig", &g.HTTPProxyConfig) delete(rawMsg, key) + case "privateLinkScopeResourceId": + err = unpopulate(val, "PrivateLinkScopeResourceID", &g.PrivateLinkScopeResourceID) + delete(rawMsg, key) case "provisioningAction": err = unpopulate(val, "ProvisioningAction", &g.ProvisioningAction) delete(rawMsg, key) @@ -1322,10 +1327,18 @@ func (o *OperationListResult) UnmarshalJSON(data []byte) error { func (o OsProfileForVMInstance) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "adminPassword", o.AdminPassword) + populate(objectMap, "adminUsername", o.AdminUsername) populate(objectMap, "computerName", o.ComputerName) + populate(objectMap, "domainName", o.DomainName) + populate(objectMap, "domainPassword", o.DomainPassword) + populate(objectMap, "domainUsername", o.DomainUsername) populate(objectMap, "osSku", o.OSSKU) populate(objectMap, "osType", o.OSType) populate(objectMap, "osVersion", o.OSVersion) + populate(objectMap, "productKey", o.ProductKey) + populate(objectMap, "runOnceCommands", o.RunOnceCommands) + populate(objectMap, "timezone", o.Timezone) + populate(objectMap, "workgroup", o.Workgroup) return json.Marshal(objectMap) } @@ -1341,9 +1354,21 @@ func (o *OsProfileForVMInstance) UnmarshalJSON(data []byte) error { case "adminPassword": err = unpopulate(val, "AdminPassword", &o.AdminPassword) delete(rawMsg, key) + case "adminUsername": + err = unpopulate(val, "AdminUsername", &o.AdminUsername) + delete(rawMsg, key) case "computerName": err = unpopulate(val, "ComputerName", &o.ComputerName) delete(rawMsg, key) + case "domainName": + err = unpopulate(val, "DomainName", &o.DomainName) + delete(rawMsg, key) + case "domainPassword": + err = unpopulate(val, "DomainPassword", &o.DomainPassword) + delete(rawMsg, key) + case "domainUsername": + err = unpopulate(val, "DomainUsername", &o.DomainUsername) + delete(rawMsg, key) case "osSku": err = unpopulate(val, "OSSKU", &o.OSSKU) delete(rawMsg, key) @@ -1353,6 +1378,18 @@ func (o *OsProfileForVMInstance) UnmarshalJSON(data []byte) error { case "osVersion": err = unpopulate(val, "OSVersion", &o.OSVersion) delete(rawMsg, key) + case "productKey": + err = unpopulate(val, "ProductKey", &o.ProductKey) + delete(rawMsg, key) + case "runOnceCommands": + err = unpopulate(val, "RunOnceCommands", &o.RunOnceCommands) + delete(rawMsg, key) + case "timezone": + err = unpopulate(val, "Timezone", &o.Timezone) + delete(rawMsg, key) + case "workgroup": + err = unpopulate(val, "Workgroup", &o.Workgroup) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", o, err) @@ -2076,6 +2113,7 @@ func (v VirtualMachineInventoryItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "biosGuid", v.BiosGUID) populate(objectMap, "cloud", v.Cloud) + populate(objectMap, "generation", v.Generation) populate(objectMap, "ipAddresses", v.IPAddresses) populate(objectMap, "inventoryItemName", v.InventoryItemName) objectMap["inventoryType"] = InventoryTypeVirtualMachine @@ -2105,6 +2143,9 @@ func (v *VirtualMachineInventoryItem) UnmarshalJSON(data []byte) error { case "cloud": err = unpopulate(val, "Cloud", &v.Cloud) delete(rawMsg, key) + case "generation": + err = unpopulate(val, "Generation", &v.Generation) + delete(rawMsg, key) case "ipAddresses": err = unpopulate(val, "IPAddresses", &v.IPAddresses) delete(rawMsg, key) diff --git a/sdk/resourcemanager/scvmm/armscvmm/operations_client.go b/sdk/resourcemanager/scvmm/armscvmm/operations_client.go index 859c2036320a..d3830277a7b0 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/operations_client.go +++ b/sdk/resourcemanager/scvmm/armscvmm/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. @@ -39,7 +36,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - List the operations for the provider // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -65,14 +62,14 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption } // listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.ScVmm/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/scvmm/armscvmm/operations_client_example_test.go b/sdk/resourcemanager/scvmm/armscvmm/operations_client_example_test.go deleted file mode 100644 index 15482cfb6029..000000000000 --- a/sdk/resourcemanager/scvmm/armscvmm/operations_client_example_test.go +++ /dev/null @@ -1,85 +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 armscvmm_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/scvmm/armscvmm" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/Operations_List_MaximumSet_Gen.json -func ExampleOperationsClient_NewListPager_operationsListMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.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 = armscvmm.OperationListResult{ - // Value: []*armscvmm.Operation{ - // { - // Name: to.Ptr("rieknsh"), - // ActionType: to.Ptr(armscvmm.ActionTypeInternal), - // Display: &armscvmm.OperationDisplay{ - // Description: to.Ptr("fmwevntnynhgzoksqpjidn"), - // Operation: to.Ptr("v"), - // Provider: to.Ptr("avkabpzrbafrbnubspbrsippj"), - // Resource: to.Ptr("qojushhvjhkwwmboofogcky"), - // }, - // IsDataAction: to.Ptr(true), - // Origin: to.Ptr(armscvmm.OriginUser), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/Operations_List_MinimumSet_Gen.json -func ExampleOperationsClient_NewListPager_operationsListMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.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 = armscvmm.OperationListResult{ - // } - } -} diff --git a/sdk/resourcemanager/scvmm/armscvmm/options.go b/sdk/resourcemanager/scvmm/armscvmm/options.go index b22dfafc9139..95ff4e2b035c 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/options.go +++ b/sdk/resourcemanager/scvmm/armscvmm/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,7 +8,7 @@ package armscvmm // AvailabilitySetsClientBeginCreateOrUpdateOptions contains the optional parameters for the AvailabilitySetsClient.BeginCreateOrUpdate // method. type AvailabilitySetsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -20,13 +17,13 @@ type AvailabilitySetsClientBeginDeleteOptions struct { // Forces the resource to be deleted. Force *ForceDelete - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // AvailabilitySetsClientBeginUpdateOptions contains the optional parameters for the AvailabilitySetsClient.BeginUpdate method. type AvailabilitySetsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -49,7 +46,7 @@ type AvailabilitySetsClientListBySubscriptionOptions struct { // CloudsClientBeginCreateOrUpdateOptions contains the optional parameters for the CloudsClient.BeginCreateOrUpdate method. type CloudsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -58,13 +55,13 @@ type CloudsClientBeginDeleteOptions struct { // Forces the resource to be deleted. Force *ForceDelete - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // CloudsClientBeginUpdateOptions contains the optional parameters for the CloudsClient.BeginUpdate method. type CloudsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -87,7 +84,7 @@ type CloudsClientListBySubscriptionOptions struct { // GuestAgentsClientBeginCreateOptions contains the optional parameters for the GuestAgentsClient.BeginCreate method. type GuestAgentsClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -148,21 +145,21 @@ type VMInstanceHybridIdentityMetadatasClientListByVirtualMachineInstanceOptions // VirtualMachineInstancesClientBeginCreateCheckpointOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginCreateCheckpoint // method. type VirtualMachineInstancesClientBeginCreateCheckpointOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // VirtualMachineInstancesClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginCreateOrUpdate // method. type VirtualMachineInstancesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // VirtualMachineInstancesClientBeginDeleteCheckpointOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginDeleteCheckpoint // method. type VirtualMachineInstancesClientBeginDeleteCheckpointOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -175,42 +172,45 @@ type VirtualMachineInstancesClientBeginDeleteOptions struct { // Forces the resource to be deleted. Force *ForceDelete - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // VirtualMachineInstancesClientBeginRestartOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginRestart // method. type VirtualMachineInstancesClientBeginRestartOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // VirtualMachineInstancesClientBeginRestoreCheckpointOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginRestoreCheckpoint // method. type VirtualMachineInstancesClientBeginRestoreCheckpointOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // VirtualMachineInstancesClientBeginStartOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginStart // method. type VirtualMachineInstancesClientBeginStartOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // VirtualMachineInstancesClientBeginStopOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginStop // method. type VirtualMachineInstancesClientBeginStopOptions struct { - // Resumes the LRO from the provided token. + // The content of the action request + Body *StopVirtualMachineOptions + + // Resumes the long-running operation from the provided token. ResumeToken string } // VirtualMachineInstancesClientBeginUpdateOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginUpdate // method. type VirtualMachineInstancesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -228,7 +228,7 @@ type VirtualMachineInstancesClientListOptions struct { // VirtualMachineTemplatesClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualMachineTemplatesClient.BeginCreateOrUpdate // method. type VirtualMachineTemplatesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -238,14 +238,14 @@ type VirtualMachineTemplatesClientBeginDeleteOptions struct { // Forces the resource to be deleted. Force *ForceDelete - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // VirtualMachineTemplatesClientBeginUpdateOptions contains the optional parameters for the VirtualMachineTemplatesClient.BeginUpdate // method. type VirtualMachineTemplatesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -269,7 +269,7 @@ type VirtualMachineTemplatesClientListBySubscriptionOptions struct { // VirtualNetworksClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworksClient.BeginCreateOrUpdate // method. type VirtualNetworksClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -278,13 +278,13 @@ type VirtualNetworksClientBeginDeleteOptions struct { // Forces the resource to be deleted. Force *ForceDelete - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // VirtualNetworksClientBeginUpdateOptions contains the optional parameters for the VirtualNetworksClient.BeginUpdate method. type VirtualNetworksClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -308,7 +308,7 @@ type VirtualNetworksClientListBySubscriptionOptions struct { // VmmServersClientBeginCreateOrUpdateOptions contains the optional parameters for the VmmServersClient.BeginCreateOrUpdate // method. type VmmServersClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -317,13 +317,13 @@ type VmmServersClientBeginDeleteOptions struct { // Forces the resource to be deleted. Force *ForceDelete - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // VmmServersClientBeginUpdateOptions contains the optional parameters for the VmmServersClient.BeginUpdate method. type VmmServersClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } diff --git a/sdk/resourcemanager/scvmm/armscvmm/polymorphic_helpers.go b/sdk/resourcemanager/scvmm/armscvmm/polymorphic_helpers.go index 336d9c45d58d..8f58d93b7e8b 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/polymorphic_helpers.go +++ b/sdk/resourcemanager/scvmm/armscvmm/polymorphic_helpers.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. diff --git a/sdk/resourcemanager/scvmm/armscvmm/responses.go b/sdk/resourcemanager/scvmm/armscvmm/responses.go index 1b7d0d73a597..0fb606e938d3 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/responses.go +++ b/sdk/resourcemanager/scvmm/armscvmm/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. diff --git a/sdk/resourcemanager/scvmm/armscvmm/time_rfc3339.go b/sdk/resourcemanager/scvmm/armscvmm/time_rfc3339.go index acbe2d31cf8f..464c6b68a34e 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/time_rfc3339.go +++ b/sdk/resourcemanager/scvmm/armscvmm/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. @@ -60,6 +57,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string diff --git a/sdk/resourcemanager/scvmm/armscvmm/virtualmachineinstances_client.go b/sdk/resourcemanager/scvmm/armscvmm/virtualmachineinstances_client.go index baed77d9ab5c..87cf2036c0d5 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/virtualmachineinstances_client.go +++ b/sdk/resourcemanager/scvmm/armscvmm/virtualmachineinstances_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. @@ -41,7 +38,7 @@ func NewVirtualMachineInstancesClient(credential azcore.TokenCredential, options // BeginCreateCheckpoint - Creates a checkpoint in virtual machine instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceURI - The fully qualified Azure Resource manager identifier of the resource. // - body - The content of the action request // - options - VirtualMachineInstancesClientBeginCreateCheckpointOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginCreateCheckpoint @@ -67,7 +64,7 @@ func (client *VirtualMachineInstancesClient) BeginCreateCheckpoint(ctx context.C // CreateCheckpoint - Creates a checkpoint in virtual machine instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 func (client *VirtualMachineInstancesClient) createCheckpoint(ctx context.Context, resourceURI string, body VirtualMachineCreateCheckpoint, options *VirtualMachineInstancesClientBeginCreateCheckpointOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineInstancesClient.BeginCreateCheckpoint" @@ -90,7 +87,7 @@ func (client *VirtualMachineInstancesClient) createCheckpoint(ctx context.Contex } // createCheckpointCreateRequest creates the CreateCheckpoint request. -func (client *VirtualMachineInstancesClient) createCheckpointCreateRequest(ctx context.Context, resourceURI string, body VirtualMachineCreateCheckpoint, options *VirtualMachineInstancesClientBeginCreateCheckpointOptions) (*policy.Request, error) { +func (client *VirtualMachineInstancesClient) createCheckpointCreateRequest(ctx context.Context, resourceURI string, body VirtualMachineCreateCheckpoint, _ *VirtualMachineInstancesClientBeginCreateCheckpointOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/createCheckpoint" urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -98,7 +95,7 @@ func (client *VirtualMachineInstancesClient) createCheckpointCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -111,7 +108,7 @@ func (client *VirtualMachineInstancesClient) createCheckpointCreateRequest(ctx c // set only during virtual machine instance creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceURI - The fully qualified Azure Resource manager identifier of the resource. // - resource - Resource create parameters. // - options - VirtualMachineInstancesClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginCreateOrUpdate @@ -138,7 +135,7 @@ func (client *VirtualMachineInstancesClient) BeginCreateOrUpdate(ctx context.Con // during virtual machine instance creation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 func (client *VirtualMachineInstancesClient) createOrUpdate(ctx context.Context, resourceURI string, resource VirtualMachineInstance, options *VirtualMachineInstancesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineInstancesClient.BeginCreateOrUpdate" @@ -161,7 +158,7 @@ func (client *VirtualMachineInstancesClient) createOrUpdate(ctx context.Context, } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *VirtualMachineInstancesClient) createOrUpdateCreateRequest(ctx context.Context, resourceURI string, resource VirtualMachineInstance, options *VirtualMachineInstancesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *VirtualMachineInstancesClient) createOrUpdateCreateRequest(ctx context.Context, resourceURI string, resource VirtualMachineInstance, _ *VirtualMachineInstancesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default" urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -169,7 +166,7 @@ func (client *VirtualMachineInstancesClient) createOrUpdateCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -181,7 +178,7 @@ func (client *VirtualMachineInstancesClient) createOrUpdateCreateRequest(ctx con // BeginDelete - The operation to delete a virtual machine instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceURI - The fully qualified Azure Resource manager identifier of the resource. // - options - VirtualMachineInstancesClientBeginDeleteOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginDelete // method. @@ -206,7 +203,7 @@ func (client *VirtualMachineInstancesClient) BeginDelete(ctx context.Context, re // Delete - The operation to delete a virtual machine instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 func (client *VirtualMachineInstancesClient) deleteOperation(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineInstancesClient.BeginDelete" @@ -237,7 +234,7 @@ func (client *VirtualMachineInstancesClient) deleteCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") if options != nil && options.DeleteFromHost != nil { reqQP.Set("deleteFromHost", string(*options.DeleteFromHost)) } @@ -252,7 +249,7 @@ func (client *VirtualMachineInstancesClient) deleteCreateRequest(ctx context.Con // BeginDeleteCheckpoint - Deletes a checkpoint in virtual machine instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceURI - The fully qualified Azure Resource manager identifier of the resource. // - body - The content of the action request // - options - VirtualMachineInstancesClientBeginDeleteCheckpointOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginDeleteCheckpoint @@ -278,7 +275,7 @@ func (client *VirtualMachineInstancesClient) BeginDeleteCheckpoint(ctx context.C // DeleteCheckpoint - Deletes a checkpoint in virtual machine instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 func (client *VirtualMachineInstancesClient) deleteCheckpoint(ctx context.Context, resourceURI string, body VirtualMachineDeleteCheckpoint, options *VirtualMachineInstancesClientBeginDeleteCheckpointOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineInstancesClient.BeginDeleteCheckpoint" @@ -301,7 +298,7 @@ func (client *VirtualMachineInstancesClient) deleteCheckpoint(ctx context.Contex } // deleteCheckpointCreateRequest creates the DeleteCheckpoint request. -func (client *VirtualMachineInstancesClient) deleteCheckpointCreateRequest(ctx context.Context, resourceURI string, body VirtualMachineDeleteCheckpoint, options *VirtualMachineInstancesClientBeginDeleteCheckpointOptions) (*policy.Request, error) { +func (client *VirtualMachineInstancesClient) deleteCheckpointCreateRequest(ctx context.Context, resourceURI string, body VirtualMachineDeleteCheckpoint, _ *VirtualMachineInstancesClientBeginDeleteCheckpointOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/deleteCheckpoint" urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -309,7 +306,7 @@ func (client *VirtualMachineInstancesClient) deleteCheckpointCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -321,7 +318,7 @@ func (client *VirtualMachineInstancesClient) deleteCheckpointCreateRequest(ctx c // Get - Retrieves information about a virtual machine instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceURI - The fully qualified Azure Resource manager identifier of the resource. // - options - VirtualMachineInstancesClientGetOptions contains the optional parameters for the VirtualMachineInstancesClient.Get // method. @@ -348,7 +345,7 @@ func (client *VirtualMachineInstancesClient) Get(ctx context.Context, resourceUR } // getCreateRequest creates the Get request. -func (client *VirtualMachineInstancesClient) getCreateRequest(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientGetOptions) (*policy.Request, error) { +func (client *VirtualMachineInstancesClient) getCreateRequest(ctx context.Context, resourceURI string, _ *VirtualMachineInstancesClientGetOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default" urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -356,7 +353,7 @@ func (client *VirtualMachineInstancesClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -373,7 +370,7 @@ func (client *VirtualMachineInstancesClient) getHandleResponse(resp *http.Respon // NewListPager - Lists all of the virtual machine instances within the specified parent resource. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceURI - The fully qualified Azure Resource manager identifier of the resource. // - options - VirtualMachineInstancesClientListOptions contains the optional parameters for the VirtualMachineInstancesClient.NewListPager // method. @@ -401,7 +398,7 @@ func (client *VirtualMachineInstancesClient) NewListPager(resourceURI string, op } // listCreateRequest creates the List request. -func (client *VirtualMachineInstancesClient) listCreateRequest(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientListOptions) (*policy.Request, error) { +func (client *VirtualMachineInstancesClient) listCreateRequest(ctx context.Context, resourceURI string, _ *VirtualMachineInstancesClientListOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances" urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -409,7 +406,7 @@ func (client *VirtualMachineInstancesClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -427,7 +424,7 @@ func (client *VirtualMachineInstancesClient) listHandleResponse(resp *http.Respo // BeginRestart - The operation to restart a virtual machine instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceURI - The fully qualified Azure Resource manager identifier of the resource. // - options - VirtualMachineInstancesClientBeginRestartOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginRestart // method. @@ -452,7 +449,7 @@ func (client *VirtualMachineInstancesClient) BeginRestart(ctx context.Context, r // Restart - The operation to restart a virtual machine instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 func (client *VirtualMachineInstancesClient) restart(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginRestartOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineInstancesClient.BeginRestart" @@ -475,7 +472,7 @@ func (client *VirtualMachineInstancesClient) restart(ctx context.Context, resour } // restartCreateRequest creates the Restart request. -func (client *VirtualMachineInstancesClient) restartCreateRequest(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginRestartOptions) (*policy.Request, error) { +func (client *VirtualMachineInstancesClient) restartCreateRequest(ctx context.Context, resourceURI string, _ *VirtualMachineInstancesClientBeginRestartOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/restart" urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -483,7 +480,7 @@ func (client *VirtualMachineInstancesClient) restartCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -492,7 +489,7 @@ func (client *VirtualMachineInstancesClient) restartCreateRequest(ctx context.Co // BeginRestoreCheckpoint - Restores to a checkpoint in virtual machine instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceURI - The fully qualified Azure Resource manager identifier of the resource. // - body - The content of the action request // - options - VirtualMachineInstancesClientBeginRestoreCheckpointOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginRestoreCheckpoint @@ -518,7 +515,7 @@ func (client *VirtualMachineInstancesClient) BeginRestoreCheckpoint(ctx context. // RestoreCheckpoint - Restores to a checkpoint in virtual machine instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 func (client *VirtualMachineInstancesClient) restoreCheckpoint(ctx context.Context, resourceURI string, body VirtualMachineRestoreCheckpoint, options *VirtualMachineInstancesClientBeginRestoreCheckpointOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineInstancesClient.BeginRestoreCheckpoint" @@ -541,7 +538,7 @@ func (client *VirtualMachineInstancesClient) restoreCheckpoint(ctx context.Conte } // restoreCheckpointCreateRequest creates the RestoreCheckpoint request. -func (client *VirtualMachineInstancesClient) restoreCheckpointCreateRequest(ctx context.Context, resourceURI string, body VirtualMachineRestoreCheckpoint, options *VirtualMachineInstancesClientBeginRestoreCheckpointOptions) (*policy.Request, error) { +func (client *VirtualMachineInstancesClient) restoreCheckpointCreateRequest(ctx context.Context, resourceURI string, body VirtualMachineRestoreCheckpoint, _ *VirtualMachineInstancesClientBeginRestoreCheckpointOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/restoreCheckpoint" urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -549,7 +546,7 @@ func (client *VirtualMachineInstancesClient) restoreCheckpointCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { @@ -561,7 +558,7 @@ func (client *VirtualMachineInstancesClient) restoreCheckpointCreateRequest(ctx // BeginStart - The operation to start a virtual machine instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceURI - The fully qualified Azure Resource manager identifier of the resource. // - options - VirtualMachineInstancesClientBeginStartOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginStart // method. @@ -586,7 +583,7 @@ func (client *VirtualMachineInstancesClient) BeginStart(ctx context.Context, res // Start - The operation to start a virtual machine instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 func (client *VirtualMachineInstancesClient) start(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginStartOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineInstancesClient.BeginStart" @@ -609,7 +606,7 @@ func (client *VirtualMachineInstancesClient) start(ctx context.Context, resource } // startCreateRequest creates the Start request. -func (client *VirtualMachineInstancesClient) startCreateRequest(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginStartOptions) (*policy.Request, error) { +func (client *VirtualMachineInstancesClient) startCreateRequest(ctx context.Context, resourceURI string, _ *VirtualMachineInstancesClientBeginStartOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/start" urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -617,7 +614,7 @@ func (client *VirtualMachineInstancesClient) startCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -626,14 +623,13 @@ func (client *VirtualMachineInstancesClient) startCreateRequest(ctx context.Cont // BeginStop - The operation to power off (stop) a virtual machine instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceURI - The fully qualified Azure Resource manager identifier of the resource. -// - body - The content of the action request // - options - VirtualMachineInstancesClientBeginStopOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginStop // method. -func (client *VirtualMachineInstancesClient) BeginStop(ctx context.Context, resourceURI string, body StopVirtualMachineOptions, options *VirtualMachineInstancesClientBeginStopOptions) (*runtime.Poller[VirtualMachineInstancesClientStopResponse], error) { +func (client *VirtualMachineInstancesClient) BeginStop(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginStopOptions) (*runtime.Poller[VirtualMachineInstancesClientStopResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.stop(ctx, resourceURI, body, options) + resp, err := client.stop(ctx, resourceURI, options) if err != nil { return nil, err } @@ -652,14 +648,14 @@ func (client *VirtualMachineInstancesClient) BeginStop(ctx context.Context, reso // Stop - The operation to power off (stop) a virtual machine instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 -func (client *VirtualMachineInstancesClient) stop(ctx context.Context, resourceURI string, body StopVirtualMachineOptions, options *VirtualMachineInstancesClientBeginStopOptions) (*http.Response, error) { +// Generated from API version 2025-03-13 +func (client *VirtualMachineInstancesClient) stop(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginStopOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineInstancesClient.BeginStop" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.stopCreateRequest(ctx, resourceURI, body, options) + req, err := client.stopCreateRequest(ctx, resourceURI, options) if err != nil { return nil, err } @@ -675,7 +671,7 @@ func (client *VirtualMachineInstancesClient) stop(ctx context.Context, resourceU } // stopCreateRequest creates the Stop request. -func (client *VirtualMachineInstancesClient) stopCreateRequest(ctx context.Context, resourceURI string, body StopVirtualMachineOptions, options *VirtualMachineInstancesClientBeginStopOptions) (*policy.Request, error) { +func (client *VirtualMachineInstancesClient) stopCreateRequest(ctx context.Context, resourceURI string, options *VirtualMachineInstancesClientBeginStopOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/stop" urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -683,11 +679,14 @@ func (client *VirtualMachineInstancesClient) stopCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, body); err != nil { - return nil, err + if options != nil && options.Body != nil { + if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { + return nil, err + } + return req, nil } return req, nil } @@ -695,7 +694,7 @@ func (client *VirtualMachineInstancesClient) stopCreateRequest(ctx context.Conte // BeginUpdate - The operation to update a virtual machine instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceURI - The fully qualified Azure Resource manager identifier of the resource. // - properties - The resource properties to be updated. // - options - VirtualMachineInstancesClientBeginUpdateOptions contains the optional parameters for the VirtualMachineInstancesClient.BeginUpdate @@ -721,7 +720,7 @@ func (client *VirtualMachineInstancesClient) BeginUpdate(ctx context.Context, re // Update - The operation to update a virtual machine instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 func (client *VirtualMachineInstancesClient) update(ctx context.Context, resourceURI string, properties VirtualMachineInstanceUpdate, options *VirtualMachineInstancesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineInstancesClient.BeginUpdate" @@ -744,7 +743,7 @@ func (client *VirtualMachineInstancesClient) update(ctx context.Context, resourc } // updateCreateRequest creates the Update request. -func (client *VirtualMachineInstancesClient) updateCreateRequest(ctx context.Context, resourceURI string, properties VirtualMachineInstanceUpdate, options *VirtualMachineInstancesClientBeginUpdateOptions) (*policy.Request, error) { +func (client *VirtualMachineInstancesClient) updateCreateRequest(ctx context.Context, resourceURI string, properties VirtualMachineInstanceUpdate, _ *VirtualMachineInstancesClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default" urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -752,7 +751,7 @@ func (client *VirtualMachineInstancesClient) updateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, properties); err != nil { diff --git a/sdk/resourcemanager/scvmm/armscvmm/virtualmachineinstances_client_example_test.go b/sdk/resourcemanager/scvmm/armscvmm/virtualmachineinstances_client_example_test.go deleted file mode 100644 index d2eb007ddf2a..000000000000 --- a/sdk/resourcemanager/scvmm/armscvmm/virtualmachineinstances_client_example_test.go +++ /dev/null @@ -1,1079 +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 armscvmm_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/scvmm/armscvmm" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_List_MaximumSet_Gen.json -func ExampleVirtualMachineInstancesClient_NewListPager_virtualMachineInstancesListMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineInstancesClient().NewListPager("gtgclehcbsyave", 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.VirtualMachineInstanceListResult = armscvmm.VirtualMachineInstanceListResult{ - // Value: []*armscvmm.VirtualMachineInstance{ - // { - // Name: to.Ptr("uuqpsdoiyvedvqtrwop"), - // Type: to.Ptr("zculorteltpvthtzgnpgdpoe"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualMachineInstances/default"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - // Type: to.Ptr("customLocation"), - // }, - // Properties: &armscvmm.VirtualMachineInstanceProperties{ - // AvailabilitySets: []*armscvmm.AvailabilitySetListItem{ - // { - // Name: to.Ptr("lwbhaseo"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/availabilitySets/availabilitySetResourceName"), - // }}, - // HardwareProfile: &armscvmm.HardwareProfile{ - // CPUCount: to.Ptr[int32](22), - // DynamicMemoryEnabled: to.Ptr(armscvmm.DynamicMemoryEnabledTrue), - // DynamicMemoryMaxMB: to.Ptr[int32](2), - // DynamicMemoryMinMB: to.Ptr[int32](30), - // IsHighlyAvailable: to.Ptr(armscvmm.IsHighlyAvailableTrue), - // LimitCPUForMigration: to.Ptr(armscvmm.LimitCPUForMigrationTrue), - // MemoryMB: to.Ptr[int32](5), - // }, - // InfrastructureProfile: &armscvmm.InfrastructureProfile{ - // BiosGUID: to.Ptr("xixivxifyql"), - // CheckpointType: to.Ptr("jkbpzjxpeegackhsvikrnlnwqz"), - // Checkpoints: []*armscvmm.Checkpoint{ - // { - // Name: to.Ptr("keqn"), - // Description: to.Ptr("qurzfrgyflrh"), - // CheckpointID: to.Ptr("wsqmrje"), - // ParentCheckpointID: to.Ptr("hqhhzikoxunuqguouw"), - // }}, - // CloudID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/clouds/cloudResourceName"), - // Generation: to.Ptr[int32](28), - // InventoryItemID: to.Ptr("ihkkqmg"), - // LastRestoredVMCheckpoint: &armscvmm.Checkpoint{ - // Name: to.Ptr("keqn"), - // Description: to.Ptr("qurzfrgyflrh"), - // CheckpointID: to.Ptr("wsqmrje"), - // ParentCheckpointID: to.Ptr("hqhhzikoxunuqguouw"), - // }, - // TemplateID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualMachineTemplates/virtualMachineTemplateName"), - // UUID: to.Ptr("hrpw"), - // VMName: to.Ptr("qovpayfydhcvfrhe"), - // VmmServerID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // }, - // NetworkProfile: &armscvmm.NetworkProfile{ - // NetworkInterfaces: []*armscvmm.NetworkInterface{ - // { - // Name: to.Ptr("kvofzqulbjlbtt"), - // DisplayName: to.Ptr("yoayfd"), - // IPv4AddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - // IPv4Addresses: []*string{ - // to.Ptr("eeunirpkpqazzxhsqonkxcfuks")}, - // IPv6AddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - // IPv6Addresses: []*string{ - // to.Ptr("pk")}, - // MacAddress: to.Ptr("oaeqqegt"), - // MacAddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - // NetworkName: to.Ptr("lqbm"), - // NicID: to.Ptr("roxpsvlo"), - // VirtualNetworkID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualNetworks/virtualNetworkName"), - // }}, - // }, - // OSProfile: &armscvmm.OsProfileForVMInstance{ - // ComputerName: to.Ptr("uuxpcxuxcufllc"), - // OSSKU: to.Ptr("cxqnjxgkts"), - // OSType: to.Ptr(armscvmm.OsTypeWindows), - // OSVersion: to.Ptr("djt"), - // }, - // PowerState: to.Ptr("dbqyxewvrbqcifpwfvxyllwyaffmvm"), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // StorageProfile: &armscvmm.StorageProfile{ - // Disks: []*armscvmm.VirtualDisk{ - // { - // Name: to.Ptr("fgnckfymwdsqnfxkdvexuaobe"), - // Bus: to.Ptr[int32](8), - // BusType: to.Ptr("zu"), - // CreateDiffDisk: to.Ptr(armscvmm.CreateDiffDiskTrue), - // DiskID: to.Ptr("ltdrwcfjklpsimhzqyh"), - // DiskSizeGB: to.Ptr[int32](30), - // DisplayName: to.Ptr("fgladknawlgjodo"), - // Lun: to.Ptr[int32](10), - // MaxDiskSizeGB: to.Ptr[int32](18), - // StorageQosPolicy: &armscvmm.StorageQosPolicyDetails{ - // Name: to.Ptr("ceiyfrflu"), - // ID: to.Ptr("o"), - // }, - // TemplateDiskID: to.Ptr("lcdwrokpyvekqccclf"), - // VhdFormatType: to.Ptr("vbcrrmhgahznifudvhxfagwoplcb"), - // VhdType: to.Ptr("cnbeeeylrvopigdynvgpkfp"), - // VolumeType: to.Ptr("ckkymkuekzzqhexyjueruzlfemoeln"), - // }}, - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_List_MinimumSet_Gen.json -func ExampleVirtualMachineInstancesClient_NewListPager_virtualMachineInstancesListMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineInstancesClient().NewListPager("gtgclehcbsyave", 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.VirtualMachineInstanceListResult = armscvmm.VirtualMachineInstanceListResult{ - // Value: []*armscvmm.VirtualMachineInstance{ - // { - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualMachineInstances/default"), - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_Get_MaximumSet_Gen.json -func ExampleVirtualMachineInstancesClient_Get_virtualMachineInstancesGetMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineInstancesClient().Get(ctx, "gtgclehcbsyave", 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.VirtualMachineInstance = armscvmm.VirtualMachineInstance{ - // Name: to.Ptr("uuqpsdoiyvedvqtrwop"), - // Type: to.Ptr("zculorteltpvthtzgnpgdpoe"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualMachineInstances/default"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - // Type: to.Ptr("customLocation"), - // }, - // Properties: &armscvmm.VirtualMachineInstanceProperties{ - // AvailabilitySets: []*armscvmm.AvailabilitySetListItem{ - // { - // Name: to.Ptr("lwbhaseo"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/availabilitySets/availabilitySetResourceName"), - // }}, - // HardwareProfile: &armscvmm.HardwareProfile{ - // CPUCount: to.Ptr[int32](22), - // DynamicMemoryEnabled: to.Ptr(armscvmm.DynamicMemoryEnabledTrue), - // DynamicMemoryMaxMB: to.Ptr[int32](2), - // DynamicMemoryMinMB: to.Ptr[int32](30), - // IsHighlyAvailable: to.Ptr(armscvmm.IsHighlyAvailableTrue), - // LimitCPUForMigration: to.Ptr(armscvmm.LimitCPUForMigrationTrue), - // MemoryMB: to.Ptr[int32](5), - // }, - // InfrastructureProfile: &armscvmm.InfrastructureProfile{ - // BiosGUID: to.Ptr("xixivxifyql"), - // CheckpointType: to.Ptr("jkbpzjxpeegackhsvikrnlnwqz"), - // Checkpoints: []*armscvmm.Checkpoint{ - // { - // Name: to.Ptr("keqn"), - // Description: to.Ptr("qurzfrgyflrh"), - // CheckpointID: to.Ptr("wsqmrje"), - // ParentCheckpointID: to.Ptr("hqhhzikoxunuqguouw"), - // }}, - // CloudID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/clouds/cloudResourceName"), - // Generation: to.Ptr[int32](28), - // InventoryItemID: to.Ptr("ihkkqmg"), - // LastRestoredVMCheckpoint: &armscvmm.Checkpoint{ - // Name: to.Ptr("keqn"), - // Description: to.Ptr("qurzfrgyflrh"), - // CheckpointID: to.Ptr("wsqmrje"), - // ParentCheckpointID: to.Ptr("hqhhzikoxunuqguouw"), - // }, - // TemplateID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualMachineTemplates/virtualMachineTemplateName"), - // UUID: to.Ptr("hrpw"), - // VMName: to.Ptr("qovpayfydhcvfrhe"), - // VmmServerID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // }, - // NetworkProfile: &armscvmm.NetworkProfile{ - // NetworkInterfaces: []*armscvmm.NetworkInterface{ - // { - // Name: to.Ptr("kvofzqulbjlbtt"), - // DisplayName: to.Ptr("yoayfd"), - // IPv4AddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - // IPv4Addresses: []*string{ - // to.Ptr("eeunirpkpqazzxhsqonkxcfuks")}, - // IPv6AddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - // IPv6Addresses: []*string{ - // to.Ptr("pk")}, - // MacAddress: to.Ptr("oaeqqegt"), - // MacAddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - // NetworkName: to.Ptr("lqbm"), - // NicID: to.Ptr("roxpsvlo"), - // VirtualNetworkID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualNetworks/virtualNetworkName"), - // }}, - // }, - // OSProfile: &armscvmm.OsProfileForVMInstance{ - // ComputerName: to.Ptr("uuxpcxuxcufllc"), - // OSSKU: to.Ptr("cxqnjxgkts"), - // OSType: to.Ptr(armscvmm.OsTypeWindows), - // OSVersion: to.Ptr("djt"), - // }, - // PowerState: to.Ptr("dbqyxewvrbqcifpwfvxyllwyaffmvm"), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // StorageProfile: &armscvmm.StorageProfile{ - // Disks: []*armscvmm.VirtualDisk{ - // { - // Name: to.Ptr("fgnckfymwdsqnfxkdvexuaobe"), - // Bus: to.Ptr[int32](8), - // BusType: to.Ptr("zu"), - // CreateDiffDisk: to.Ptr(armscvmm.CreateDiffDiskTrue), - // DiskID: to.Ptr("ltdrwcfjklpsimhzqyh"), - // DiskSizeGB: to.Ptr[int32](30), - // DisplayName: to.Ptr("fgladknawlgjodo"), - // Lun: to.Ptr[int32](10), - // MaxDiskSizeGB: to.Ptr[int32](18), - // StorageQosPolicy: &armscvmm.StorageQosPolicyDetails{ - // Name: to.Ptr("ceiyfrflu"), - // ID: to.Ptr("o"), - // }, - // TemplateDiskID: to.Ptr("lcdwrokpyvekqccclf"), - // VhdFormatType: to.Ptr("vbcrrmhgahznifudvhxfagwoplcb"), - // VhdType: to.Ptr("cnbeeeylrvopigdynvgpkfp"), - // VolumeType: to.Ptr("ckkymkuekzzqhexyjueruzlfemoeln"), - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_Get_MinimumSet_Gen.json -func ExampleVirtualMachineInstancesClient_Get_virtualMachineInstancesGetMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineInstancesClient().Get(ctx, "gtgclehcbsyave", 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.VirtualMachineInstance = armscvmm.VirtualMachineInstance{ - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualMachineInstances/default"), - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_CreateOrUpdate_MaximumSet_Gen.json -func ExampleVirtualMachineInstancesClient_BeginCreateOrUpdate_virtualMachineInstancesCreateOrUpdateMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginCreateOrUpdate(ctx, "gtgclehcbsyave", armscvmm.VirtualMachineInstance{ - ExtendedLocation: &armscvmm.ExtendedLocation{ - Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - Type: to.Ptr("customLocation"), - }, - Properties: &armscvmm.VirtualMachineInstanceProperties{ - AvailabilitySets: []*armscvmm.AvailabilitySetListItem{ - { - Name: to.Ptr("lwbhaseo"), - ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/availabilitySets/availabilitySetResourceName"), - }}, - HardwareProfile: &armscvmm.HardwareProfile{ - CPUCount: to.Ptr[int32](22), - DynamicMemoryEnabled: to.Ptr(armscvmm.DynamicMemoryEnabledTrue), - DynamicMemoryMaxMB: to.Ptr[int32](2), - DynamicMemoryMinMB: to.Ptr[int32](30), - IsHighlyAvailable: to.Ptr(armscvmm.IsHighlyAvailableTrue), - LimitCPUForMigration: to.Ptr(armscvmm.LimitCPUForMigrationTrue), - MemoryMB: to.Ptr[int32](5), - }, - InfrastructureProfile: &armscvmm.InfrastructureProfile{ - BiosGUID: to.Ptr("xixivxifyql"), - CheckpointType: to.Ptr("jkbpzjxpeegackhsvikrnlnwqz"), - CloudID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/clouds/cloudResourceName"), - Generation: to.Ptr[int32](28), - InventoryItemID: to.Ptr("ihkkqmg"), - LastRestoredVMCheckpoint: &armscvmm.Checkpoint{ - Name: to.Ptr("keqn"), - Description: to.Ptr("qurzfrgyflrh"), - CheckpointID: to.Ptr("wsqmrje"), - ParentCheckpointID: to.Ptr("hqhhzikoxunuqguouw"), - }, - TemplateID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualMachineTemplates/virtualMachineTemplateName"), - UUID: to.Ptr("hrpw"), - VMName: to.Ptr("qovpayfydhcvfrhe"), - VmmServerID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - }, - NetworkProfile: &armscvmm.NetworkProfile{ - NetworkInterfaces: []*armscvmm.NetworkInterface{ - { - Name: to.Ptr("kvofzqulbjlbtt"), - IPv4AddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - IPv6AddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - MacAddress: to.Ptr("oaeqqegt"), - MacAddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - NicID: to.Ptr("roxpsvlo"), - VirtualNetworkID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualNetworks/virtualNetworkName"), - }}, - }, - OSProfile: &armscvmm.OsProfileForVMInstance{ - AdminPassword: to.Ptr("vavtppmmhlspydtkzxda"), - ComputerName: to.Ptr("uuxpcxuxcufllc"), - OSType: to.Ptr(armscvmm.OsTypeWindows), - }, - StorageProfile: &armscvmm.StorageProfile{ - Disks: []*armscvmm.VirtualDisk{ - { - Name: to.Ptr("fgnckfymwdsqnfxkdvexuaobe"), - Bus: to.Ptr[int32](8), - BusType: to.Ptr("zu"), - CreateDiffDisk: to.Ptr(armscvmm.CreateDiffDiskTrue), - DiskID: to.Ptr("ltdrwcfjklpsimhzqyh"), - DiskSizeGB: to.Ptr[int32](30), - Lun: to.Ptr[int32](10), - StorageQosPolicy: &armscvmm.StorageQosPolicyDetails{ - Name: to.Ptr("ceiyfrflu"), - ID: to.Ptr("o"), - }, - TemplateDiskID: to.Ptr("lcdwrokpyvekqccclf"), - VhdType: to.Ptr("cnbeeeylrvopigdynvgpkfp"), - }}, - }, - }, - }, 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.VirtualMachineInstance = armscvmm.VirtualMachineInstance{ - // Name: to.Ptr("uuqpsdoiyvedvqtrwop"), - // Type: to.Ptr("zculorteltpvthtzgnpgdpoe"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualMachineInstances/default"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - // Type: to.Ptr("customLocation"), - // }, - // Properties: &armscvmm.VirtualMachineInstanceProperties{ - // AvailabilitySets: []*armscvmm.AvailabilitySetListItem{ - // { - // Name: to.Ptr("lwbhaseo"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/availabilitySets/availabilitySetResourceName"), - // }}, - // HardwareProfile: &armscvmm.HardwareProfile{ - // CPUCount: to.Ptr[int32](22), - // DynamicMemoryEnabled: to.Ptr(armscvmm.DynamicMemoryEnabledTrue), - // DynamicMemoryMaxMB: to.Ptr[int32](2), - // DynamicMemoryMinMB: to.Ptr[int32](30), - // IsHighlyAvailable: to.Ptr(armscvmm.IsHighlyAvailableTrue), - // LimitCPUForMigration: to.Ptr(armscvmm.LimitCPUForMigrationTrue), - // MemoryMB: to.Ptr[int32](5), - // }, - // InfrastructureProfile: &armscvmm.InfrastructureProfile{ - // BiosGUID: to.Ptr("xixivxifyql"), - // CheckpointType: to.Ptr("jkbpzjxpeegackhsvikrnlnwqz"), - // Checkpoints: []*armscvmm.Checkpoint{ - // { - // Name: to.Ptr("keqn"), - // Description: to.Ptr("kz"), - // CheckpointID: to.Ptr("wsqmrje"), - // ParentCheckpointID: to.Ptr("hqhhzikoxunuqguouw"), - // }}, - // CloudID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/clouds/cloudResourceName"), - // Generation: to.Ptr[int32](28), - // InventoryItemID: to.Ptr("ihkkqmg"), - // LastRestoredVMCheckpoint: &armscvmm.Checkpoint{ - // Name: to.Ptr("keqn"), - // Description: to.Ptr("qurzfrgyflrh"), - // CheckpointID: to.Ptr("wsqmrje"), - // ParentCheckpointID: to.Ptr("hqhhzikoxunuqguouw"), - // }, - // TemplateID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualMachineTemplates/virtualMachineTemplateName"), - // UUID: to.Ptr("hrpw"), - // VMName: to.Ptr("qovpayfydhcvfrhe"), - // VmmServerID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // }, - // NetworkProfile: &armscvmm.NetworkProfile{ - // NetworkInterfaces: []*armscvmm.NetworkInterface{ - // { - // Name: to.Ptr("kvofzqulbjlbtt"), - // DisplayName: to.Ptr("yoayfd"), - // IPv4AddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - // IPv4Addresses: []*string{ - // to.Ptr("eeunirpkpqazzxhsqonkxcfuks")}, - // IPv6AddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - // IPv6Addresses: []*string{ - // to.Ptr("pk")}, - // MacAddress: to.Ptr("oaeqqegt"), - // MacAddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - // NetworkName: to.Ptr("lqbm"), - // NicID: to.Ptr("roxpsvlo"), - // VirtualNetworkID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualNetworks/virtualNetworkName"), - // }}, - // }, - // OSProfile: &armscvmm.OsProfileForVMInstance{ - // ComputerName: to.Ptr("uuxpcxuxcufllc"), - // OSSKU: to.Ptr("cxqnjxgkts"), - // OSType: to.Ptr(armscvmm.OsTypeWindows), - // OSVersion: to.Ptr("djt"), - // }, - // PowerState: to.Ptr("dbqyxewvrbqcifpwfvxyllwyaffmvm"), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // StorageProfile: &armscvmm.StorageProfile{ - // Disks: []*armscvmm.VirtualDisk{ - // { - // Name: to.Ptr("fgnckfymwdsqnfxkdvexuaobe"), - // Bus: to.Ptr[int32](8), - // BusType: to.Ptr("zu"), - // CreateDiffDisk: to.Ptr(armscvmm.CreateDiffDiskTrue), - // DiskID: to.Ptr("ltdrwcfjklpsimhzqyh"), - // DiskSizeGB: to.Ptr[int32](30), - // DisplayName: to.Ptr("fgladknawlgjodo"), - // Lun: to.Ptr[int32](10), - // MaxDiskSizeGB: to.Ptr[int32](18), - // StorageQosPolicy: &armscvmm.StorageQosPolicyDetails{ - // Name: to.Ptr("ceiyfrflu"), - // ID: to.Ptr("o"), - // }, - // TemplateDiskID: to.Ptr("lcdwrokpyvekqccclf"), - // VhdFormatType: to.Ptr("vbcrrmhgahznifudvhxfagwoplcb"), - // VhdType: to.Ptr("cnbeeeylrvopigdynvgpkfp"), - // VolumeType: to.Ptr("ckkymkuekzzqhexyjueruzlfemoeln"), - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_CreateOrUpdate_MinimumSet_Gen.json -func ExampleVirtualMachineInstancesClient_BeginCreateOrUpdate_virtualMachineInstancesCreateOrUpdateMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginCreateOrUpdate(ctx, "gtgclehcbsyave", armscvmm.VirtualMachineInstance{ - ExtendedLocation: &armscvmm.ExtendedLocation{}, - }, 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.VirtualMachineInstance = armscvmm.VirtualMachineInstance{ - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualMachineInstances/default"), - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_Update_MaximumSet_Gen.json -func ExampleVirtualMachineInstancesClient_BeginUpdate_virtualMachineInstancesUpdateMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginUpdate(ctx, "gtgclehcbsyave", armscvmm.VirtualMachineInstanceUpdate{ - Properties: &armscvmm.VirtualMachineInstanceUpdateProperties{ - AvailabilitySets: []*armscvmm.AvailabilitySetListItem{ - { - Name: to.Ptr("lwbhaseo"), - ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/availabilitySets/availabilitySetResourceName"), - }}, - HardwareProfile: &armscvmm.HardwareProfileUpdate{ - CPUCount: to.Ptr[int32](22), - DynamicMemoryEnabled: to.Ptr(armscvmm.DynamicMemoryEnabledTrue), - DynamicMemoryMaxMB: to.Ptr[int32](2), - DynamicMemoryMinMB: to.Ptr[int32](30), - LimitCPUForMigration: to.Ptr(armscvmm.LimitCPUForMigrationTrue), - MemoryMB: to.Ptr[int32](5), - }, - InfrastructureProfile: &armscvmm.InfrastructureProfileUpdate{ - CheckpointType: to.Ptr("jkbpzjxpeegackhsvikrnlnwqz"), - }, - NetworkProfile: &armscvmm.NetworkProfileUpdate{ - NetworkInterfaces: []*armscvmm.NetworkInterfaceUpdate{ - { - Name: to.Ptr("kvofzqulbjlbtt"), - IPv4AddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - IPv6AddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - MacAddress: to.Ptr("oaeqqegt"), - MacAddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - NicID: to.Ptr("roxpsvlo"), - VirtualNetworkID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualNetworks/virtualNetworkName"), - }}, - }, - StorageProfile: &armscvmm.StorageProfileUpdate{ - Disks: []*armscvmm.VirtualDiskUpdate{ - { - Name: to.Ptr("fgnckfymwdsqnfxkdvexuaobe"), - Bus: to.Ptr[int32](8), - BusType: to.Ptr("zu"), - DiskID: to.Ptr("ltdrwcfjklpsimhzqyh"), - DiskSizeGB: to.Ptr[int32](30), - Lun: to.Ptr[int32](10), - StorageQosPolicy: &armscvmm.StorageQosPolicyDetails{ - Name: to.Ptr("ceiyfrflu"), - ID: to.Ptr("o"), - }, - VhdType: to.Ptr("cnbeeeylrvopigdynvgpkfp"), - }}, - }, - }, - }, 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.VirtualMachineInstance = armscvmm.VirtualMachineInstance{ - // Name: to.Ptr("uuqpsdoiyvedvqtrwop"), - // Type: to.Ptr("zculorteltpvthtzgnpgdpoe"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualMachineInstances/default"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - // Type: to.Ptr("customLocation"), - // }, - // Properties: &armscvmm.VirtualMachineInstanceProperties{ - // AvailabilitySets: []*armscvmm.AvailabilitySetListItem{ - // { - // Name: to.Ptr("lwbhaseo"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/availabilitySets/availabilitySetResourceName"), - // }}, - // HardwareProfile: &armscvmm.HardwareProfile{ - // CPUCount: to.Ptr[int32](22), - // DynamicMemoryEnabled: to.Ptr(armscvmm.DynamicMemoryEnabledTrue), - // DynamicMemoryMaxMB: to.Ptr[int32](2), - // DynamicMemoryMinMB: to.Ptr[int32](30), - // IsHighlyAvailable: to.Ptr(armscvmm.IsHighlyAvailableTrue), - // LimitCPUForMigration: to.Ptr(armscvmm.LimitCPUForMigrationTrue), - // MemoryMB: to.Ptr[int32](5), - // }, - // InfrastructureProfile: &armscvmm.InfrastructureProfile{ - // BiosGUID: to.Ptr("xixivxifyql"), - // CheckpointType: to.Ptr("jkbpzjxpeegackhsvikrnlnwqz"), - // Checkpoints: []*armscvmm.Checkpoint{ - // { - // Name: to.Ptr("keqn"), - // Description: to.Ptr("kz"), - // CheckpointID: to.Ptr("wsqmrje"), - // ParentCheckpointID: to.Ptr("hqhhzikoxunuqguouw"), - // }}, - // CloudID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/clouds/cloudResourceName"), - // Generation: to.Ptr[int32](28), - // InventoryItemID: to.Ptr("ihkkqmg"), - // LastRestoredVMCheckpoint: &armscvmm.Checkpoint{ - // Name: to.Ptr("keqn"), - // Description: to.Ptr("qurzfrgyflrh"), - // CheckpointID: to.Ptr("wsqmrje"), - // ParentCheckpointID: to.Ptr("hqhhzikoxunuqguouw"), - // }, - // TemplateID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualMachineTemplates/virtualMachineTemplateName"), - // UUID: to.Ptr("hrpw"), - // VMName: to.Ptr("qovpayfydhcvfrhe"), - // VmmServerID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // }, - // NetworkProfile: &armscvmm.NetworkProfile{ - // NetworkInterfaces: []*armscvmm.NetworkInterface{ - // { - // Name: to.Ptr("kvofzqulbjlbtt"), - // DisplayName: to.Ptr("yoayfd"), - // IPv4AddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - // IPv4Addresses: []*string{ - // to.Ptr("eeunirpkpqazzxhsqonkxcfuks")}, - // IPv6AddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - // IPv6Addresses: []*string{ - // to.Ptr("pk")}, - // MacAddress: to.Ptr("oaeqqegt"), - // MacAddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - // NetworkName: to.Ptr("lqbm"), - // NicID: to.Ptr("roxpsvlo"), - // VirtualNetworkID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualNetworks/virtualNetworkName"), - // }}, - // }, - // OSProfile: &armscvmm.OsProfileForVMInstance{ - // ComputerName: to.Ptr("uuxpcxuxcufllc"), - // OSSKU: to.Ptr("cxqnjxgkts"), - // OSType: to.Ptr(armscvmm.OsTypeWindows), - // OSVersion: to.Ptr("djt"), - // }, - // PowerState: to.Ptr("dbqyxewvrbqcifpwfvxyllwyaffmvm"), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // StorageProfile: &armscvmm.StorageProfile{ - // Disks: []*armscvmm.VirtualDisk{ - // { - // Name: to.Ptr("fgnckfymwdsqnfxkdvexuaobe"), - // Bus: to.Ptr[int32](8), - // BusType: to.Ptr("zu"), - // CreateDiffDisk: to.Ptr(armscvmm.CreateDiffDiskTrue), - // DiskID: to.Ptr("ltdrwcfjklpsimhzqyh"), - // DiskSizeGB: to.Ptr[int32](30), - // DisplayName: to.Ptr("fgladknawlgjodo"), - // Lun: to.Ptr[int32](10), - // MaxDiskSizeGB: to.Ptr[int32](18), - // StorageQosPolicy: &armscvmm.StorageQosPolicyDetails{ - // Name: to.Ptr("ceiyfrflu"), - // ID: to.Ptr("o"), - // }, - // TemplateDiskID: to.Ptr("lcdwrokpyvekqccclf"), - // VhdFormatType: to.Ptr("vbcrrmhgahznifudvhxfagwoplcb"), - // VhdType: to.Ptr("cnbeeeylrvopigdynvgpkfp"), - // VolumeType: to.Ptr("ckkymkuekzzqhexyjueruzlfemoeln"), - // }}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_Update_MinimumSet_Gen.json -func ExampleVirtualMachineInstancesClient_BeginUpdate_virtualMachineInstancesUpdateMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginUpdate(ctx, "gtgclehcbsyave", armscvmm.VirtualMachineInstanceUpdate{}, 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.VirtualMachineInstance = armscvmm.VirtualMachineInstance{ - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_Delete_MaximumSet_Gen.json -func ExampleVirtualMachineInstancesClient_BeginDelete_virtualMachineInstancesDeleteMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginDelete(ctx, "gtgclehcbsyave", &armscvmm.VirtualMachineInstancesClientBeginDeleteOptions{Force: to.Ptr(armscvmm.ForceDeleteTrue), - DeleteFromHost: to.Ptr(armscvmm.DeleteFromHostTrue), - }) - 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/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_Delete_MinimumSet_Gen.json -func ExampleVirtualMachineInstancesClient_BeginDelete_virtualMachineInstancesDeleteMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginDelete(ctx, "gtgclehcbsyave", &armscvmm.VirtualMachineInstancesClientBeginDeleteOptions{Force: nil, - DeleteFromHost: 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/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_CreateCheckpoint_MaximumSet_Gen.json -func ExampleVirtualMachineInstancesClient_BeginCreateCheckpoint_virtualMachineInstancesCreateCheckpointMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginCreateCheckpoint(ctx, "gtgclehcbsyave", armscvmm.VirtualMachineCreateCheckpoint{ - Name: to.Ptr("ilvltf"), - Description: to.Ptr("zoozhfbepldrgpjqsbhpqebtodrhvy"), - }, 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/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_CreateCheckpoint_MinimumSet_Gen.json -func ExampleVirtualMachineInstancesClient_BeginCreateCheckpoint_virtualMachineInstancesCreateCheckpointMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginCreateCheckpoint(ctx, "gtgclehcbsyave", armscvmm.VirtualMachineCreateCheckpoint{}, 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/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_DeleteCheckpoint_MaximumSet_Gen.json -func ExampleVirtualMachineInstancesClient_BeginDeleteCheckpoint_virtualMachineInstancesDeleteCheckpointMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginDeleteCheckpoint(ctx, "gtgclehcbsyave", armscvmm.VirtualMachineDeleteCheckpoint{ - ID: to.Ptr("eenfflimcbgqfsebdusophahjpk"), - }, 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/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_DeleteCheckpoint_MinimumSet_Gen.json -func ExampleVirtualMachineInstancesClient_BeginDeleteCheckpoint_virtualMachineInstancesDeleteCheckpointMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginDeleteCheckpoint(ctx, "gtgclehcbsyave", armscvmm.VirtualMachineDeleteCheckpoint{}, 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/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_Restart_MaximumSet_Gen.json -func ExampleVirtualMachineInstancesClient_BeginRestart_virtualMachineInstancesRestartMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginRestart(ctx, "gtgclehcbsyave", 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/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_Restart_MinimumSet_Gen.json -func ExampleVirtualMachineInstancesClient_BeginRestart_virtualMachineInstancesRestartMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginRestart(ctx, "gtgclehcbsyave", 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/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_RestoreCheckpoint_MaximumSet_Gen.json -func ExampleVirtualMachineInstancesClient_BeginRestoreCheckpoint_virtualMachineInstancesRestoreCheckpointMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginRestoreCheckpoint(ctx, "gtgclehcbsyave", armscvmm.VirtualMachineRestoreCheckpoint{ - ID: to.Ptr("rweqduwzsn"), - }, 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/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_RestoreCheckpoint_MinimumSet_Gen.json -func ExampleVirtualMachineInstancesClient_BeginRestoreCheckpoint_virtualMachineInstancesRestoreCheckpointMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginRestoreCheckpoint(ctx, "gtgclehcbsyave", armscvmm.VirtualMachineRestoreCheckpoint{}, 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/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_Start_MaximumSet_Gen.json -func ExampleVirtualMachineInstancesClient_BeginStart_virtualMachineInstancesStartMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginStart(ctx, "gtgclehcbsyave", 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/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_Start_MinimumSet_Gen.json -func ExampleVirtualMachineInstancesClient_BeginStart_virtualMachineInstancesStartMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginStart(ctx, "gtgclehcbsyave", 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/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_Stop_MaximumSet_Gen.json -func ExampleVirtualMachineInstancesClient_BeginStop_virtualMachineInstancesStopMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginStop(ctx, "gtgclehcbsyave", armscvmm.StopVirtualMachineOptions{ - SkipShutdown: to.Ptr(armscvmm.SkipShutdownTrue), - }, 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/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineInstances_Stop_MinimumSet_Gen.json -func ExampleVirtualMachineInstancesClient_BeginStop_virtualMachineInstancesStopMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineInstancesClient().BeginStop(ctx, "gtgclehcbsyave", armscvmm.StopVirtualMachineOptions{}, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/scvmm/armscvmm/virtualmachinetemplates_client.go b/sdk/resourcemanager/scvmm/armscvmm/virtualmachinetemplates_client.go index 84281bc35baf..a1f99637dd8c 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/virtualmachinetemplates_client.go +++ b/sdk/resourcemanager/scvmm/armscvmm/virtualmachinetemplates_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. @@ -46,7 +43,7 @@ func NewVirtualMachineTemplatesClient(subscriptionID string, credential azcore.T // BeginCreateOrUpdate - Onboards the ScVmm VM Template as an Azure VM Template resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - virtualMachineTemplateName - Name of the VirtualMachineTemplate. // - resource - Resource create parameters. @@ -73,7 +70,7 @@ func (client *VirtualMachineTemplatesClient) BeginCreateOrUpdate(ctx context.Con // CreateOrUpdate - Onboards the ScVmm VM Template as an Azure VM Template resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 func (client *VirtualMachineTemplatesClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualMachineTemplateName string, resource VirtualMachineTemplate, options *VirtualMachineTemplatesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineTemplatesClient.BeginCreateOrUpdate" @@ -96,7 +93,7 @@ func (client *VirtualMachineTemplatesClient) createOrUpdate(ctx context.Context, } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *VirtualMachineTemplatesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineTemplateName string, resource VirtualMachineTemplate, options *VirtualMachineTemplatesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *VirtualMachineTemplatesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineTemplateName string, resource VirtualMachineTemplate, _ *VirtualMachineTemplatesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachineTemplates/{virtualMachineTemplateName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -115,7 +112,7 @@ func (client *VirtualMachineTemplatesClient) createOrUpdateCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -127,7 +124,7 @@ func (client *VirtualMachineTemplatesClient) createOrUpdateCreateRequest(ctx con // BeginDelete - Deregisters the ScVmm VM Template from Azure. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - virtualMachineTemplateName - Name of the VirtualMachineTemplate. // - options - VirtualMachineTemplatesClientBeginDeleteOptions contains the optional parameters for the VirtualMachineTemplatesClient.BeginDelete @@ -153,7 +150,7 @@ func (client *VirtualMachineTemplatesClient) BeginDelete(ctx context.Context, re // Delete - Deregisters the ScVmm VM Template from Azure. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 func (client *VirtualMachineTemplatesClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualMachineTemplateName string, options *VirtualMachineTemplatesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineTemplatesClient.BeginDelete" @@ -195,7 +192,7 @@ func (client *VirtualMachineTemplatesClient) deleteCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") if options != nil && options.Force != nil { reqQP.Set("force", string(*options.Force)) } @@ -207,7 +204,7 @@ func (client *VirtualMachineTemplatesClient) deleteCreateRequest(ctx context.Con // Get - Implements VirtualMachineTemplate GET method. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - virtualMachineTemplateName - Name of the VirtualMachineTemplate. // - options - VirtualMachineTemplatesClientGetOptions contains the optional parameters for the VirtualMachineTemplatesClient.Get @@ -235,7 +232,7 @@ func (client *VirtualMachineTemplatesClient) Get(ctx context.Context, resourceGr } // getCreateRequest creates the Get request. -func (client *VirtualMachineTemplatesClient) getCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineTemplateName string, options *VirtualMachineTemplatesClientGetOptions) (*policy.Request, error) { +func (client *VirtualMachineTemplatesClient) getCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineTemplateName string, _ *VirtualMachineTemplatesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachineTemplates/{virtualMachineTemplateName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -254,7 +251,7 @@ func (client *VirtualMachineTemplatesClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -271,7 +268,7 @@ func (client *VirtualMachineTemplatesClient) getHandleResponse(resp *http.Respon // NewListByResourceGroupPager - List of VirtualMachineTemplates in a resource group. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - VirtualMachineTemplatesClientListByResourceGroupOptions contains the optional parameters for the VirtualMachineTemplatesClient.NewListByResourceGroupPager // method. @@ -299,7 +296,7 @@ func (client *VirtualMachineTemplatesClient) NewListByResourceGroupPager(resourc } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *VirtualMachineTemplatesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *VirtualMachineTemplatesClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *VirtualMachineTemplatesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *VirtualMachineTemplatesClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachineTemplates" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -314,7 +311,7 @@ func (client *VirtualMachineTemplatesClient) listByResourceGroupCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -331,7 +328,7 @@ func (client *VirtualMachineTemplatesClient) listByResourceGroupHandleResponse(r // NewListBySubscriptionPager - List of VirtualMachineTemplates in a subscription. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - options - VirtualMachineTemplatesClientListBySubscriptionOptions contains the optional parameters for the VirtualMachineTemplatesClient.NewListBySubscriptionPager // method. func (client *VirtualMachineTemplatesClient) NewListBySubscriptionPager(options *VirtualMachineTemplatesClientListBySubscriptionOptions) *runtime.Pager[VirtualMachineTemplatesClientListBySubscriptionResponse] { @@ -358,7 +355,7 @@ func (client *VirtualMachineTemplatesClient) NewListBySubscriptionPager(options } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *VirtualMachineTemplatesClient) listBySubscriptionCreateRequest(ctx context.Context, options *VirtualMachineTemplatesClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *VirtualMachineTemplatesClient) listBySubscriptionCreateRequest(ctx context.Context, _ *VirtualMachineTemplatesClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/virtualMachineTemplates" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -369,7 +366,7 @@ func (client *VirtualMachineTemplatesClient) listBySubscriptionCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -387,7 +384,7 @@ func (client *VirtualMachineTemplatesClient) listBySubscriptionHandleResponse(re // BeginUpdate - Updates the VirtualMachineTemplate resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - virtualMachineTemplateName - Name of the VirtualMachineTemplate. // - properties - The resource properties to be updated. @@ -414,7 +411,7 @@ func (client *VirtualMachineTemplatesClient) BeginUpdate(ctx context.Context, re // Update - Updates the VirtualMachineTemplate resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 func (client *VirtualMachineTemplatesClient) update(ctx context.Context, resourceGroupName string, virtualMachineTemplateName string, properties VirtualMachineTemplateTagsUpdate, options *VirtualMachineTemplatesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualMachineTemplatesClient.BeginUpdate" @@ -437,7 +434,7 @@ func (client *VirtualMachineTemplatesClient) update(ctx context.Context, resourc } // updateCreateRequest creates the Update request. -func (client *VirtualMachineTemplatesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineTemplateName string, properties VirtualMachineTemplateTagsUpdate, options *VirtualMachineTemplatesClientBeginUpdateOptions) (*policy.Request, error) { +func (client *VirtualMachineTemplatesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, virtualMachineTemplateName string, properties VirtualMachineTemplateTagsUpdate, _ *VirtualMachineTemplatesClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualMachineTemplates/{virtualMachineTemplateName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -456,7 +453,7 @@ func (client *VirtualMachineTemplatesClient) updateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, properties); err != nil { diff --git a/sdk/resourcemanager/scvmm/armscvmm/virtualmachinetemplates_client_example_test.go b/sdk/resourcemanager/scvmm/armscvmm/virtualmachinetemplates_client_example_test.go deleted file mode 100644 index 0b71bb748b18..000000000000 --- a/sdk/resourcemanager/scvmm/armscvmm/virtualmachinetemplates_client_example_test.go +++ /dev/null @@ -1,739 +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 armscvmm_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/scvmm/armscvmm" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineTemplates_ListBySubscription_MaximumSet_Gen.json -func ExampleVirtualMachineTemplatesClient_NewListBySubscriptionPager_virtualMachineTemplatesListBySubscriptionMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineTemplatesClient().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.VirtualMachineTemplateListResult = armscvmm.VirtualMachineTemplateListResult{ - // Value: []*armscvmm.VirtualMachineTemplate{ - // { - // Name: to.Ptr("ioeuwaznkaayvhpqbnrwbr"), - // Type: to.Ptr("egfzqiscydkyddksvsjujdlee"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualMachineTemplates/virtualMachineTemplateName"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Location: to.Ptr("ayxsyduviotylbojh"), - // Tags: map[string]*string{ - // "key9494": to.Ptr("kkbmfpwhmvlobm"), - // }, - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - // Type: to.Ptr("customLocation"), - // }, - // Properties: &armscvmm.VirtualMachineTemplateProperties{ - // ComputerName: to.Ptr("asxghqngsojdsdptpirbz"), - // CPUCount: to.Ptr[int32](23), - // Disks: []*armscvmm.VirtualDisk{ - // { - // Name: to.Ptr("fgnckfymwdsqnfxkdvexuaobe"), - // Bus: to.Ptr[int32](8), - // BusType: to.Ptr("zu"), - // CreateDiffDisk: to.Ptr(armscvmm.CreateDiffDiskTrue), - // DiskID: to.Ptr("ltdrwcfjklpsimhzqyh"), - // DiskSizeGB: to.Ptr[int32](30), - // DisplayName: to.Ptr("fgladknawlgjodo"), - // Lun: to.Ptr[int32](10), - // MaxDiskSizeGB: to.Ptr[int32](18), - // StorageQosPolicy: &armscvmm.StorageQosPolicyDetails{ - // Name: to.Ptr("ceiyfrflu"), - // ID: to.Ptr("o"), - // }, - // TemplateDiskID: to.Ptr("lcdwrokpyvekqccclf"), - // VhdFormatType: to.Ptr("vbcrrmhgahznifudvhxfagwoplcb"), - // VhdType: to.Ptr("cnbeeeylrvopigdynvgpkfp"), - // VolumeType: to.Ptr("ckkymkuekzzqhexyjueruzlfemoeln"), - // }}, - // DynamicMemoryEnabled: to.Ptr(armscvmm.DynamicMemoryEnabledTrue), - // DynamicMemoryMaxMB: to.Ptr[int32](21), - // DynamicMemoryMinMB: to.Ptr[int32](21), - // Generation: to.Ptr[int32](16), - // InventoryItemID: to.Ptr("qjrykoogccwlgkd"), - // IsCustomizable: to.Ptr(armscvmm.IsCustomizableTrue), - // IsHighlyAvailable: to.Ptr(armscvmm.IsHighlyAvailableTrue), - // LimitCPUForMigration: to.Ptr(armscvmm.LimitCPUForMigrationTrue), - // MemoryMB: to.Ptr[int32](24), - // NetworkInterfaces: []*armscvmm.NetworkInterface{ - // { - // Name: to.Ptr("kvofzqulbjlbtt"), - // DisplayName: to.Ptr("yoayfd"), - // IPv4AddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - // IPv4Addresses: []*string{ - // to.Ptr("eeunirpkpqazzxhsqonkxcfuks")}, - // IPv6AddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - // IPv6Addresses: []*string{ - // to.Ptr("pk")}, - // MacAddress: to.Ptr("oaeqqegt"), - // MacAddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - // NetworkName: to.Ptr("lqbm"), - // NicID: to.Ptr("roxpsvlo"), - // VirtualNetworkID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualNetworks/virtualNetworkName"), - // }}, - // OSName: to.Ptr("qcbolnbisklo"), - // OSType: to.Ptr(armscvmm.OsTypeWindows), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // UUID: to.Ptr("12345678-1234-1234-1234-12345678abcd"), - // VmmServerID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineTemplates_ListBySubscription_MinimumSet_Gen.json -func ExampleVirtualMachineTemplatesClient_NewListBySubscriptionPager_virtualMachineTemplatesListBySubscriptionMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineTemplatesClient().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.VirtualMachineTemplateListResult = armscvmm.VirtualMachineTemplateListResult{ - // Value: []*armscvmm.VirtualMachineTemplate{ - // { - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualMachineTemplates/virtualMachineTemplateName"), - // Location: to.Ptr("ayxsyduviotylbojh"), - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineTemplates_ListByResourceGroup_MaximumSet_Gen.json -func ExampleVirtualMachineTemplatesClient_NewListByResourceGroupPager_virtualMachineTemplatesListByResourceGroupMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineTemplatesClient().NewListByResourceGroupPager("rgscvmm", 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.VirtualMachineTemplateListResult = armscvmm.VirtualMachineTemplateListResult{ - // Value: []*armscvmm.VirtualMachineTemplate{ - // { - // Name: to.Ptr("ioeuwaznkaayvhpqbnrwbr"), - // Type: to.Ptr("egfzqiscydkyddksvsjujdlee"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualMachineTemplates/virtualMachineTemplateName"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Location: to.Ptr("ayxsyduviotylbojh"), - // Tags: map[string]*string{ - // "key9494": to.Ptr("kkbmfpwhmvlobm"), - // }, - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - // Type: to.Ptr("customLocation"), - // }, - // Properties: &armscvmm.VirtualMachineTemplateProperties{ - // ComputerName: to.Ptr("asxghqngsojdsdptpirbz"), - // CPUCount: to.Ptr[int32](23), - // Disks: []*armscvmm.VirtualDisk{ - // { - // Name: to.Ptr("fgnckfymwdsqnfxkdvexuaobe"), - // Bus: to.Ptr[int32](8), - // BusType: to.Ptr("zu"), - // CreateDiffDisk: to.Ptr(armscvmm.CreateDiffDiskTrue), - // DiskID: to.Ptr("ltdrwcfjklpsimhzqyh"), - // DiskSizeGB: to.Ptr[int32](30), - // DisplayName: to.Ptr("fgladknawlgjodo"), - // Lun: to.Ptr[int32](10), - // MaxDiskSizeGB: to.Ptr[int32](18), - // StorageQosPolicy: &armscvmm.StorageQosPolicyDetails{ - // Name: to.Ptr("ceiyfrflu"), - // ID: to.Ptr("o"), - // }, - // TemplateDiskID: to.Ptr("lcdwrokpyvekqccclf"), - // VhdFormatType: to.Ptr("vbcrrmhgahznifudvhxfagwoplcb"), - // VhdType: to.Ptr("cnbeeeylrvopigdynvgpkfp"), - // VolumeType: to.Ptr("ckkymkuekzzqhexyjueruzlfemoeln"), - // }}, - // DynamicMemoryEnabled: to.Ptr(armscvmm.DynamicMemoryEnabledTrue), - // DynamicMemoryMaxMB: to.Ptr[int32](21), - // DynamicMemoryMinMB: to.Ptr[int32](21), - // Generation: to.Ptr[int32](16), - // InventoryItemID: to.Ptr("qjrykoogccwlgkd"), - // IsCustomizable: to.Ptr(armscvmm.IsCustomizableTrue), - // IsHighlyAvailable: to.Ptr(armscvmm.IsHighlyAvailableTrue), - // LimitCPUForMigration: to.Ptr(armscvmm.LimitCPUForMigrationTrue), - // MemoryMB: to.Ptr[int32](24), - // NetworkInterfaces: []*armscvmm.NetworkInterface{ - // { - // Name: to.Ptr("kvofzqulbjlbtt"), - // DisplayName: to.Ptr("yoayfd"), - // IPv4AddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - // IPv4Addresses: []*string{ - // to.Ptr("eeunirpkpqazzxhsqonkxcfuks")}, - // IPv6AddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - // IPv6Addresses: []*string{ - // to.Ptr("pk")}, - // MacAddress: to.Ptr("oaeqqegt"), - // MacAddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - // NetworkName: to.Ptr("lqbm"), - // NicID: to.Ptr("roxpsvlo"), - // VirtualNetworkID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualNetworks/virtualNetworkName"), - // }}, - // OSName: to.Ptr("qcbolnbisklo"), - // OSType: to.Ptr(armscvmm.OsTypeWindows), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // UUID: to.Ptr("12345678-1234-1234-1234-12345678abcd"), - // VmmServerID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineTemplates_ListByResourceGroup_MinimumSet_Gen.json -func ExampleVirtualMachineTemplatesClient_NewListByResourceGroupPager_virtualMachineTemplatesListByResourceGroupMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualMachineTemplatesClient().NewListByResourceGroupPager("rgscvmm", 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.VirtualMachineTemplateListResult = armscvmm.VirtualMachineTemplateListResult{ - // Value: []*armscvmm.VirtualMachineTemplate{ - // { - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualMachineTemplates/virtualMachineTemplateName"), - // Location: to.Ptr("ayxsyduviotylbojh"), - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineTemplates_Get_MaximumSet_Gen.json -func ExampleVirtualMachineTemplatesClient_Get_virtualMachineTemplatesGetMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineTemplatesClient().Get(ctx, "rgscvmm", "4", 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.VirtualMachineTemplate = armscvmm.VirtualMachineTemplate{ - // Name: to.Ptr("ioeuwaznkaayvhpqbnrwbr"), - // Type: to.Ptr("egfzqiscydkyddksvsjujdlee"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualMachineTemplates/virtualMachineTemplateName"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Location: to.Ptr("ayxsyduviotylbojh"), - // Tags: map[string]*string{ - // "key9494": to.Ptr("kkbmfpwhmvlobm"), - // }, - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - // Type: to.Ptr("customLocation"), - // }, - // Properties: &armscvmm.VirtualMachineTemplateProperties{ - // ComputerName: to.Ptr("asxghqngsojdsdptpirbz"), - // CPUCount: to.Ptr[int32](23), - // Disks: []*armscvmm.VirtualDisk{ - // { - // Name: to.Ptr("fgnckfymwdsqnfxkdvexuaobe"), - // Bus: to.Ptr[int32](8), - // BusType: to.Ptr("zu"), - // CreateDiffDisk: to.Ptr(armscvmm.CreateDiffDiskTrue), - // DiskID: to.Ptr("ltdrwcfjklpsimhzqyh"), - // DiskSizeGB: to.Ptr[int32](30), - // DisplayName: to.Ptr("fgladknawlgjodo"), - // Lun: to.Ptr[int32](10), - // MaxDiskSizeGB: to.Ptr[int32](18), - // StorageQosPolicy: &armscvmm.StorageQosPolicyDetails{ - // Name: to.Ptr("ceiyfrflu"), - // ID: to.Ptr("o"), - // }, - // TemplateDiskID: to.Ptr("lcdwrokpyvekqccclf"), - // VhdFormatType: to.Ptr("vbcrrmhgahznifudvhxfagwoplcb"), - // VhdType: to.Ptr("cnbeeeylrvopigdynvgpkfp"), - // VolumeType: to.Ptr("ckkymkuekzzqhexyjueruzlfemoeln"), - // }}, - // DynamicMemoryEnabled: to.Ptr(armscvmm.DynamicMemoryEnabledTrue), - // DynamicMemoryMaxMB: to.Ptr[int32](21), - // DynamicMemoryMinMB: to.Ptr[int32](21), - // Generation: to.Ptr[int32](16), - // InventoryItemID: to.Ptr("qjrykoogccwlgkd"), - // IsCustomizable: to.Ptr(armscvmm.IsCustomizableTrue), - // IsHighlyAvailable: to.Ptr(armscvmm.IsHighlyAvailableTrue), - // LimitCPUForMigration: to.Ptr(armscvmm.LimitCPUForMigrationTrue), - // MemoryMB: to.Ptr[int32](24), - // NetworkInterfaces: []*armscvmm.NetworkInterface{ - // { - // Name: to.Ptr("kvofzqulbjlbtt"), - // DisplayName: to.Ptr("yoayfd"), - // IPv4AddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - // IPv4Addresses: []*string{ - // to.Ptr("eeunirpkpqazzxhsqonkxcfuks")}, - // IPv6AddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - // IPv6Addresses: []*string{ - // to.Ptr("pk")}, - // MacAddress: to.Ptr("oaeqqegt"), - // MacAddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - // NetworkName: to.Ptr("lqbm"), - // NicID: to.Ptr("roxpsvlo"), - // VirtualNetworkID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualNetworks/virtualNetworkName"), - // }}, - // OSName: to.Ptr("qcbolnbisklo"), - // OSType: to.Ptr(armscvmm.OsTypeWindows), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // UUID: to.Ptr("12345678-1234-1234-1234-12345678abcd"), - // VmmServerID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineTemplates_Get_MinimumSet_Gen.json -func ExampleVirtualMachineTemplatesClient_Get_virtualMachineTemplatesGetMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualMachineTemplatesClient().Get(ctx, "rgscvmm", "m", 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.VirtualMachineTemplate = armscvmm.VirtualMachineTemplate{ - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualMachineTemplates/virtualMachineTemplateName"), - // Location: to.Ptr("ayxsyduviotylbojh"), - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineTemplates_CreateOrUpdate_MaximumSet_Gen.json -func ExampleVirtualMachineTemplatesClient_BeginCreateOrUpdate_virtualMachineTemplatesCreateOrUpdateMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineTemplatesClient().BeginCreateOrUpdate(ctx, "rgscvmm", "6", armscvmm.VirtualMachineTemplate{ - Location: to.Ptr("ayxsyduviotylbojh"), - Tags: map[string]*string{ - "key9494": to.Ptr("kkbmfpwhmvlobm"), - }, - ExtendedLocation: &armscvmm.ExtendedLocation{ - Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - Type: to.Ptr("customLocation"), - }, - Properties: &armscvmm.VirtualMachineTemplateProperties{ - DynamicMemoryEnabled: to.Ptr(armscvmm.DynamicMemoryEnabledTrue), - InventoryItemID: to.Ptr("qjrykoogccwlgkd"), - IsCustomizable: to.Ptr(armscvmm.IsCustomizableTrue), - IsHighlyAvailable: to.Ptr(armscvmm.IsHighlyAvailableTrue), - LimitCPUForMigration: to.Ptr(armscvmm.LimitCPUForMigrationTrue), - OSType: to.Ptr(armscvmm.OsTypeWindows), - UUID: to.Ptr("12345678-1234-1234-1234-12345678abcd"), - VmmServerID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - }, - }, 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.VirtualMachineTemplate = armscvmm.VirtualMachineTemplate{ - // Name: to.Ptr("ioeuwaznkaayvhpqbnrwbr"), - // Type: to.Ptr("egfzqiscydkyddksvsjujdlee"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualMachineTemplates/virtualMachineTemplateName"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Location: to.Ptr("ayxsyduviotylbojh"), - // Tags: map[string]*string{ - // "key9494": to.Ptr("kkbmfpwhmvlobm"), - // }, - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - // Type: to.Ptr("customLocation"), - // }, - // Properties: &armscvmm.VirtualMachineTemplateProperties{ - // ComputerName: to.Ptr("asxghqngsojdsdptpirbz"), - // CPUCount: to.Ptr[int32](23), - // Disks: []*armscvmm.VirtualDisk{ - // { - // Name: to.Ptr("fgnckfymwdsqnfxkdvexuaobe"), - // Bus: to.Ptr[int32](8), - // BusType: to.Ptr("zu"), - // CreateDiffDisk: to.Ptr(armscvmm.CreateDiffDiskTrue), - // DiskID: to.Ptr("ltdrwcfjklpsimhzqyh"), - // DiskSizeGB: to.Ptr[int32](30), - // DisplayName: to.Ptr("fgladknawlgjodo"), - // Lun: to.Ptr[int32](10), - // MaxDiskSizeGB: to.Ptr[int32](18), - // StorageQosPolicy: &armscvmm.StorageQosPolicyDetails{ - // Name: to.Ptr("ceiyfrflu"), - // ID: to.Ptr("o"), - // }, - // TemplateDiskID: to.Ptr("lcdwrokpyvekqccclf"), - // VhdFormatType: to.Ptr("vbcrrmhgahznifudvhxfagwoplcb"), - // VhdType: to.Ptr("cnbeeeylrvopigdynvgpkfp"), - // VolumeType: to.Ptr("ckkymkuekzzqhexyjueruzlfemoeln"), - // }}, - // DynamicMemoryEnabled: to.Ptr(armscvmm.DynamicMemoryEnabledTrue), - // DynamicMemoryMaxMB: to.Ptr[int32](21), - // DynamicMemoryMinMB: to.Ptr[int32](21), - // Generation: to.Ptr[int32](16), - // InventoryItemID: to.Ptr("qjrykoogccwlgkd"), - // IsCustomizable: to.Ptr(armscvmm.IsCustomizableTrue), - // IsHighlyAvailable: to.Ptr(armscvmm.IsHighlyAvailableTrue), - // LimitCPUForMigration: to.Ptr(armscvmm.LimitCPUForMigrationTrue), - // MemoryMB: to.Ptr[int32](24), - // NetworkInterfaces: []*armscvmm.NetworkInterface{ - // { - // Name: to.Ptr("kvofzqulbjlbtt"), - // DisplayName: to.Ptr("yoayfd"), - // IPv4AddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - // IPv4Addresses: []*string{ - // to.Ptr("eeunirpkpqazzxhsqonkxcfuks")}, - // IPv6AddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - // IPv6Addresses: []*string{ - // to.Ptr("pk")}, - // MacAddress: to.Ptr("oaeqqegt"), - // MacAddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - // NetworkName: to.Ptr("lqbm"), - // NicID: to.Ptr("roxpsvlo"), - // VirtualNetworkID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualNetworks/virtualNetworkName"), - // }}, - // OSName: to.Ptr("qcbolnbisklo"), - // OSType: to.Ptr(armscvmm.OsTypeWindows), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // UUID: to.Ptr("12345678-1234-1234-1234-12345678abcd"), - // VmmServerID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineTemplates_CreateOrUpdate_MinimumSet_Gen.json -func ExampleVirtualMachineTemplatesClient_BeginCreateOrUpdate_virtualMachineTemplatesCreateOrUpdateMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineTemplatesClient().BeginCreateOrUpdate(ctx, "rgscvmm", "P", armscvmm.VirtualMachineTemplate{ - Location: to.Ptr("ayxsyduviotylbojh"), - ExtendedLocation: &armscvmm.ExtendedLocation{}, - }, 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.VirtualMachineTemplate = armscvmm.VirtualMachineTemplate{ - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualMachineTemplates/virtualMachineTemplateName"), - // Location: to.Ptr("ayxsyduviotylbojh"), - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineTemplates_Update_MaximumSet_Gen.json -func ExampleVirtualMachineTemplatesClient_BeginUpdate_virtualMachineTemplatesUpdateMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineTemplatesClient().BeginUpdate(ctx, "rgscvmm", "g", armscvmm.VirtualMachineTemplateTagsUpdate{ - Tags: map[string]*string{ - "key6634": to.Ptr("wwfhrg"), - }, - }, 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.VirtualMachineTemplate = armscvmm.VirtualMachineTemplate{ - // Name: to.Ptr("ioeuwaznkaayvhpqbnrwbr"), - // Type: to.Ptr("egfzqiscydkyddksvsjujdlee"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualMachineTemplates/virtualMachineTemplateName"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Location: to.Ptr("ayxsyduviotylbojh"), - // Tags: map[string]*string{ - // "key9494": to.Ptr("kkbmfpwhmvlobm"), - // }, - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - // Type: to.Ptr("customLocation"), - // }, - // Properties: &armscvmm.VirtualMachineTemplateProperties{ - // ComputerName: to.Ptr("asxghqngsojdsdptpirbz"), - // CPUCount: to.Ptr[int32](23), - // Disks: []*armscvmm.VirtualDisk{ - // { - // Name: to.Ptr("fgnckfymwdsqnfxkdvexuaobe"), - // Bus: to.Ptr[int32](8), - // BusType: to.Ptr("zu"), - // CreateDiffDisk: to.Ptr(armscvmm.CreateDiffDiskTrue), - // DiskID: to.Ptr("ltdrwcfjklpsimhzqyh"), - // DiskSizeGB: to.Ptr[int32](30), - // DisplayName: to.Ptr("fgladknawlgjodo"), - // Lun: to.Ptr[int32](10), - // MaxDiskSizeGB: to.Ptr[int32](18), - // StorageQosPolicy: &armscvmm.StorageQosPolicyDetails{ - // Name: to.Ptr("ceiyfrflu"), - // ID: to.Ptr("o"), - // }, - // TemplateDiskID: to.Ptr("lcdwrokpyvekqccclf"), - // VhdFormatType: to.Ptr("vbcrrmhgahznifudvhxfagwoplcb"), - // VhdType: to.Ptr("cnbeeeylrvopigdynvgpkfp"), - // VolumeType: to.Ptr("ckkymkuekzzqhexyjueruzlfemoeln"), - // }}, - // DynamicMemoryEnabled: to.Ptr(armscvmm.DynamicMemoryEnabledTrue), - // DynamicMemoryMaxMB: to.Ptr[int32](21), - // DynamicMemoryMinMB: to.Ptr[int32](21), - // Generation: to.Ptr[int32](16), - // InventoryItemID: to.Ptr("qjrykoogccwlgkd"), - // IsCustomizable: to.Ptr(armscvmm.IsCustomizableTrue), - // IsHighlyAvailable: to.Ptr(armscvmm.IsHighlyAvailableTrue), - // LimitCPUForMigration: to.Ptr(armscvmm.LimitCPUForMigrationTrue), - // MemoryMB: to.Ptr[int32](24), - // NetworkInterfaces: []*armscvmm.NetworkInterface{ - // { - // Name: to.Ptr("kvofzqulbjlbtt"), - // DisplayName: to.Ptr("yoayfd"), - // IPv4AddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - // IPv4Addresses: []*string{ - // to.Ptr("eeunirpkpqazzxhsqonkxcfuks")}, - // IPv6AddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - // IPv6Addresses: []*string{ - // to.Ptr("pk")}, - // MacAddress: to.Ptr("oaeqqegt"), - // MacAddressType: to.Ptr(armscvmm.AllocationMethodDynamic), - // NetworkName: to.Ptr("lqbm"), - // NicID: to.Ptr("roxpsvlo"), - // VirtualNetworkID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualNetworks/virtualNetworkName"), - // }}, - // OSName: to.Ptr("qcbolnbisklo"), - // OSType: to.Ptr(armscvmm.OsTypeWindows), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // UUID: to.Ptr("12345678-1234-1234-1234-12345678abcd"), - // VmmServerID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineTemplates_Update_MinimumSet_Gen.json -func ExampleVirtualMachineTemplatesClient_BeginUpdate_virtualMachineTemplatesUpdateMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineTemplatesClient().BeginUpdate(ctx, "rgscvmm", "-", armscvmm.VirtualMachineTemplateTagsUpdate{}, 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.VirtualMachineTemplate = armscvmm.VirtualMachineTemplate{ - // Location: to.Ptr("ayxsyduviotylbojh"), - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineTemplates_Delete_MaximumSet_Gen.json -func ExampleVirtualMachineTemplatesClient_BeginDelete_virtualMachineTemplatesDeleteMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineTemplatesClient().BeginDelete(ctx, "rgscvmm", "6", &armscvmm.VirtualMachineTemplatesClientBeginDeleteOptions{Force: to.Ptr(armscvmm.ForceDeleteTrue)}) - 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/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualMachineTemplates_Delete_MinimumSet_Gen.json -func ExampleVirtualMachineTemplatesClient_BeginDelete_virtualMachineTemplatesDeleteMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualMachineTemplatesClient().BeginDelete(ctx, "rgscvmm", "5", &armscvmm.VirtualMachineTemplatesClientBeginDeleteOptions{Force: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/scvmm/armscvmm/virtualnetworks_client.go b/sdk/resourcemanager/scvmm/armscvmm/virtualnetworks_client.go index c3ee98db816a..2bb03eb306a3 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/virtualnetworks_client.go +++ b/sdk/resourcemanager/scvmm/armscvmm/virtualnetworks_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. @@ -46,7 +43,7 @@ func NewVirtualNetworksClient(subscriptionID string, credential azcore.TokenCred // BeginCreateOrUpdate - Onboards the ScVmm virtual network as an Azure virtual network resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - virtualNetworkName - Name of the VirtualNetwork. // - resource - Resource create parameters. @@ -73,7 +70,7 @@ func (client *VirtualNetworksClient) BeginCreateOrUpdate(ctx context.Context, re // CreateOrUpdate - Onboards the ScVmm virtual network as an Azure virtual network resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 func (client *VirtualNetworksClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualNetworkName string, resource VirtualNetwork, options *VirtualNetworksClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualNetworksClient.BeginCreateOrUpdate" @@ -96,7 +93,7 @@ func (client *VirtualNetworksClient) createOrUpdate(ctx context.Context, resourc } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *VirtualNetworksClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, resource VirtualNetwork, options *VirtualNetworksClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *VirtualNetworksClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, resource VirtualNetwork, _ *VirtualNetworksClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualNetworks/{virtualNetworkName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -115,7 +112,7 @@ func (client *VirtualNetworksClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -127,7 +124,7 @@ func (client *VirtualNetworksClient) createOrUpdateCreateRequest(ctx context.Con // BeginDelete - Deregisters the ScVmm virtual network from Azure. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - virtualNetworkName - Name of the VirtualNetwork. // - options - VirtualNetworksClientBeginDeleteOptions contains the optional parameters for the VirtualNetworksClient.BeginDelete @@ -153,7 +150,7 @@ func (client *VirtualNetworksClient) BeginDelete(ctx context.Context, resourceGr // Delete - Deregisters the ScVmm virtual network from Azure. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 func (client *VirtualNetworksClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "VirtualNetworksClient.BeginDelete" @@ -195,7 +192,7 @@ func (client *VirtualNetworksClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") if options != nil && options.Force != nil { reqQP.Set("force", string(*options.Force)) } @@ -207,7 +204,7 @@ func (client *VirtualNetworksClient) deleteCreateRequest(ctx context.Context, re // Get - Implements VirtualNetwork GET method. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - virtualNetworkName - Name of the VirtualNetwork. // - options - VirtualNetworksClientGetOptions contains the optional parameters for the VirtualNetworksClient.Get method. @@ -234,7 +231,7 @@ func (client *VirtualNetworksClient) Get(ctx context.Context, resourceGroupName } // getCreateRequest creates the Get request. -func (client *VirtualNetworksClient) getCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, options *VirtualNetworksClientGetOptions) (*policy.Request, error) { +func (client *VirtualNetworksClient) getCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, _ *VirtualNetworksClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualNetworks/{virtualNetworkName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -253,7 +250,7 @@ func (client *VirtualNetworksClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -270,7 +267,7 @@ func (client *VirtualNetworksClient) getHandleResponse(resp *http.Response) (Vir // NewListByResourceGroupPager - List of VirtualNetworks in a resource group. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - VirtualNetworksClientListByResourceGroupOptions contains the optional parameters for the VirtualNetworksClient.NewListByResourceGroupPager // method. @@ -298,7 +295,7 @@ func (client *VirtualNetworksClient) NewListByResourceGroupPager(resourceGroupNa } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *VirtualNetworksClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *VirtualNetworksClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *VirtualNetworksClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *VirtualNetworksClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualNetworks" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -313,7 +310,7 @@ func (client *VirtualNetworksClient) listByResourceGroupCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -330,7 +327,7 @@ func (client *VirtualNetworksClient) listByResourceGroupHandleResponse(resp *htt // NewListBySubscriptionPager - List of VirtualNetworks in a subscription. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - options - VirtualNetworksClientListBySubscriptionOptions contains the optional parameters for the VirtualNetworksClient.NewListBySubscriptionPager // method. func (client *VirtualNetworksClient) NewListBySubscriptionPager(options *VirtualNetworksClientListBySubscriptionOptions) *runtime.Pager[VirtualNetworksClientListBySubscriptionResponse] { @@ -357,7 +354,7 @@ func (client *VirtualNetworksClient) NewListBySubscriptionPager(options *Virtual } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *VirtualNetworksClient) listBySubscriptionCreateRequest(ctx context.Context, options *VirtualNetworksClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *VirtualNetworksClient) listBySubscriptionCreateRequest(ctx context.Context, _ *VirtualNetworksClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/virtualNetworks" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -368,7 +365,7 @@ func (client *VirtualNetworksClient) listBySubscriptionCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -386,7 +383,7 @@ func (client *VirtualNetworksClient) listBySubscriptionHandleResponse(resp *http // BeginUpdate - Updates the VirtualNetworks resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - virtualNetworkName - Name of the VirtualNetwork. // - properties - The resource properties to be updated. @@ -413,7 +410,7 @@ func (client *VirtualNetworksClient) BeginUpdate(ctx context.Context, resourceGr // Update - Updates the VirtualNetworks resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 func (client *VirtualNetworksClient) update(ctx context.Context, resourceGroupName string, virtualNetworkName string, properties VirtualNetworkTagsUpdate, options *VirtualNetworksClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualNetworksClient.BeginUpdate" @@ -436,7 +433,7 @@ func (client *VirtualNetworksClient) update(ctx context.Context, resourceGroupNa } // updateCreateRequest creates the Update request. -func (client *VirtualNetworksClient) updateCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, properties VirtualNetworkTagsUpdate, options *VirtualNetworksClientBeginUpdateOptions) (*policy.Request, error) { +func (client *VirtualNetworksClient) updateCreateRequest(ctx context.Context, resourceGroupName string, virtualNetworkName string, properties VirtualNetworkTagsUpdate, _ *VirtualNetworksClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/virtualNetworks/{virtualNetworkName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -455,7 +452,7 @@ func (client *VirtualNetworksClient) updateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, properties); err != nil { diff --git a/sdk/resourcemanager/scvmm/armscvmm/virtualnetworks_client_example_test.go b/sdk/resourcemanager/scvmm/armscvmm/virtualnetworks_client_example_test.go deleted file mode 100644 index 48165b958265..000000000000 --- a/sdk/resourcemanager/scvmm/armscvmm/virtualnetworks_client_example_test.go +++ /dev/null @@ -1,500 +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 armscvmm_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/scvmm/armscvmm" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualNetworks_ListBySubscription_MaximumSet_Gen.json -func ExampleVirtualNetworksClient_NewListBySubscriptionPager_virtualNetworksListBySubscriptionMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualNetworksClient().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.VirtualNetworkListResult = armscvmm.VirtualNetworkListResult{ - // Value: []*armscvmm.VirtualNetwork{ - // { - // Name: to.Ptr("sbeiflgxwzkgt"), - // Type: to.Ptr("oinkkqcuemmcvugnhebckmxeluuulw"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualNetworks/virtualNetworkName"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Location: to.Ptr("fky"), - // Tags: map[string]*string{ - // "key705": to.Ptr("apgplvjdyocx"), - // }, - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - // Type: to.Ptr("customLocation"), - // }, - // Properties: &armscvmm.VirtualNetworkProperties{ - // InventoryItemID: to.Ptr("bxn"), - // NetworkName: to.Ptr("eeqahvnbblsdeeqezqdinggretyeg"), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // UUID: to.Ptr("12345678-1234-1234-1234-12345678abcd"), - // VmmServerID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualNetworks_ListBySubscription_MinimumSet_Gen.json -func ExampleVirtualNetworksClient_NewListBySubscriptionPager_virtualNetworksListBySubscriptionMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualNetworksClient().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.VirtualNetworkListResult = armscvmm.VirtualNetworkListResult{ - // Value: []*armscvmm.VirtualNetwork{ - // { - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualNetworks/virtualNetworkName"), - // Location: to.Ptr("fky"), - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualNetworks_ListByResourceGroup_MaximumSet_Gen.json -func ExampleVirtualNetworksClient_NewListByResourceGroupPager_virtualNetworksListByResourceGroupMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualNetworksClient().NewListByResourceGroupPager("rgscvmm", 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.VirtualNetworkListResult = armscvmm.VirtualNetworkListResult{ - // Value: []*armscvmm.VirtualNetwork{ - // { - // Name: to.Ptr("sbeiflgxwzkgt"), - // Type: to.Ptr("oinkkqcuemmcvugnhebckmxeluuulw"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualNetworks/virtualNetworkName"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Location: to.Ptr("fky"), - // Tags: map[string]*string{ - // "key705": to.Ptr("apgplvjdyocx"), - // }, - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - // Type: to.Ptr("customLocation"), - // }, - // Properties: &armscvmm.VirtualNetworkProperties{ - // InventoryItemID: to.Ptr("bxn"), - // NetworkName: to.Ptr("eeqahvnbblsdeeqezqdinggretyeg"), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // UUID: to.Ptr("12345678-1234-1234-1234-12345678abcd"), - // VmmServerID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualNetworks_ListByResourceGroup_MinimumSet_Gen.json -func ExampleVirtualNetworksClient_NewListByResourceGroupPager_virtualNetworksListByResourceGroupMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualNetworksClient().NewListByResourceGroupPager("rgscvmm", 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.VirtualNetworkListResult = armscvmm.VirtualNetworkListResult{ - // Value: []*armscvmm.VirtualNetwork{ - // { - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualNetworks/virtualNetworkName"), - // Location: to.Ptr("fky"), - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualNetworks_Get_MaximumSet_Gen.json -func ExampleVirtualNetworksClient_Get_virtualNetworksGetMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualNetworksClient().Get(ctx, "rgscvmm", "2", 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.VirtualNetwork = armscvmm.VirtualNetwork{ - // Name: to.Ptr("sbeiflgxwzkgt"), - // Type: to.Ptr("oinkkqcuemmcvugnhebckmxeluuulw"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualNetworks/virtualNetworkName"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Location: to.Ptr("fky"), - // Tags: map[string]*string{ - // "key705": to.Ptr("apgplvjdyocx"), - // }, - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - // Type: to.Ptr("customLocation"), - // }, - // Properties: &armscvmm.VirtualNetworkProperties{ - // InventoryItemID: to.Ptr("bxn"), - // NetworkName: to.Ptr("eeqahvnbblsdeeqezqdinggretyeg"), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // UUID: to.Ptr("12345678-1234-1234-1234-12345678abcd"), - // VmmServerID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualNetworks_Get_MinimumSet_Gen.json -func ExampleVirtualNetworksClient_Get_virtualNetworksGetMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualNetworksClient().Get(ctx, "rgscvmm", "-", 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.VirtualNetwork = armscvmm.VirtualNetwork{ - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualNetworks/virtualNetworkName"), - // Location: to.Ptr("fky"), - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualNetworks_CreateOrUpdate_MaximumSet_Gen.json -func ExampleVirtualNetworksClient_BeginCreateOrUpdate_virtualNetworksCreateOrUpdateMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworksClient().BeginCreateOrUpdate(ctx, "rgscvmm", "_", armscvmm.VirtualNetwork{ - Location: to.Ptr("fky"), - Tags: map[string]*string{ - "key705": to.Ptr("apgplvjdyocx"), - }, - ExtendedLocation: &armscvmm.ExtendedLocation{ - Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - Type: to.Ptr("customLocation"), - }, - Properties: &armscvmm.VirtualNetworkProperties{ - InventoryItemID: to.Ptr("bxn"), - UUID: to.Ptr("12345678-1234-1234-1234-12345678abcd"), - VmmServerID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - }, - }, 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.VirtualNetwork = armscvmm.VirtualNetwork{ - // Name: to.Ptr("sbeiflgxwzkgt"), - // Type: to.Ptr("oinkkqcuemmcvugnhebckmxeluuulw"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualNetworks/virtualNetworkName"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Location: to.Ptr("fky"), - // Tags: map[string]*string{ - // "key705": to.Ptr("apgplvjdyocx"), - // }, - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - // Type: to.Ptr("customLocation"), - // }, - // Properties: &armscvmm.VirtualNetworkProperties{ - // InventoryItemID: to.Ptr("bxn"), - // NetworkName: to.Ptr("eeqahvnbblsdeeqezqdinggretyeg"), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // UUID: to.Ptr("12345678-1234-1234-1234-12345678abcd"), - // VmmServerID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualNetworks_CreateOrUpdate_MinimumSet_Gen.json -func ExampleVirtualNetworksClient_BeginCreateOrUpdate_virtualNetworksCreateOrUpdateMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworksClient().BeginCreateOrUpdate(ctx, "rgscvmm", "-", armscvmm.VirtualNetwork{ - Location: to.Ptr("fky"), - ExtendedLocation: &armscvmm.ExtendedLocation{}, - }, 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.VirtualNetwork = armscvmm.VirtualNetwork{ - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualNetworks/virtualNetworkName"), - // Location: to.Ptr("fky"), - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualNetworks_Update_MaximumSet_Gen.json -func ExampleVirtualNetworksClient_BeginUpdate_virtualNetworksUpdateMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworksClient().BeginUpdate(ctx, "rgscvmm", "S", armscvmm.VirtualNetworkTagsUpdate{ - Tags: map[string]*string{ - "key9516": to.Ptr("oxduo"), - }, - }, 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.VirtualNetwork = armscvmm.VirtualNetwork{ - // Name: to.Ptr("sbeiflgxwzkgt"), - // Type: to.Ptr("oinkkqcuemmcvugnhebckmxeluuulw"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualNetworks/virtualNetworkName"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Location: to.Ptr("fky"), - // Tags: map[string]*string{ - // "key705": to.Ptr("apgplvjdyocx"), - // }, - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - // Type: to.Ptr("customLocation"), - // }, - // Properties: &armscvmm.VirtualNetworkProperties{ - // InventoryItemID: to.Ptr("bxn"), - // NetworkName: to.Ptr("eeqahvnbblsdeeqezqdinggretyeg"), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // UUID: to.Ptr("12345678-1234-1234-1234-12345678abcd"), - // VmmServerID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualNetworks_Update_MinimumSet_Gen.json -func ExampleVirtualNetworksClient_BeginUpdate_virtualNetworksUpdateMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworksClient().BeginUpdate(ctx, "rgscvmm", "-", armscvmm.VirtualNetworkTagsUpdate{}, 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.VirtualNetwork = armscvmm.VirtualNetwork{ - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualNetworks/virtualNetworkName"), - // Location: to.Ptr("fky"), - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualNetworks_Delete_MaximumSet_Gen.json -func ExampleVirtualNetworksClient_BeginDelete_virtualNetworksDeleteMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworksClient().BeginDelete(ctx, "rgscvmm", ".", &armscvmm.VirtualNetworksClientBeginDeleteOptions{Force: to.Ptr(armscvmm.ForceDeleteTrue)}) - 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/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VirtualNetworks_Delete_MinimumSet_Gen.json -func ExampleVirtualNetworksClient_BeginDelete_virtualNetworksDeleteMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworksClient().BeginDelete(ctx, "rgscvmm", "1", &armscvmm.VirtualNetworksClientBeginDeleteOptions{Force: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/scvmm/armscvmm/vminstancehybrididentitymetadatas_client.go b/sdk/resourcemanager/scvmm/armscvmm/vminstancehybrididentitymetadatas_client.go index e47d239a05b4..759e8192a612 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/vminstancehybrididentitymetadatas_client.go +++ b/sdk/resourcemanager/scvmm/armscvmm/vminstancehybrididentitymetadatas_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. @@ -41,7 +38,7 @@ func NewVMInstanceHybridIdentityMetadatasClient(credential azcore.TokenCredentia // Get - Implements HybridIdentityMetadata GET method. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceURI - The fully qualified Azure Resource manager identifier of the resource. // - options - VMInstanceHybridIdentityMetadatasClientGetOptions contains the optional parameters for the VMInstanceHybridIdentityMetadatasClient.Get // method. @@ -68,7 +65,7 @@ func (client *VMInstanceHybridIdentityMetadatasClient) Get(ctx context.Context, } // getCreateRequest creates the Get request. -func (client *VMInstanceHybridIdentityMetadatasClient) getCreateRequest(ctx context.Context, resourceURI string, options *VMInstanceHybridIdentityMetadatasClientGetOptions) (*policy.Request, error) { +func (client *VMInstanceHybridIdentityMetadatasClient) getCreateRequest(ctx context.Context, resourceURI string, _ *VMInstanceHybridIdentityMetadatasClientGetOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/hybridIdentityMetadata/default" urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -76,7 +73,7 @@ func (client *VMInstanceHybridIdentityMetadatasClient) getCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -93,7 +90,7 @@ func (client *VMInstanceHybridIdentityMetadatasClient) getHandleResponse(resp *h // NewListByVirtualMachineInstancePager - Returns the list of HybridIdentityMetadata of the given VM. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceURI - The fully qualified Azure Resource manager identifier of the resource. // - options - VMInstanceHybridIdentityMetadatasClientListByVirtualMachineInstanceOptions contains the optional parameters for // the VMInstanceHybridIdentityMetadatasClient.NewListByVirtualMachineInstancePager method. @@ -121,7 +118,7 @@ func (client *VMInstanceHybridIdentityMetadatasClient) NewListByVirtualMachineIn } // listByVirtualMachineInstanceCreateRequest creates the ListByVirtualMachineInstance request. -func (client *VMInstanceHybridIdentityMetadatasClient) listByVirtualMachineInstanceCreateRequest(ctx context.Context, resourceURI string, options *VMInstanceHybridIdentityMetadatasClientListByVirtualMachineInstanceOptions) (*policy.Request, error) { +func (client *VMInstanceHybridIdentityMetadatasClient) listByVirtualMachineInstanceCreateRequest(ctx context.Context, resourceURI string, _ *VMInstanceHybridIdentityMetadatasClientListByVirtualMachineInstanceOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.ScVmm/virtualMachineInstances/default/hybridIdentityMetadata" urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -129,7 +126,7 @@ func (client *VMInstanceHybridIdentityMetadatasClient) listByVirtualMachineInsta return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/scvmm/armscvmm/vminstancehybrididentitymetadatas_client_example_test.go b/sdk/resourcemanager/scvmm/armscvmm/vminstancehybrididentitymetadatas_client_example_test.go deleted file mode 100644 index 28cdf105c571..000000000000 --- a/sdk/resourcemanager/scvmm/armscvmm/vminstancehybrididentitymetadatas_client_example_test.go +++ /dev/null @@ -1,156 +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 armscvmm_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/scvmm/armscvmm" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmInstanceHybridIdentityMetadatas_ListByVirtualMachineInstance_MaximumSet_Gen.json -func ExampleVMInstanceHybridIdentityMetadatasClient_NewListByVirtualMachineInstancePager_vmInstanceHybridIdentityMetadatasListByVirtualMachineInstanceMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVMInstanceHybridIdentityMetadatasClient().NewListByVirtualMachineInstancePager("gtgclehcbsyave", 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.VMInstanceHybridIdentityMetadataListResult = armscvmm.VMInstanceHybridIdentityMetadataListResult{ - // Value: []*armscvmm.VMInstanceHybridIdentityMetadata{ - // { - // Name: to.Ptr("rxvpcegqc"), - // Type: to.Ptr("ixqhymswessvylnqgti"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualMachineInstances/default/hybridIdentityMetadata/default"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Properties: &armscvmm.VMInstanceHybridIdentityMetadataProperties{ - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // PublicKey: to.Ptr("hijhfxcdjuzidfjjztoh"), - // ResourceUID: to.Ptr("mikbntobifeiouinvsalnu"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmInstanceHybridIdentityMetadatas_ListByVirtualMachineInstance_MinimumSet_Gen.json -func ExampleVMInstanceHybridIdentityMetadatasClient_NewListByVirtualMachineInstancePager_vmInstanceHybridIdentityMetadatasListByVirtualMachineInstanceMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVMInstanceHybridIdentityMetadatasClient().NewListByVirtualMachineInstancePager("gtgclehcbsyave", 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.VMInstanceHybridIdentityMetadataListResult = armscvmm.VMInstanceHybridIdentityMetadataListResult{ - // Value: []*armscvmm.VMInstanceHybridIdentityMetadata{ - // { - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualMachineInstances/default/hybridIdentityMetadata/default"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmInstanceHybridIdentityMetadatas_Get_MaximumSet_Gen.json -func ExampleVMInstanceHybridIdentityMetadatasClient_Get_vmInstanceHybridIdentityMetadatasGetMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVMInstanceHybridIdentityMetadatasClient().Get(ctx, "gtgclehcbsyave", 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.VMInstanceHybridIdentityMetadata = armscvmm.VMInstanceHybridIdentityMetadata{ - // Name: to.Ptr("rxvpcegqc"), - // Type: to.Ptr("ixqhymswessvylnqgti"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualMachineInstances/default/hybridIdentityMetadata/default"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Properties: &armscvmm.VMInstanceHybridIdentityMetadataProperties{ - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // PublicKey: to.Ptr("hijhfxcdjuzidfjjztoh"), - // ResourceUID: to.Ptr("mikbntobifeiouinvsalnu"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmInstanceHybridIdentityMetadatas_Get_MinimumSet_Gen.json -func ExampleVMInstanceHybridIdentityMetadatasClient_Get_vmInstanceHybridIdentityMetadatasGetMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVMInstanceHybridIdentityMetadatasClient().Get(ctx, "gtgclehcbsyave", 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.VMInstanceHybridIdentityMetadata = armscvmm.VMInstanceHybridIdentityMetadata{ - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/virtualMachineInstances/default/hybridIdentityMetadata/default"), - // } -} diff --git a/sdk/resourcemanager/scvmm/armscvmm/vmmservers_client.go b/sdk/resourcemanager/scvmm/armscvmm/vmmservers_client.go index 13f2dad140c1..6f093e4be167 100644 --- a/sdk/resourcemanager/scvmm/armscvmm/vmmservers_client.go +++ b/sdk/resourcemanager/scvmm/armscvmm/vmmservers_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. @@ -46,7 +43,7 @@ func NewVmmServersClient(subscriptionID string, credential azcore.TokenCredentia // BeginCreateOrUpdate - Onboards the SCVmm fabric as an Azure VmmServer resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vmmServerName - Name of the VmmServer. // - resource - Resource create parameters. @@ -73,7 +70,7 @@ func (client *VmmServersClient) BeginCreateOrUpdate(ctx context.Context, resourc // CreateOrUpdate - Onboards the SCVmm fabric as an Azure VmmServer resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 func (client *VmmServersClient) createOrUpdate(ctx context.Context, resourceGroupName string, vmmServerName string, resource VmmServer, options *VmmServersClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "VmmServersClient.BeginCreateOrUpdate" @@ -96,7 +93,7 @@ func (client *VmmServersClient) createOrUpdate(ctx context.Context, resourceGrou } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *VmmServersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vmmServerName string, resource VmmServer, options *VmmServersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *VmmServersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, vmmServerName string, resource VmmServer, _ *VmmServersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -115,7 +112,7 @@ func (client *VmmServersClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { @@ -127,7 +124,7 @@ func (client *VmmServersClient) createOrUpdateCreateRequest(ctx context.Context, // BeginDelete - Removes the SCVmm fabric from Azure. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vmmServerName - Name of the VmmServer. // - options - VmmServersClientBeginDeleteOptions contains the optional parameters for the VmmServersClient.BeginDelete method. @@ -152,7 +149,7 @@ func (client *VmmServersClient) BeginDelete(ctx context.Context, resourceGroupNa // Delete - Removes the SCVmm fabric from Azure. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 func (client *VmmServersClient) deleteOperation(ctx context.Context, resourceGroupName string, vmmServerName string, options *VmmServersClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "VmmServersClient.BeginDelete" @@ -194,7 +191,7 @@ func (client *VmmServersClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") if options != nil && options.Force != nil { reqQP.Set("force", string(*options.Force)) } @@ -206,7 +203,7 @@ func (client *VmmServersClient) deleteCreateRequest(ctx context.Context, resourc // Get - Implements VmmServer GET method. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vmmServerName - Name of the VmmServer. // - options - VmmServersClientGetOptions contains the optional parameters for the VmmServersClient.Get method. @@ -233,7 +230,7 @@ func (client *VmmServersClient) Get(ctx context.Context, resourceGroupName strin } // getCreateRequest creates the Get request. -func (client *VmmServersClient) getCreateRequest(ctx context.Context, resourceGroupName string, vmmServerName string, options *VmmServersClientGetOptions) (*policy.Request, error) { +func (client *VmmServersClient) getCreateRequest(ctx context.Context, resourceGroupName string, vmmServerName string, _ *VmmServersClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -252,7 +249,7 @@ func (client *VmmServersClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -269,7 +266,7 @@ func (client *VmmServersClient) getHandleResponse(resp *http.Response) (VmmServe // NewListByResourceGroupPager - List of VmmServers in a resource group. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - VmmServersClientListByResourceGroupOptions contains the optional parameters for the VmmServersClient.NewListByResourceGroupPager // method. @@ -297,7 +294,7 @@ func (client *VmmServersClient) NewListByResourceGroupPager(resourceGroupName st } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *VmmServersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *VmmServersClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *VmmServersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *VmmServersClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -312,7 +309,7 @@ func (client *VmmServersClient) listByResourceGroupCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -329,7 +326,7 @@ func (client *VmmServersClient) listByResourceGroupHandleResponse(resp *http.Res // NewListBySubscriptionPager - List of VmmServers in a subscription. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - options - VmmServersClientListBySubscriptionOptions contains the optional parameters for the VmmServersClient.NewListBySubscriptionPager // method. func (client *VmmServersClient) NewListBySubscriptionPager(options *VmmServersClientListBySubscriptionOptions) *runtime.Pager[VmmServersClientListBySubscriptionResponse] { @@ -356,7 +353,7 @@ func (client *VmmServersClient) NewListBySubscriptionPager(options *VmmServersCl } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *VmmServersClient) listBySubscriptionCreateRequest(ctx context.Context, options *VmmServersClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *VmmServersClient) listBySubscriptionCreateRequest(ctx context.Context, _ *VmmServersClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ScVmm/vmmServers" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -367,7 +364,7 @@ func (client *VmmServersClient) listBySubscriptionCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -385,7 +382,7 @@ func (client *VmmServersClient) listBySubscriptionHandleResponse(resp *http.Resp // BeginUpdate - Updates the VmmServers resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vmmServerName - Name of the VmmServer. // - properties - The resource properties to be updated. @@ -411,7 +408,7 @@ func (client *VmmServersClient) BeginUpdate(ctx context.Context, resourceGroupNa // Update - Updates the VmmServers resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-10-07 +// Generated from API version 2025-03-13 func (client *VmmServersClient) update(ctx context.Context, resourceGroupName string, vmmServerName string, properties VmmServerTagsUpdate, options *VmmServersClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "VmmServersClient.BeginUpdate" @@ -434,7 +431,7 @@ func (client *VmmServersClient) update(ctx context.Context, resourceGroupName st } // updateCreateRequest creates the Update request. -func (client *VmmServersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vmmServerName string, properties VmmServerTagsUpdate, options *VmmServersClientBeginUpdateOptions) (*policy.Request, error) { +func (client *VmmServersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vmmServerName string, properties VmmServerTagsUpdate, _ *VmmServersClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ScVmm/vmmServers/{vmmServerName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -453,7 +450,7 @@ func (client *VmmServersClient) updateCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-10-07") + reqQP.Set("api-version", "2025-03-13") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, properties); err != nil { diff --git a/sdk/resourcemanager/scvmm/armscvmm/vmmservers_client_example_test.go b/sdk/resourcemanager/scvmm/armscvmm/vmmservers_client_example_test.go deleted file mode 100644 index e440882550b1..000000000000 --- a/sdk/resourcemanager/scvmm/armscvmm/vmmservers_client_example_test.go +++ /dev/null @@ -1,528 +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 armscvmm_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/scvmm/armscvmm" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmmServers_ListBySubscription_MaximumSet_Gen.json -func ExampleVmmServersClient_NewListBySubscriptionPager_vmmServersListBySubscriptionMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVmmServersClient().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.VmmServerListResult = armscvmm.VmmServerListResult{ - // Value: []*armscvmm.VmmServer{ - // { - // Name: to.Ptr("gyoxmcbnbbfajvzygtffpaufxxjzs"), - // Type: to.Ptr("nwiimbcjryiggdcbpvrqdnlrklcwbr"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Location: to.Ptr("hslxkyzktvwpqbypvs"), - // Tags: map[string]*string{ - // "key4834": to.Ptr("vycgfkzjcyyuotwwq"), - // }, - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - // Type: to.Ptr("customLocation"), - // }, - // Properties: &armscvmm.VmmServerProperties{ - // ConnectionStatus: to.Ptr("vlmrrigzmutgbzrgjtolnamfxm"), - // Credentials: &armscvmm.VmmCredential{ - // Username: to.Ptr("jbuoltypmrgqfi"), - // }, - // ErrorMessage: to.Ptr("ndkzeiipz"), - // Fqdn: to.Ptr("pvzcjaqrswbvptgx"), - // Port: to.Ptr[int32](4), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // UUID: to.Ptr("vmwbukuqbuz"), - // Version: to.Ptr("tawfjzbqrlkqzqyomxiahnfqg"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmmServers_ListBySubscription_MinimumSet_Gen.json -func ExampleVmmServersClient_NewListBySubscriptionPager_vmmServersListBySubscriptionMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVmmServersClient().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.VmmServerListResult = armscvmm.VmmServerListResult{ - // Value: []*armscvmm.VmmServer{ - // { - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // Location: to.Ptr("hslxkyzktvwpqbypvs"), - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmmServers_ListByResourceGroup_MaximumSet_Gen.json -func ExampleVmmServersClient_NewListByResourceGroupPager_vmmServersListByResourceGroupMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVmmServersClient().NewListByResourceGroupPager("rgscvmm", 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.VmmServerListResult = armscvmm.VmmServerListResult{ - // Value: []*armscvmm.VmmServer{ - // { - // Name: to.Ptr("gyoxmcbnbbfajvzygtffpaufxxjzs"), - // Type: to.Ptr("nwiimbcjryiggdcbpvrqdnlrklcwbr"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Location: to.Ptr("hslxkyzktvwpqbypvs"), - // Tags: map[string]*string{ - // "key4834": to.Ptr("vycgfkzjcyyuotwwq"), - // }, - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - // Type: to.Ptr("customLocation"), - // }, - // Properties: &armscvmm.VmmServerProperties{ - // ConnectionStatus: to.Ptr("vlmrrigzmutgbzrgjtolnamfxm"), - // Credentials: &armscvmm.VmmCredential{ - // Username: to.Ptr("jbuoltypmrgqfi"), - // }, - // ErrorMessage: to.Ptr("ndkzeiipz"), - // Fqdn: to.Ptr("pvzcjaqrswbvptgx"), - // Port: to.Ptr[int32](4), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // UUID: to.Ptr("vmwbukuqbuz"), - // Version: to.Ptr("tawfjzbqrlkqzqyomxiahnfqg"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmmServers_ListByResourceGroup_MinimumSet_Gen.json -func ExampleVmmServersClient_NewListByResourceGroupPager_vmmServersListByResourceGroupMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVmmServersClient().NewListByResourceGroupPager("rgscvmm", 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.VmmServerListResult = armscvmm.VmmServerListResult{ - // Value: []*armscvmm.VmmServer{ - // { - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // Location: to.Ptr("hslxkyzktvwpqbypvs"), - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmmServers_Get_MaximumSet_Gen.json -func ExampleVmmServersClient_Get_vmmServersGetMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVmmServersClient().Get(ctx, "rgscvmm", ".", 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.VmmServer = armscvmm.VmmServer{ - // Name: to.Ptr("gyoxmcbnbbfajvzygtffpaufxxjzs"), - // Type: to.Ptr("nwiimbcjryiggdcbpvrqdnlrklcwbr"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Location: to.Ptr("hslxkyzktvwpqbypvs"), - // Tags: map[string]*string{ - // "key4834": to.Ptr("vycgfkzjcyyuotwwq"), - // }, - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - // Type: to.Ptr("customLocation"), - // }, - // Properties: &armscvmm.VmmServerProperties{ - // ConnectionStatus: to.Ptr("vlmrrigzmutgbzrgjtolnamfxm"), - // Credentials: &armscvmm.VmmCredential{ - // Username: to.Ptr("jbuoltypmrgqfi"), - // }, - // ErrorMessage: to.Ptr("ndkzeiipz"), - // Fqdn: to.Ptr("pvzcjaqrswbvptgx"), - // Port: to.Ptr[int32](4), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // UUID: to.Ptr("vmwbukuqbuz"), - // Version: to.Ptr("tawfjzbqrlkqzqyomxiahnfqg"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmmServers_Get_MinimumSet_Gen.json -func ExampleVmmServersClient_Get_vmmServersGetMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVmmServersClient().Get(ctx, "rgscvmm", "D", 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.VmmServer = armscvmm.VmmServer{ - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // Location: to.Ptr("hslxkyzktvwpqbypvs"), - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmmServers_CreateOrUpdate_MaximumSet_Gen.json -func ExampleVmmServersClient_BeginCreateOrUpdate_vmmServersCreateOrUpdateMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVmmServersClient().BeginCreateOrUpdate(ctx, "rgscvmm", "-", armscvmm.VmmServer{ - Location: to.Ptr("hslxkyzktvwpqbypvs"), - Tags: map[string]*string{ - "key4834": to.Ptr("vycgfkzjcyyuotwwq"), - }, - ExtendedLocation: &armscvmm.ExtendedLocation{ - Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - Type: to.Ptr("customLocation"), - }, - Properties: &armscvmm.VmmServerProperties{ - Credentials: &armscvmm.VmmCredential{ - Password: to.Ptr("gaecsnkjr"), - Username: to.Ptr("jbuoltypmrgqfi"), - }, - Fqdn: to.Ptr("pvzcjaqrswbvptgx"), - Port: to.Ptr[int32](4), - }, - }, 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.VmmServer = armscvmm.VmmServer{ - // Name: to.Ptr("gyoxmcbnbbfajvzygtffpaufxxjzs"), - // Type: to.Ptr("nwiimbcjryiggdcbpvrqdnlrklcwbr"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Location: to.Ptr("hslxkyzktvwpqbypvs"), - // Tags: map[string]*string{ - // "key4834": to.Ptr("vycgfkzjcyyuotwwq"), - // }, - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - // Type: to.Ptr("customLocation"), - // }, - // Properties: &armscvmm.VmmServerProperties{ - // ConnectionStatus: to.Ptr("vlmrrigzmutgbzrgjtolnamfxm"), - // Credentials: &armscvmm.VmmCredential{ - // Username: to.Ptr("jbuoltypmrgqfi"), - // }, - // ErrorMessage: to.Ptr("ndkzeiipz"), - // Fqdn: to.Ptr("pvzcjaqrswbvptgx"), - // Port: to.Ptr[int32](4), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // UUID: to.Ptr("vmwbukuqbuz"), - // Version: to.Ptr("tawfjzbqrlkqzqyomxiahnfqg"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmmServers_CreateOrUpdate_MinimumSet_Gen.json -func ExampleVmmServersClient_BeginCreateOrUpdate_vmmServersCreateOrUpdateMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVmmServersClient().BeginCreateOrUpdate(ctx, "rgscvmm", "w", armscvmm.VmmServer{ - Location: to.Ptr("hslxkyzktvwpqbypvs"), - ExtendedLocation: &armscvmm.ExtendedLocation{}, - }, 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.VmmServer = armscvmm.VmmServer{ - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // Location: to.Ptr("hslxkyzktvwpqbypvs"), - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmmServers_Update_MaximumSet_Gen.json -func ExampleVmmServersClient_BeginUpdate_vmmServersUpdateMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVmmServersClient().BeginUpdate(ctx, "rgscvmm", "Y", armscvmm.VmmServerTagsUpdate{ - Tags: map[string]*string{ - "key7187": to.Ptr("oktnfvklfchnquelzzdagtpwfskzc"), - }, - }, 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.VmmServer = armscvmm.VmmServer{ - // Name: to.Ptr("gyoxmcbnbbfajvzygtffpaufxxjzs"), - // Type: to.Ptr("nwiimbcjryiggdcbpvrqdnlrklcwbr"), - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // SystemData: &armscvmm.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.094Z"); return t}()), - // CreatedBy: to.Ptr("p"), - // CreatedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-29T22:28:00.095Z"); return t}()), - // LastModifiedBy: to.Ptr("goxcwpyyqlxndquly"), - // LastModifiedByType: to.Ptr(armscvmm.CreatedByTypeUser), - // }, - // Location: to.Ptr("hslxkyzktvwpqbypvs"), - // Tags: map[string]*string{ - // "key4834": to.Ptr("vycgfkzjcyyuotwwq"), - // }, - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // Name: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ExtendedLocation/customLocations/customLocationName"), - // Type: to.Ptr("customLocation"), - // }, - // Properties: &armscvmm.VmmServerProperties{ - // ConnectionStatus: to.Ptr("vlmrrigzmutgbzrgjtolnamfxm"), - // Credentials: &armscvmm.VmmCredential{ - // Username: to.Ptr("jbuoltypmrgqfi"), - // }, - // ErrorMessage: to.Ptr("ndkzeiipz"), - // Fqdn: to.Ptr("pvzcjaqrswbvptgx"), - // Port: to.Ptr[int32](4), - // ProvisioningState: to.Ptr(armscvmm.ProvisioningStateSucceeded), - // UUID: to.Ptr("vmwbukuqbuz"), - // Version: to.Ptr("tawfjzbqrlkqzqyomxiahnfqg"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmmServers_Update_MinimumSet_Gen.json -func ExampleVmmServersClient_BeginUpdate_vmmServersUpdateMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVmmServersClient().BeginUpdate(ctx, "rgscvmm", "_", armscvmm.VmmServerTagsUpdate{}, 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.VmmServer = armscvmm.VmmServer{ - // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-12345678abc/resourceGroups/exampleResourceGroup/providers/Microsoft.ScVmm/vmmServers/vmmServerName"), - // Location: to.Ptr("hslxkyzktvwpqbypvs"), - // ExtendedLocation: &armscvmm.ExtendedLocation{ - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmmServers_Delete_MaximumSet_Gen.json -func ExampleVmmServersClient_BeginDelete_vmmServersDeleteMaximumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVmmServersClient().BeginDelete(ctx, "rgscvmm", ".", &armscvmm.VmmServersClientBeginDeleteOptions{Force: to.Ptr(armscvmm.ForceDeleteTrue)}) - 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/7753cb8917f0968713c013a1f25875e8bd8dc492/specification/scvmm/resource-manager/Microsoft.ScVmm/stable/2023-10-07/examples/VmmServers_Delete_MinimumSet_Gen.json -func ExampleVmmServersClient_BeginDelete_vmmServersDeleteMinimumSet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armscvmm.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVmmServersClient().BeginDelete(ctx, "rgscvmm", "8", &armscvmm.VmmServersClientBeginDeleteOptions{Force: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/sphere/armsphere/CHANGELOG.md b/sdk/resourcemanager/sphere/armsphere/CHANGELOG.md index ba549517a435..b7a7eee9ba4c 100644 --- a/sdk/resourcemanager/sphere/armsphere/CHANGELOG.md +++ b/sdk/resourcemanager/sphere/armsphere/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.0.1 (2025-04-27) +### Other Changes + + ## 1.0.0 (2024-03-26) ### Breaking Changes diff --git a/sdk/resourcemanager/sphere/armsphere/autorest.md b/sdk/resourcemanager/sphere/armsphere/autorest.md index be8292df2b98..055882c587ff 100644 --- a/sdk/resourcemanager/sphere/armsphere/autorest.md +++ b/sdk/resourcemanager/sphere/armsphere/autorest.md @@ -5,9 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/sphere/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/sphere/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 -tag: package-2024-04-01 +module-version: 1.0.1 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/sphere/armsphere/catalogs_client.go b/sdk/resourcemanager/sphere/armsphere/catalogs_client.go index 0d6256a9eadb..df7417824a00 100644 --- a/sdk/resourcemanager/sphere/armsphere/catalogs_client.go +++ b/sdk/resourcemanager/sphere/armsphere/catalogs_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. @@ -74,7 +71,7 @@ func (client *CatalogsClient) CountDevices(ctx context.Context, resourceGroupNam } // countDevicesCreateRequest creates the CountDevices request. -func (client *CatalogsClient) countDevicesCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, options *CatalogsClientCountDevicesOptions) (*policy.Request, error) { +func (client *CatalogsClient) countDevicesCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, _ *CatalogsClientCountDevicesOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/countDevices" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -161,7 +158,7 @@ func (client *CatalogsClient) createOrUpdate(ctx context.Context, resourceGroupN } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *CatalogsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, resource Catalog, options *CatalogsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *CatalogsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, resource Catalog, _ *CatalogsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -240,7 +237,7 @@ func (client *CatalogsClient) deleteOperation(ctx context.Context, resourceGroup } // deleteCreateRequest creates the Delete request. -func (client *CatalogsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, options *CatalogsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *CatalogsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, _ *CatalogsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -295,7 +292,7 @@ func (client *CatalogsClient) Get(ctx context.Context, resourceGroupName string, } // getCreateRequest creates the Get request. -func (client *CatalogsClient) getCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, options *CatalogsClientGetOptions) (*policy.Request, error) { +func (client *CatalogsClient) getCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, _ *CatalogsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -359,7 +356,7 @@ func (client *CatalogsClient) NewListByResourceGroupPager(resourceGroupName stri } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *CatalogsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *CatalogsClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *CatalogsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *CatalogsClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -418,7 +415,7 @@ func (client *CatalogsClient) NewListBySubscriptionPager(options *CatalogsClient } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *CatalogsClient) listBySubscriptionCreateRequest(ctx context.Context, options *CatalogsClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *CatalogsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *CatalogsClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.AzureSphere/catalogs" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -787,7 +784,7 @@ func (client *CatalogsClient) Update(ctx context.Context, resourceGroupName stri } // updateCreateRequest creates the Update request. -func (client *CatalogsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, properties CatalogUpdate, options *CatalogsClientUpdateOptions) (*policy.Request, error) { +func (client *CatalogsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, properties CatalogUpdate, _ *CatalogsClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -877,7 +874,7 @@ func (client *CatalogsClient) uploadImage(ctx context.Context, resourceGroupName } // uploadImageCreateRequest creates the UploadImage request. -func (client *CatalogsClient) uploadImageCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, uploadImageRequest Image, options *CatalogsClientBeginUploadImageOptions) (*policy.Request, error) { +func (client *CatalogsClient) uploadImageCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, uploadImageRequest Image, _ *CatalogsClientBeginUploadImageOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/uploadImage" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/sphere/armsphere/catalogs_client_example_test.go b/sdk/resourcemanager/sphere/armsphere/catalogs_client_example_test.go deleted file mode 100644 index 51e5ae59813b..000000000000 --- a/sdk/resourcemanager/sphere/armsphere/catalogs_client_example_test.go +++ /dev/null @@ -1,432 +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 armsphere_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/sphere/armsphere" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCatalogsSub.json -func ExampleCatalogsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCatalogsClient().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.CatalogListResult = armsphere.CatalogListResult{ - // Value: []*armsphere.Catalog{ - // { - // Name: to.Ptr("MyCatalog1"), - // Type: to.Ptr("Microsoft.AzureSphere/catalogs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1"), - // Location: to.Ptr("global"), - // }, - // { - // Name: to.Ptr("MyCatalog2"), - // Type: to.Ptr("Microsoft.AzureSphere/catalogs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup2/providers/Microsoft.AzureSphere/catalogs/MyCatalog2"), - // Location: to.Ptr("global"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCatalogsRG.json -func ExampleCatalogsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCatalogsClient().NewListByResourceGroupPager("MyResourceGroup1", 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.CatalogListResult = armsphere.CatalogListResult{ - // Value: []*armsphere.Catalog{ - // { - // Name: to.Ptr("MyCatalog1"), - // Type: to.Ptr("Microsoft.AzureSphere/catalogs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1"), - // Location: to.Ptr("global"), - // }, - // { - // Name: to.Ptr("MyCatalog2"), - // Type: to.Ptr("Microsoft.AzureSphere/catalogs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog2"), - // Location: to.Ptr("global"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCatalog.json -func ExampleCatalogsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCatalogsClient().Get(ctx, "MyResourceGroup1", "MyCatalog1", 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.Catalog = armsphere.Catalog{ - // Name: to.Ptr("MyCatalog1"), - // Type: to.Ptr("Microsoft.AzureSphere/catalogs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1"), - // Location: to.Ptr("global"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutCatalog.json -func ExampleCatalogsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCatalogsClient().BeginCreateOrUpdate(ctx, "MyResourceGroup1", "MyCatalog1", armsphere.Catalog{ - Location: to.Ptr("global"), - }, 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.Catalog = armsphere.Catalog{ - // Name: to.Ptr("MyCatalog1"), - // Type: to.Ptr("Microsoft.AzureSphere/catalogs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1"), - // Location: to.Ptr("global"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PatchCatalog.json -func ExampleCatalogsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCatalogsClient().Update(ctx, "MyResourceGroup1", "MyCatalog1", armsphere.CatalogUpdate{}, 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.Catalog = armsphere.Catalog{ - // Name: to.Ptr("MyCatalog1"), - // Type: to.Ptr("Microsoft.AzureSphere/catalogs"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1"), - // Location: to.Ptr("global"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteCatalog.json -func ExampleCatalogsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCatalogsClient().BeginDelete(ctx, "MyResourceGroup1", "MyCatalog1", 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/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostCountDevicesCatalog.json -func ExampleCatalogsClient_CountDevices() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCatalogsClient().CountDevices(ctx, "MyResourceGroup1", "MyCatalog1", 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.CountDevicesResponse = armsphere.CountDevicesResponse{ - // Value: to.Ptr[int32](3), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostListDeploymentsByCatalog.json -func ExampleCatalogsClient_NewListDeploymentsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCatalogsClient().NewListDeploymentsPager("MyResourceGroup1", "MyCatalog1", &armsphere.CatalogsClientListDeploymentsOptions{Filter: nil, - Top: nil, - Skip: nil, - Maxpagesize: 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.DeploymentListResult = armsphere.DeploymentListResult{ - // Value: []*armsphere.Deployment{ - // { - // Name: to.Ptr("DeploymentName1111"), - // Properties: &armsphere.DeploymentProperties{ - // }, - // }, - // { - // Name: to.Ptr("DeploymentName1121"), - // Properties: &armsphere.DeploymentProperties{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostListDeviceGroupsCatalog.json -func ExampleCatalogsClient_NewListDeviceGroupsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCatalogsClient().NewListDeviceGroupsPager("MyResourceGroup1", "MyCatalog1", armsphere.ListDeviceGroupsRequest{ - DeviceGroupName: to.Ptr("MyDeviceGroup1"), - }, &armsphere.CatalogsClientListDeviceGroupsOptions{Filter: nil, - Top: nil, - Skip: nil, - Maxpagesize: 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.DeviceGroupListResult = armsphere.DeviceGroupListResult{ - // Value: []*armsphere.DeviceGroup{ - // { - // Name: to.Ptr("MyDeviceGroup1"), - // Type: to.Ptr("microsoft.azureSphere/catalogs/products/devicegroups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct1/devicegroups/MyDeviceGroup1"), - // }, - // { - // Name: to.Ptr("MyDeviceGroup2"), - // Type: to.Ptr("microsoft.azureSphere/catalogs/products/devicegroups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct2/devicegroups/MyDeviceGroup2"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostListDeviceInsightsCatalog.json -func ExampleCatalogsClient_NewListDeviceInsightsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCatalogsClient().NewListDeviceInsightsPager("MyResourceGroup1", "MyCatalog1", &armsphere.CatalogsClientListDeviceInsightsOptions{Filter: nil, - Top: to.Ptr[int32](10), - Skip: nil, - Maxpagesize: 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.PagedDeviceInsight = armsphere.PagedDeviceInsight{ - // Value: []*armsphere.DeviceInsight{ - // { - // Description: to.Ptr("eventDescription1"), - // DeviceID: to.Ptr("eventIdentifier1"), - // EndTimestampUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-30T23:54:21.960Z"); return t}()), - // EventCategory: to.Ptr("eventCategory1"), - // EventClass: to.Ptr("eventClass1"), - // EventCount: to.Ptr[int32](1), - // EventType: to.Ptr("eventType1"), - // StartTimestampUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-09-30T21:51:39.260Z"); return t}()), - // }, - // { - // Description: to.Ptr("eventDescription2"), - // DeviceID: to.Ptr("eventIdentifier2"), - // EndTimestampUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-07T17:34:12.500Z"); return t}()), - // EventCategory: to.Ptr("eventCategory2"), - // EventClass: to.Ptr("eventClass2"), - // EventCount: to.Ptr[int32](1), - // EventType: to.Ptr("eventType2"), - // StartTimestampUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-12-06T12:41:39.260Z"); return t}()), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostListDevicesByCatalog.json -func ExampleCatalogsClient_NewListDevicesPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCatalogsClient().NewListDevicesPager("MyResourceGroup1", "MyCatalog1", &armsphere.CatalogsClientListDevicesOptions{Filter: nil, - Top: nil, - Skip: nil, - Maxpagesize: 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.DeviceListResult = armsphere.DeviceListResult{ - // Value: []*armsphere.Device{ - // { - // Name: to.Ptr("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"), - // Properties: &armsphere.DeviceProperties{ - // }, - // }, - // { - // Name: to.Ptr("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"), - // Properties: &armsphere.DeviceProperties{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostUploadImageCatalog.json -func ExampleCatalogsClient_BeginUploadImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCatalogsClient().BeginUploadImage(ctx, "MyResourceGroup1", "MyCatalog1", armsphere.Image{ - Properties: &armsphere.ImageProperties{ - Image: to.Ptr("bXliYXNlNjRzdHJpbmc="), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/sphere/armsphere/certificates_client.go b/sdk/resourcemanager/sphere/armsphere/certificates_client.go index a5110099c695..387f5554f5d1 100644 --- a/sdk/resourcemanager/sphere/armsphere/certificates_client.go +++ b/sdk/resourcemanager/sphere/armsphere/certificates_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. @@ -75,7 +72,7 @@ func (client *CertificatesClient) Get(ctx context.Context, resourceGroupName str } // getCreateRequest creates the Get request. -func (client *CertificatesClient) getCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, serialNumber string, options *CertificatesClientGetOptions) (*policy.Request, error) { +func (client *CertificatesClient) getCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, serialNumber string, _ *CertificatesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -222,7 +219,7 @@ func (client *CertificatesClient) RetrieveCertChain(ctx context.Context, resourc } // retrieveCertChainCreateRequest creates the RetrieveCertChain request. -func (client *CertificatesClient) retrieveCertChainCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, serialNumber string, options *CertificatesClientRetrieveCertChainOptions) (*policy.Request, error) { +func (client *CertificatesClient) retrieveCertChainCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, serialNumber string, _ *CertificatesClientRetrieveCertChainOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}/retrieveCertChain" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -293,7 +290,7 @@ func (client *CertificatesClient) RetrieveProofOfPossessionNonce(ctx context.Con } // retrieveProofOfPossessionNonceCreateRequest creates the RetrieveProofOfPossessionNonce request. -func (client *CertificatesClient) retrieveProofOfPossessionNonceCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, serialNumber string, proofOfPossessionNonceRequest ProofOfPossessionNonceRequest, options *CertificatesClientRetrieveProofOfPossessionNonceOptions) (*policy.Request, error) { +func (client *CertificatesClient) retrieveProofOfPossessionNonceCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, serialNumber string, proofOfPossessionNonceRequest ProofOfPossessionNonceRequest, _ *CertificatesClientRetrieveProofOfPossessionNonceOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/certificates/{serialNumber}/retrieveProofOfPossessionNonce" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/sphere/armsphere/certificates_client_example_test.go b/sdk/resourcemanager/sphere/armsphere/certificates_client_example_test.go deleted file mode 100644 index 72b5e6dabbb9..000000000000 --- a/sdk/resourcemanager/sphere/armsphere/certificates_client_example_test.go +++ /dev/null @@ -1,122 +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 armsphere_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/sphere/armsphere" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCertificates.json -func ExampleCertificatesClient_NewListByCatalogPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCertificatesClient().NewListByCatalogPager("MyResourceGroup1", "MyCatalog1", &armsphere.CertificatesClientListByCatalogOptions{Filter: nil, - Top: nil, - Skip: nil, - Maxpagesize: 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.CertificateListResult = armsphere.CertificateListResult{ - // Value: []*armsphere.Certificate{ - // }, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetCertificate.json -func ExampleCertificatesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCertificatesClient().Get(ctx, "MyResourceGroup1", "MyCatalog1", "default", 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.Certificate = armsphere.Certificate{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostRetrieveCatalogCertChain.json -func ExampleCertificatesClient_RetrieveCertChain() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCertificatesClient().RetrieveCertChain(ctx, "MyResourceGroup1", "MyCatalog1", "active", 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.CertificateChainResponse = armsphere.CertificateChainResponse{ - // CertificateChain: to.Ptr("ABynaryRepresentationOfTheRequestedCatalogCertificateChain"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostRetrieveProofOfPossessionNonce.json -func ExampleCertificatesClient_RetrieveProofOfPossessionNonce() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCertificatesClient().RetrieveProofOfPossessionNonce(ctx, "MyResourceGroup1", "MyCatalog1", "active", armsphere.ProofOfPossessionNonceRequest{ - ProofOfPossessionNonce: to.Ptr("proofOfPossessionNonce"), - }, 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.ProofOfPossessionNonceResponse = armsphere.ProofOfPossessionNonceResponse{ - // Certificate: to.Ptr("bXliYXNlNjRzdHJpbmc="), - // } -} diff --git a/sdk/resourcemanager/sphere/armsphere/client_factory.go b/sdk/resourcemanager/sphere/armsphere/client_factory.go index ab4bb1bde234..9535550edd7f 100644 --- a/sdk/resourcemanager/sphere/armsphere/client_factory.go +++ b/sdk/resourcemanager/sphere/armsphere/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. diff --git a/sdk/resourcemanager/sphere/armsphere/constants.go b/sdk/resourcemanager/sphere/armsphere/constants.go index 4fa7e90a0c8f..b89ac754f51a 100644 --- a/sdk/resourcemanager/sphere/armsphere/constants.go +++ b/sdk/resourcemanager/sphere/armsphere/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 armsphere const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sphere/armsphere" - moduleVersion = "v1.0.0" + moduleVersion = "v1.0.1" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/sphere/armsphere/deployments_client.go b/sdk/resourcemanager/sphere/armsphere/deployments_client.go index 3e229a7536b1..e8faa679f8d5 100644 --- a/sdk/resourcemanager/sphere/armsphere/deployments_client.go +++ b/sdk/resourcemanager/sphere/armsphere/deployments_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. @@ -103,7 +100,7 @@ func (client *DeploymentsClient) createOrUpdate(ctx context.Context, resourceGro } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *DeploymentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, deploymentName string, resource Deployment, options *DeploymentsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *DeploymentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, deploymentName string, resource Deployment, _ *DeploymentsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -200,7 +197,7 @@ func (client *DeploymentsClient) deleteOperation(ctx context.Context, resourceGr } // deleteCreateRequest creates the Delete request. -func (client *DeploymentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, deploymentName string, options *DeploymentsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *DeploymentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, deploymentName string, _ *DeploymentsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -272,7 +269,7 @@ func (client *DeploymentsClient) Get(ctx context.Context, resourceGroupName stri } // getCreateRequest creates the Get request. -func (client *DeploymentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, deploymentName string, options *DeploymentsClientGetOptions) (*policy.Request, error) { +func (client *DeploymentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, deploymentName string, _ *DeploymentsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/deployments/{deploymentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/sphere/armsphere/deployments_client_example_test.go b/sdk/resourcemanager/sphere/armsphere/deployments_client_example_test.go deleted file mode 100644 index 2c840eda3fb5..000000000000 --- a/sdk/resourcemanager/sphere/armsphere/deployments_client_example_test.go +++ /dev/null @@ -1,173 +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 armsphere_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sphere/armsphere" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDeployments.json -func ExampleDeploymentsClient_NewListByDeviceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDeploymentsClient().NewListByDeviceGroupPager("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", &armsphere.DeploymentsClientListByDeviceGroupOptions{Filter: nil, - Top: nil, - Skip: nil, - Maxpagesize: 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.DeploymentListResult = armsphere.DeploymentListResult{ - // Value: []*armsphere.Deployment{ - // { - // Name: to.Ptr("MyDeployment1"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct1/deviceGroups/MyDeviceGroup1/deployments/MyDeployment1"), - // Properties: &armsphere.DeploymentProperties{ - // DeployedImages: []*armsphere.Image{ - // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/images/MyImage1"), - // Properties: &armsphere.ImageProperties{ - // Description: to.Ptr("description"), - // ComponentID: to.Ptr("componentId"), - // Image: to.Ptr("dGVzdGltYWdl"), - // ImageType: to.Ptr(armsphere.ImageType("ImageType")), - // ProvisioningState: to.Ptr(armsphere.ProvisioningStateSucceeded), - // RegionalDataBoundary: to.Ptr(armsphere.RegionalDataBoundaryNone), - // URI: to.Ptr("imageUri"), - // }, - // }}, - // DeploymentDateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-30T21:51:39.269Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDeployment.json -func ExampleDeploymentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDeploymentsClient().Get(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", "MyDeployment1", 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.Deployment = armsphere.Deployment{ - // Name: to.Ptr("MyDeployment1"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct1/deviceGroups/MyDeviceGroup1/deployments/MyDeployment1"), - // Properties: &armsphere.DeploymentProperties{ - // DeployedImages: []*armsphere.Image{ - // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/images/MyImage1"), - // Properties: &armsphere.ImageProperties{ - // Description: to.Ptr("description"), - // ComponentID: to.Ptr("componentId"), - // Image: to.Ptr("dGVzdGltYWdl"), - // ImageType: to.Ptr(armsphere.ImageType("ImageType")), - // ProvisioningState: to.Ptr(armsphere.ProvisioningStateSucceeded), - // RegionalDataBoundary: to.Ptr(armsphere.RegionalDataBoundaryNone), - // URI: to.Ptr("imageUri"), - // }, - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutDeployment.json -func ExampleDeploymentsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDeploymentsClient().BeginCreateOrUpdate(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", "MyDeployment1", armsphere.Deployment{}, 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.Deployment = armsphere.Deployment{ - // Name: to.Ptr("MyDeployment1"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct1/deviceGroups/MyDeviceGroup1/deployments/MyDeployment1"), - // Properties: &armsphere.DeploymentProperties{ - // DeployedImages: []*armsphere.Image{ - // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/images/MyImage1"), - // Properties: &armsphere.ImageProperties{ - // Image: to.Ptr("MyImage"), - // ImageID: to.Ptr("00000000-0000-0000-0000-000000000000"), - // ImageType: to.Ptr(armsphere.ImageTypeInvalidImageType), - // ProvisioningState: to.Ptr(armsphere.ProvisioningStateSucceeded), - // RegionalDataBoundary: to.Ptr(armsphere.RegionalDataBoundaryNone), - // URI: to.Ptr("imageUri"), - // }, - // }}, - // ProvisioningState: to.Ptr(armsphere.ProvisioningStateSucceeded), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteDeployment.json -func ExampleDeploymentsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDeploymentsClient().BeginDelete(ctx, "MyResourceGroup1", "MyCatalog1", "MyProductName1", "DeviceGroupName1", "MyDeploymentName1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/sphere/armsphere/devicegroups_client.go b/sdk/resourcemanager/sphere/armsphere/devicegroups_client.go index a437ed23e435..f25da964a829 100644 --- a/sdk/resourcemanager/sphere/armsphere/devicegroups_client.go +++ b/sdk/resourcemanager/sphere/armsphere/devicegroups_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. @@ -101,7 +98,7 @@ func (client *DeviceGroupsClient) claimDevices(ctx context.Context, resourceGrou } // claimDevicesCreateRequest creates the ClaimDevices request. -func (client *DeviceGroupsClient) claimDevicesCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, claimDevicesRequest ClaimDevicesRequest, options *DeviceGroupsClientBeginClaimDevicesOptions) (*policy.Request, error) { +func (client *DeviceGroupsClient) claimDevicesCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, claimDevicesRequest ClaimDevicesRequest, _ *DeviceGroupsClientBeginClaimDevicesOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/claimDevices" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -171,7 +168,7 @@ func (client *DeviceGroupsClient) CountDevices(ctx context.Context, resourceGrou } // countDevicesCreateRequest creates the CountDevices request. -func (client *DeviceGroupsClient) countDevicesCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, options *DeviceGroupsClientCountDevicesOptions) (*policy.Request, error) { +func (client *DeviceGroupsClient) countDevicesCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, _ *DeviceGroupsClientCountDevicesOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/countDevices" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -270,7 +267,7 @@ func (client *DeviceGroupsClient) createOrUpdate(ctx context.Context, resourceGr } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *DeviceGroupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, resource DeviceGroup, options *DeviceGroupsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *DeviceGroupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, resource DeviceGroup, _ *DeviceGroupsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -362,7 +359,7 @@ func (client *DeviceGroupsClient) deleteOperation(ctx context.Context, resourceG } // deleteCreateRequest creates the Delete request. -func (client *DeviceGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, options *DeviceGroupsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *DeviceGroupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, _ *DeviceGroupsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -428,7 +425,7 @@ func (client *DeviceGroupsClient) Get(ctx context.Context, resourceGroupName str } // getCreateRequest creates the Get request. -func (client *DeviceGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, options *DeviceGroupsClientGetOptions) (*policy.Request, error) { +func (client *DeviceGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, _ *DeviceGroupsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -610,7 +607,7 @@ func (client *DeviceGroupsClient) update(ctx context.Context, resourceGroupName } // updateCreateRequest creates the Update request. -func (client *DeviceGroupsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, properties DeviceGroupUpdate, options *DeviceGroupsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *DeviceGroupsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, properties DeviceGroupUpdate, _ *DeviceGroupsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/sphere/armsphere/devicegroups_client_example_test.go b/sdk/resourcemanager/sphere/armsphere/devicegroups_client_example_test.go deleted file mode 100644 index d2b2ff47a629..000000000000 --- a/sdk/resourcemanager/sphere/armsphere/devicegroups_client_example_test.go +++ /dev/null @@ -1,230 +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 armsphere_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/sphere/armsphere" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDeviceGroups.json -func ExampleDeviceGroupsClient_NewListByProductPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDeviceGroupsClient().NewListByProductPager("MyResourceGroup1", "MyCatalog1", "MyProduct1", &armsphere.DeviceGroupsClientListByProductOptions{Filter: nil, - Top: nil, - Skip: nil, - Maxpagesize: 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.DeviceGroupListResult = armsphere.DeviceGroupListResult{ - // Value: []*armsphere.DeviceGroup{ - // { - // Name: to.Ptr("MyDeviceGroup1"), - // Type: to.Ptr("microsoft.azureSphere/catalogs/products/devicegroups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct1/devicegroups/MyDeviceGroup1"), - // }, - // { - // Name: to.Ptr("MyDeviceGroup2"), - // Type: to.Ptr("microsoft.azureSphere/catalogs/products/devicegroups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/Products/MyProduct2/devicegroups/MyDeviceGroup2"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDeviceGroup.json -func ExampleDeviceGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDeviceGroupsClient().Get(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", 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.DeviceGroup = armsphere.DeviceGroup{ - // Type: to.Ptr("microsoft.azureSphere/catalogs/products/devicegroups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct1/devicegroups/MyDeviceGroup1"), - // Properties: &armsphere.DeviceGroupProperties{ - // Description: to.Ptr("The description of MyDeviceGroup1"), - // OSFeedType: to.Ptr(armsphere.OSFeedTypeRetail), - // UpdatePolicy: to.Ptr(armsphere.UpdatePolicyUpdateAll), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutDeviceGroup.json -func ExampleDeviceGroupsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDeviceGroupsClient().BeginCreateOrUpdate(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", armsphere.DeviceGroup{ - Properties: &armsphere.DeviceGroupProperties{ - Description: to.Ptr("Description for MyDeviceGroup1"), - OSFeedType: to.Ptr(armsphere.OSFeedTypeRetail), - UpdatePolicy: to.Ptr(armsphere.UpdatePolicyUpdateAll), - }, - }, 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.DeviceGroup = armsphere.DeviceGroup{ - // Type: to.Ptr("microsoft.AzureSphere/catalogs/products/devicegroups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct1/devicegroups/MyDeviceGroup1"), - // Properties: &armsphere.DeviceGroupProperties{ - // Description: to.Ptr("Description of MyDeviceGroup1"), - // OSFeedType: to.Ptr(armsphere.OSFeedTypeRetail), - // UpdatePolicy: to.Ptr(armsphere.UpdatePolicyUpdateAll), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PatchDeviceGroup.json -func ExampleDeviceGroupsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDeviceGroupsClient().BeginUpdate(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", armsphere.DeviceGroupUpdate{}, 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.DeviceGroup = armsphere.DeviceGroup{ - // Type: to.Ptr("microsoft.azureSphere/catalogs/products/devicegroups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct1/devicegroups/MyDeviceGroup1"), - // Properties: &armsphere.DeviceGroupProperties{ - // Description: to.Ptr("The description of MyDeviceGroup1"), - // OSFeedType: to.Ptr(armsphere.OSFeedTypeRetail), - // UpdatePolicy: to.Ptr(armsphere.UpdatePolicyUpdateAll), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteDeviceGroup.json -func ExampleDeviceGroupsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDeviceGroupsClient().BeginDelete(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", 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/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostClaimDevices.json -func ExampleDeviceGroupsClient_BeginClaimDevices() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDeviceGroupsClient().BeginClaimDevices(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", armsphere.ClaimDevicesRequest{ - DeviceIdentifiers: []*string{ - to.Ptr("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000")}, - }, 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/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostCountDevicesDeviceGroup.json -func ExampleDeviceGroupsClient_CountDevices() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDeviceGroupsClient().CountDevices(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", 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.CountDevicesResponse = armsphere.CountDevicesResponse{ - // Value: to.Ptr[int32](3), - // } -} diff --git a/sdk/resourcemanager/sphere/armsphere/devices_client.go b/sdk/resourcemanager/sphere/armsphere/devices_client.go index 68b193c28f30..62108fee831a 100644 --- a/sdk/resourcemanager/sphere/armsphere/devices_client.go +++ b/sdk/resourcemanager/sphere/armsphere/devices_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. @@ -101,7 +98,7 @@ func (client *DevicesClient) createOrUpdate(ctx context.Context, resourceGroupNa } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *DevicesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, deviceName string, resource Device, options *DevicesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *DevicesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, deviceName string, resource Device, _ *DevicesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -195,7 +192,7 @@ func (client *DevicesClient) deleteOperation(ctx context.Context, resourceGroupN } // deleteCreateRequest creates the Delete request. -func (client *DevicesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, deviceName string, options *DevicesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *DevicesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, deviceName string, _ *DevicesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -292,7 +289,7 @@ func (client *DevicesClient) generateCapabilityImage(ctx context.Context, resour } // generateCapabilityImageCreateRequest creates the GenerateCapabilityImage request. -func (client *DevicesClient) generateCapabilityImageCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, deviceName string, generateDeviceCapabilityRequest GenerateCapabilityImageRequest, options *DevicesClientBeginGenerateCapabilityImageOptions) (*policy.Request, error) { +func (client *DevicesClient) generateCapabilityImageCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, deviceName string, generateDeviceCapabilityRequest GenerateCapabilityImageRequest, _ *DevicesClientBeginGenerateCapabilityImageOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}/generateCapabilityImage" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -366,7 +363,7 @@ func (client *DevicesClient) Get(ctx context.Context, resourceGroupName string, } // getCreateRequest creates the Get request. -func (client *DevicesClient) getCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, deviceName string, options *DevicesClientGetOptions) (*policy.Request, error) { +func (client *DevicesClient) getCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, deviceName string, _ *DevicesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -446,7 +443,7 @@ func (client *DevicesClient) NewListByDeviceGroupPager(resourceGroupName string, } // listByDeviceGroupCreateRequest creates the ListByDeviceGroup request. -func (client *DevicesClient) listByDeviceGroupCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, options *DevicesClientListByDeviceGroupOptions) (*policy.Request, error) { +func (client *DevicesClient) listByDeviceGroupCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, _ *DevicesClientListByDeviceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -545,7 +542,7 @@ func (client *DevicesClient) update(ctx context.Context, resourceGroupName strin } // updateCreateRequest creates the Update request. -func (client *DevicesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, deviceName string, properties DeviceUpdate, options *DevicesClientBeginUpdateOptions) (*policy.Request, error) { +func (client *DevicesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, deviceName string, properties DeviceUpdate, _ *DevicesClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/deviceGroups/{deviceGroupName}/devices/{deviceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/sphere/armsphere/devices_client_example_test.go b/sdk/resourcemanager/sphere/armsphere/devices_client_example_test.go deleted file mode 100644 index fb3cdd91ebb0..000000000000 --- a/sdk/resourcemanager/sphere/armsphere/devices_client_example_test.go +++ /dev/null @@ -1,205 +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 armsphere_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/sphere/armsphere" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDevices.json -func ExampleDevicesClient_NewListByDeviceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDevicesClient().NewListByDeviceGroupPager("MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", 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.DeviceListResult = armsphere.DeviceListResult{ - // Value: []*armsphere.Device{ - // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/myProduct1/deviceGroups/myDeviceGroup1/devices/00000000-0000-0000-0000-000000000001"), - // Properties: &armsphere.DeviceProperties{ - // }, - // }, - // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/myProduct1/deviceGroups/myDeviceGroup1/devices/00000000-0000-0000-0000-000000000002"), - // Properties: &armsphere.DeviceProperties{ - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetDevice.json -func ExampleDevicesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDevicesClient().Get(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 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.Device = armsphere.Device{ - // Name: to.Ptr("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/myProduct1/deviceGroups/myDeviceGroup1/devices/00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"), - // Properties: &armsphere.DeviceProperties{ - // ChipSKU: to.Ptr("MyChipSku1"), - // LastAvailableOsVersion: to.Ptr("AvailableOsVersion1"), - // LastInstalledOsVersion: to.Ptr("InstalledOsVersion1"), - // LastOsUpdateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-09-30T23:54:21.960Z"); return t}()), - // LastUpdateRequestUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-01T23:54:21.960Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutDevice.json -func ExampleDevicesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDevicesClient().BeginCreateOrUpdate(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", armsphere.Device{}, 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.Device = armsphere.Device{ - // Name: to.Ptr("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/myProduct1/deviceGroups/myDeviceGroup1/devices/00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"), - // Properties: &armsphere.DeviceProperties{ - // ChipSKU: to.Ptr("MyChipSku1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PatchDevice.json -func ExampleDevicesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDevicesClient().BeginUpdate(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", "MyDeviceGroup1", "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", armsphere.DeviceUpdate{}, 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.Device = armsphere.Device{ - // Type: to.Ptr("Microsoft.AzureSphere/catalogs/products/devicegroups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct1/devicegroups/MyDeviceGroup1/device/00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"), - // Properties: &armsphere.DeviceProperties{ - // ChipSKU: to.Ptr("MyChipSku1"), - // LastAvailableOsVersion: to.Ptr("AvailableOsVersion1"), - // LastInstalledOsVersion: to.Ptr("InstalledOsVersion1"), - // LastOsUpdateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-30T23:54:21.960Z"); return t}()), - // LastUpdateRequestUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-10-01T23:54:21.960Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteDevice.json -func ExampleDevicesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDevicesClient().BeginDelete(ctx, "MyResourceGroup1", "MyCatalog1", "MyProductName1", "DeviceGroupName1", "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 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/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostGenerateDeviceCapabilityImage.json -func ExampleDevicesClient_BeginGenerateCapabilityImage() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewDevicesClient().BeginGenerateCapabilityImage(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", "myDeviceGroup1", "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", armsphere.GenerateCapabilityImageRequest{ - Capabilities: []*armsphere.CapabilityType{ - to.Ptr(armsphere.CapabilityTypeApplicationDevelopment)}, - }, 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.SignedCapabilityImageResponse = armsphere.SignedCapabilityImageResponse{ - // Image: to.Ptr("TheDeviceCapabilityImage"), - // } -} diff --git a/sdk/resourcemanager/sphere/armsphere/fake/catalogs_server.go b/sdk/resourcemanager/sphere/armsphere/fake/catalogs_server.go index 7e16f6ef9825..64f235fec5ce 100644 --- a/sdk/resourcemanager/sphere/armsphere/fake/catalogs_server.go +++ b/sdk/resourcemanager/sphere/armsphere/fake/catalogs_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. @@ -70,7 +67,7 @@ type CatalogsServer struct { Update func(ctx context.Context, resourceGroupName string, catalogName string, properties armsphere.CatalogUpdate, options *armsphere.CatalogsClientUpdateOptions) (resp azfake.Responder[armsphere.CatalogsClientUpdateResponse], errResp azfake.ErrorResponder) // BeginUploadImage is the fake for method CatalogsClient.BeginUploadImage - // HTTP status codes to indicate success: http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginUploadImage func(ctx context.Context, resourceGroupName string, catalogName string, uploadImageRequest armsphere.Image, options *armsphere.CatalogsClientBeginUploadImageOptions) (resp azfake.PollerResponder[armsphere.CatalogsClientUploadImageResponse], errResp azfake.ErrorResponder) } @@ -115,43 +112,62 @@ func (c *CatalogsServerTransport) 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 "CatalogsClient.CountDevices": - resp, err = c.dispatchCountDevices(req) - case "CatalogsClient.BeginCreateOrUpdate": - resp, err = c.dispatchBeginCreateOrUpdate(req) - case "CatalogsClient.BeginDelete": - resp, err = c.dispatchBeginDelete(req) - case "CatalogsClient.Get": - resp, err = c.dispatchGet(req) - case "CatalogsClient.NewListByResourceGroupPager": - resp, err = c.dispatchNewListByResourceGroupPager(req) - case "CatalogsClient.NewListBySubscriptionPager": - resp, err = c.dispatchNewListBySubscriptionPager(req) - case "CatalogsClient.NewListDeploymentsPager": - resp, err = c.dispatchNewListDeploymentsPager(req) - case "CatalogsClient.NewListDeviceGroupsPager": - resp, err = c.dispatchNewListDeviceGroupsPager(req) - case "CatalogsClient.NewListDeviceInsightsPager": - resp, err = c.dispatchNewListDeviceInsightsPager(req) - case "CatalogsClient.NewListDevicesPager": - resp, err = c.dispatchNewListDevicesPager(req) - case "CatalogsClient.Update": - resp, err = c.dispatchUpdate(req) - case "CatalogsClient.BeginUploadImage": - resp, err = c.dispatchBeginUploadImage(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return c.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (c *CatalogsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if catalogsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = catalogsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CatalogsClient.CountDevices": + res.resp, res.err = c.dispatchCountDevices(req) + case "CatalogsClient.BeginCreateOrUpdate": + res.resp, res.err = c.dispatchBeginCreateOrUpdate(req) + case "CatalogsClient.BeginDelete": + res.resp, res.err = c.dispatchBeginDelete(req) + case "CatalogsClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "CatalogsClient.NewListByResourceGroupPager": + res.resp, res.err = c.dispatchNewListByResourceGroupPager(req) + case "CatalogsClient.NewListBySubscriptionPager": + res.resp, res.err = c.dispatchNewListBySubscriptionPager(req) + case "CatalogsClient.NewListDeploymentsPager": + res.resp, res.err = c.dispatchNewListDeploymentsPager(req) + case "CatalogsClient.NewListDeviceGroupsPager": + res.resp, res.err = c.dispatchNewListDeviceGroupsPager(req) + case "CatalogsClient.NewListDeviceInsightsPager": + res.resp, res.err = c.dispatchNewListDeviceInsightsPager(req) + case "CatalogsClient.NewListDevicesPager": + res.resp, res.err = c.dispatchNewListDevicesPager(req) + case "CatalogsClient.Update": + res.resp, res.err = c.dispatchUpdate(req) + case "CatalogsClient.BeginUploadImage": + res.resp, res.err = c.dispatchBeginUploadImage(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 (c *CatalogsServerTransport) dispatchCountDevices(req *http.Request) (*http.Response, error) { @@ -852,9 +868,9 @@ func (c *CatalogsServerTransport) dispatchBeginUploadImage(req *http.Request) (* return nil, err } - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginUploadImage.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginUploadImage) { c.beginUploadImage.remove(req) @@ -862,3 +878,9 @@ func (c *CatalogsServerTransport) dispatchBeginUploadImage(req *http.Request) (* return resp, nil } + +// set this to conditionally intercept incoming requests to CatalogsServerTransport +var catalogsServerTransportInterceptor 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/sphere/armsphere/fake/certificates_server.go b/sdk/resourcemanager/sphere/armsphere/fake/certificates_server.go index 7b3c76036d9a..1bb3173cf4a4 100644 --- a/sdk/resourcemanager/sphere/armsphere/fake/certificates_server.go +++ b/sdk/resourcemanager/sphere/armsphere/fake/certificates_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. @@ -67,27 +64,46 @@ func (c *CertificatesServerTransport) Do(req *http.Request) (*http.Response, err return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return c.dispatchToMethodFake(req, method) +} - switch method { - case "CertificatesClient.Get": - resp, err = c.dispatchGet(req) - case "CertificatesClient.NewListByCatalogPager": - resp, err = c.dispatchNewListByCatalogPager(req) - case "CertificatesClient.RetrieveCertChain": - resp, err = c.dispatchRetrieveCertChain(req) - case "CertificatesClient.RetrieveProofOfPossessionNonce": - resp, err = c.dispatchRetrieveProofOfPossessionNonce(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (c *CertificatesServerTransport) 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 certificatesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = certificatesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CertificatesClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "CertificatesClient.NewListByCatalogPager": + res.resp, res.err = c.dispatchNewListByCatalogPager(req) + case "CertificatesClient.RetrieveCertChain": + res.resp, res.err = c.dispatchRetrieveCertChain(req) + case "CertificatesClient.RetrieveProofOfPossessionNonce": + res.resp, res.err = c.dispatchRetrieveProofOfPossessionNonce(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 (c *CertificatesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -302,3 +318,9 @@ func (c *CertificatesServerTransport) dispatchRetrieveProofOfPossessionNonce(req } return resp, nil } + +// set this to conditionally intercept incoming requests to CertificatesServerTransport +var certificatesServerTransportInterceptor 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/sphere/armsphere/fake/deployments_server.go b/sdk/resourcemanager/sphere/armsphere/fake/deployments_server.go index 952b20f0ed35..04dcfb3e00f2 100644 --- a/sdk/resourcemanager/sphere/armsphere/fake/deployments_server.go +++ b/sdk/resourcemanager/sphere/armsphere/fake/deployments_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. @@ -71,27 +68,46 @@ func (d *DeploymentsServerTransport) Do(req *http.Request) (*http.Response, erro return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return d.dispatchToMethodFake(req, method) +} - switch method { - case "DeploymentsClient.BeginCreateOrUpdate": - resp, err = d.dispatchBeginCreateOrUpdate(req) - case "DeploymentsClient.BeginDelete": - resp, err = d.dispatchBeginDelete(req) - case "DeploymentsClient.Get": - resp, err = d.dispatchGet(req) - case "DeploymentsClient.NewListByDeviceGroupPager": - resp, err = d.dispatchNewListByDeviceGroupPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (d *DeploymentsServerTransport) 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 deploymentsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = deploymentsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DeploymentsClient.BeginCreateOrUpdate": + res.resp, res.err = d.dispatchBeginCreateOrUpdate(req) + case "DeploymentsClient.BeginDelete": + res.resp, res.err = d.dispatchBeginDelete(req) + case "DeploymentsClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DeploymentsClient.NewListByDeviceGroupPager": + res.resp, res.err = d.dispatchNewListByDeviceGroupPager(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 (d *DeploymentsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -360,3 +376,9 @@ func (d *DeploymentsServerTransport) dispatchNewListByDeviceGroupPager(req *http } return resp, nil } + +// set this to conditionally intercept incoming requests to DeploymentsServerTransport +var deploymentsServerTransportInterceptor 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/sphere/armsphere/fake/devicegroups_server.go b/sdk/resourcemanager/sphere/armsphere/fake/devicegroups_server.go index 2901e2957dff..8f71a0f47a07 100644 --- a/sdk/resourcemanager/sphere/armsphere/fake/devicegroups_server.go +++ b/sdk/resourcemanager/sphere/armsphere/fake/devicegroups_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. @@ -26,7 +23,7 @@ import ( // DeviceGroupsServer is a fake server for instances of the armsphere.DeviceGroupsClient type. type DeviceGroupsServer struct { // BeginClaimDevices is the fake for method DeviceGroupsClient.BeginClaimDevices - // HTTP status codes to indicate success: http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginClaimDevices func(ctx context.Context, resourceGroupName string, catalogName string, productName string, deviceGroupName string, claimDevicesRequest armsphere.ClaimDevicesRequest, options *armsphere.DeviceGroupsClientBeginClaimDevicesOptions) (resp azfake.PollerResponder[armsphere.DeviceGroupsClientClaimDevicesResponse], errResp azfake.ErrorResponder) // CountDevices is the fake for method DeviceGroupsClient.CountDevices @@ -87,33 +84,52 @@ func (d *DeviceGroupsServerTransport) Do(req *http.Request) (*http.Response, err return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "DeviceGroupsClient.BeginClaimDevices": - resp, err = d.dispatchBeginClaimDevices(req) - case "DeviceGroupsClient.CountDevices": - resp, err = d.dispatchCountDevices(req) - case "DeviceGroupsClient.BeginCreateOrUpdate": - resp, err = d.dispatchBeginCreateOrUpdate(req) - case "DeviceGroupsClient.BeginDelete": - resp, err = d.dispatchBeginDelete(req) - case "DeviceGroupsClient.Get": - resp, err = d.dispatchGet(req) - case "DeviceGroupsClient.NewListByProductPager": - resp, err = d.dispatchNewListByProductPager(req) - case "DeviceGroupsClient.BeginUpdate": - resp, err = d.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return d.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (d *DeviceGroupsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if deviceGroupsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = deviceGroupsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DeviceGroupsClient.BeginClaimDevices": + res.resp, res.err = d.dispatchBeginClaimDevices(req) + case "DeviceGroupsClient.CountDevices": + res.resp, res.err = d.dispatchCountDevices(req) + case "DeviceGroupsClient.BeginCreateOrUpdate": + res.resp, res.err = d.dispatchBeginCreateOrUpdate(req) + case "DeviceGroupsClient.BeginDelete": + res.resp, res.err = d.dispatchBeginDelete(req) + case "DeviceGroupsClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DeviceGroupsClient.NewListByProductPager": + res.resp, res.err = d.dispatchNewListByProductPager(req) + case "DeviceGroupsClient.BeginUpdate": + res.resp, res.err = d.dispatchBeginUpdate(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 (d *DeviceGroupsServerTransport) dispatchBeginClaimDevices(req *http.Request) (*http.Response, error) { @@ -161,9 +177,9 @@ func (d *DeviceGroupsServerTransport) dispatchBeginClaimDevices(req *http.Reques return nil, err } - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { d.beginClaimDevices.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginClaimDevices) { d.beginClaimDevices.remove(req) @@ -519,3 +535,9 @@ func (d *DeviceGroupsServerTransport) dispatchBeginUpdate(req *http.Request) (*h return resp, nil } + +// set this to conditionally intercept incoming requests to DeviceGroupsServerTransport +var deviceGroupsServerTransportInterceptor 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/sphere/armsphere/fake/devices_server.go b/sdk/resourcemanager/sphere/armsphere/fake/devices_server.go index 7d63b82885f2..779a341383d8 100644 --- a/sdk/resourcemanager/sphere/armsphere/fake/devices_server.go +++ b/sdk/resourcemanager/sphere/armsphere/fake/devices_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. @@ -82,31 +79,50 @@ func (d *DevicesServerTransport) 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 "DevicesClient.BeginCreateOrUpdate": - resp, err = d.dispatchBeginCreateOrUpdate(req) - case "DevicesClient.BeginDelete": - resp, err = d.dispatchBeginDelete(req) - case "DevicesClient.BeginGenerateCapabilityImage": - resp, err = d.dispatchBeginGenerateCapabilityImage(req) - case "DevicesClient.Get": - resp, err = d.dispatchGet(req) - case "DevicesClient.NewListByDeviceGroupPager": - resp, err = d.dispatchNewListByDeviceGroupPager(req) - case "DevicesClient.BeginUpdate": - resp, err = d.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return d.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err +func (d *DevicesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if devicesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = devicesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DevicesClient.BeginCreateOrUpdate": + res.resp, res.err = d.dispatchBeginCreateOrUpdate(req) + case "DevicesClient.BeginDelete": + res.resp, res.err = d.dispatchBeginDelete(req) + case "DevicesClient.BeginGenerateCapabilityImage": + res.resp, res.err = d.dispatchBeginGenerateCapabilityImage(req) + case "DevicesClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DevicesClient.NewListByDeviceGroupPager": + res.resp, res.err = d.dispatchNewListByDeviceGroupPager(req) + case "DevicesClient.BeginUpdate": + res.resp, res.err = d.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 } - - return resp, nil } func (d *DevicesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -438,3 +454,9 @@ func (d *DevicesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.R return resp, nil } + +// set this to conditionally intercept incoming requests to DevicesServerTransport +var devicesServerTransportInterceptor 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/sphere/armsphere/fake/images_server.go b/sdk/resourcemanager/sphere/armsphere/fake/images_server.go index e5e1fbea3054..0d3f02717754 100644 --- a/sdk/resourcemanager/sphere/armsphere/fake/images_server.go +++ b/sdk/resourcemanager/sphere/armsphere/fake/images_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. @@ -71,27 +68,46 @@ func (i *ImagesServerTransport) 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 i.dispatchToMethodFake(req, method) +} - switch method { - case "ImagesClient.BeginCreateOrUpdate": - resp, err = i.dispatchBeginCreateOrUpdate(req) - case "ImagesClient.BeginDelete": - resp, err = i.dispatchBeginDelete(req) - case "ImagesClient.Get": - resp, err = i.dispatchGet(req) - case "ImagesClient.NewListByCatalogPager": - resp, err = i.dispatchNewListByCatalogPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (i *ImagesServerTransport) 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 imagesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = imagesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ImagesClient.BeginCreateOrUpdate": + res.resp, res.err = i.dispatchBeginCreateOrUpdate(req) + case "ImagesClient.BeginDelete": + res.resp, res.err = i.dispatchBeginDelete(req) + case "ImagesClient.Get": + res.resp, res.err = i.dispatchGet(req) + case "ImagesClient.NewListByCatalogPager": + res.resp, res.err = i.dispatchNewListByCatalogPager(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 (i *ImagesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -328,3 +344,9 @@ func (i *ImagesServerTransport) dispatchNewListByCatalogPager(req *http.Request) } return resp, nil } + +// set this to conditionally intercept incoming requests to ImagesServerTransport +var imagesServerTransportInterceptor 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/sphere/armsphere/fake/internal.go b/sdk/resourcemanager/sphere/armsphere/fake/internal.go index 7d2f89ba4bb2..c614f8d5643a 100644 --- a/sdk/resourcemanager/sphere/armsphere/fake/internal.go +++ b/sdk/resourcemanager/sphere/armsphere/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. @@ -15,6 +12,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/sphere/armsphere/fake/operations_server.go b/sdk/resourcemanager/sphere/armsphere/fake/operations_server.go index 367ae6919bae..a1834ea30a77 100644 --- a/sdk/resourcemanager/sphere/armsphere/fake/operations_server.go +++ b/sdk/resourcemanager/sphere/armsphere/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. @@ -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/sphere/armsphere/fake/products_server.go b/sdk/resourcemanager/sphere/armsphere/fake/products_server.go index 57798885dfb4..ed497c1a3237 100644 --- a/sdk/resourcemanager/sphere/armsphere/fake/products_server.go +++ b/sdk/resourcemanager/sphere/armsphere/fake/products_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. @@ -86,33 +83,52 @@ func (p *ProductsServerTransport) 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 "ProductsClient.CountDevices": - resp, err = p.dispatchCountDevices(req) - case "ProductsClient.BeginCreateOrUpdate": - resp, err = p.dispatchBeginCreateOrUpdate(req) - case "ProductsClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "ProductsClient.NewGenerateDefaultDeviceGroupsPager": - resp, err = p.dispatchNewGenerateDefaultDeviceGroupsPager(req) - case "ProductsClient.Get": - resp, err = p.dispatchGet(req) - case "ProductsClient.NewListByCatalogPager": - resp, err = p.dispatchNewListByCatalogPager(req) - case "ProductsClient.BeginUpdate": - resp, err = p.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return p.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (p *ProductsServerTransport) 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 productsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = productsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ProductsClient.CountDevices": + res.resp, res.err = p.dispatchCountDevices(req) + case "ProductsClient.BeginCreateOrUpdate": + res.resp, res.err = p.dispatchBeginCreateOrUpdate(req) + case "ProductsClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "ProductsClient.NewGenerateDefaultDeviceGroupsPager": + res.resp, res.err = p.dispatchNewGenerateDefaultDeviceGroupsPager(req) + case "ProductsClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "ProductsClient.NewListByCatalogPager": + res.resp, res.err = p.dispatchNewListByCatalogPager(req) + case "ProductsClient.BeginUpdate": + res.resp, res.err = p.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 (p *ProductsServerTransport) dispatchCountDevices(req *http.Request) (*http.Response, error) { @@ -426,3 +442,9 @@ func (p *ProductsServerTransport) dispatchBeginUpdate(req *http.Request) (*http. return resp, nil } + +// set this to conditionally intercept incoming requests to ProductsServerTransport +var productsServerTransportInterceptor 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/sphere/armsphere/fake/server_factory.go b/sdk/resourcemanager/sphere/armsphere/fake/server_factory.go index a9162f8a752b..159e438ddd0e 100644 --- a/sdk/resourcemanager/sphere/armsphere/fake/server_factory.go +++ b/sdk/resourcemanager/sphere/armsphere/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,14 +16,29 @@ import ( // ServerFactory is a fake server for instances of the armsphere.ClientFactory type. type ServerFactory struct { - CatalogsServer CatalogsServer + // CatalogsServer contains the fakes for client CatalogsClient + CatalogsServer CatalogsServer + + // CertificatesServer contains the fakes for client CertificatesClient CertificatesServer CertificatesServer - DeploymentsServer DeploymentsServer + + // DeploymentsServer contains the fakes for client DeploymentsClient + DeploymentsServer DeploymentsServer + + // DeviceGroupsServer contains the fakes for client DeviceGroupsClient DeviceGroupsServer DeviceGroupsServer - DevicesServer DevicesServer - ImagesServer ImagesServer - OperationsServer OperationsServer - ProductsServer ProductsServer + + // DevicesServer contains the fakes for client DevicesClient + DevicesServer DevicesServer + + // ImagesServer contains the fakes for client ImagesClient + ImagesServer ImagesServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // ProductsServer contains the fakes for client ProductsClient + ProductsServer ProductsServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. diff --git a/sdk/resourcemanager/sphere/armsphere/fake/time_rfc3339.go b/sdk/resourcemanager/sphere/armsphere/fake/time_rfc3339.go deleted file mode 100644 index 81f308b0d343..000000000000 --- a/sdk/resourcemanager/sphere/armsphere/fake/time_rfc3339.go +++ /dev/null @@ -1,110 +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 ( - utcDateTime = "2006-01-02T15:04:05.999999999" - utcDateTimeJSON = `"` + utcDateTime + `"` - utcDateTimeNoT = "2006-01-02 15:04:05.999999999" - utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` - dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` - dateTimeJSON = `"` + time.RFC3339Nano + `"` - dateTimeJSONNoT = `"` + dateTimeNoT + `"` -) - -type dateTimeRFC3339 time.Time - -func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalJSON() -} - -func (t dateTimeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalText() -} - -func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = dateTimeJSON - } else if tzOffset { - layout = dateTimeJSONNoT - } else if hasT { - layout = utcDateTimeJSON - } else { - layout = utcDateTimeJSONNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = time.RFC3339Nano - } else if tzOffset { - layout = dateTimeNoT - } else if hasT { - layout = utcDateTime - } else { - layout = utcDateTimeNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = dateTimeRFC3339(p) - return err -} - -func (t dateTimeRFC3339) String() string { - return time.Time(t).Format(time.RFC3339Nano) -} - -func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*dateTimeRFC3339)(t) -} - -func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || string(data) == "null" { - return nil - } - var aux dateTimeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/sphere/armsphere/go.mod b/sdk/resourcemanager/sphere/armsphere/go.mod index ff65d7d22c44..eb8ac48e967c 100644 --- a/sdk/resourcemanager/sphere/armsphere/go.mod +++ b/sdk/resourcemanager/sphere/armsphere/go.mod @@ -2,20 +2,10 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sphere/armsphere 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 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 // indirect - github.com/golang-jwt/jwt/v5 v5.2.2 // indirect - github.com/google/uuid v1.6.0 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.36.0 // indirect golang.org/x/net v0.38.0 // indirect - golang.org/x/sys v0.31.0 // indirect golang.org/x/text v0.23.0 // indirect ) diff --git a/sdk/resourcemanager/sphere/armsphere/go.sum b/sdk/resourcemanager/sphere/armsphere/go.sum index 4bacf756f06c..4de695d9e23a 100644 --- a/sdk/resourcemanager/sphere/armsphere/go.sum +++ b/sdk/resourcemanager/sphere/armsphere/go.sum @@ -1,44 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 h1:DSDNVxqkoXJiko6x8a90zidoYqnYYa6c1MTzDKzKkTo= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1/go.mod h1:zGqV2R4Cr/k8Uye5w+dgQ06WJtEcbQG/8J7BB6hnCr4= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 h1:F0gBpfdPLGsw+nsgk6aqqkZS1jiixa5WwFe3fk/T3Ys= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2/go.mod h1:SqINnQ9lVVdRlyC8cd1lCI0SdX4n2paeABd2K8ggfnE= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2 h1:yz1bePFlP5Vws5+8ez6T3HWXPmwOK7Yvq8QxDBD3SKY= -github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2/go.mod h1:Pa9ZNPuoNu/GztvBSKk9J1cDJW6vk/n0zLtV4mgd8N8= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= -github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= -github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 h1:oygO0locgZJe7PpYPXT5A29ZkwJaPqcva7BVeemZOZs= -github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= -github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= -github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= -github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= -github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8= -github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= -github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6 h1:IsMZxCuZqKuao2vNdfD82fjjgPLfyHLpR41Z88viRWs= -github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6/go.mod h1:3VeWNIJaW+O5xpRQbPp0Ybqu1vJd/pm7s2F473HRrkw= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= -github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/redis/go-redis/v9 v9.7.0 h1:HhLSs+B6O021gwzl+locl0zEDnyNkxMtf/Z3NNBMa9E= -github.com/redis/go-redis/v9 v9.7.0/go.mod h1:f6zhXITC7JUJIlPEiBOTXxJgPLdZcA93GewI7inzyWw= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= -golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= -golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= -golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/sphere/armsphere/images_client.go b/sdk/resourcemanager/sphere/armsphere/images_client.go index 1c8454eca2c3..60022ff78a10 100644 --- a/sdk/resourcemanager/sphere/armsphere/images_client.go +++ b/sdk/resourcemanager/sphere/armsphere/images_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. @@ -98,7 +95,7 @@ func (client *ImagesClient) createOrUpdate(ctx context.Context, resourceGroupNam } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ImagesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, imageName string, resource Image, options *ImagesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ImagesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, imageName string, resource Image, _ *ImagesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -182,7 +179,7 @@ func (client *ImagesClient) deleteOperation(ctx context.Context, resourceGroupNa } // deleteCreateRequest creates the Delete request. -func (client *ImagesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, imageName string, options *ImagesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ImagesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, imageName string, _ *ImagesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -242,7 +239,7 @@ func (client *ImagesClient) Get(ctx context.Context, resourceGroupName string, c } // getCreateRequest creates the Get request. -func (client *ImagesClient) getCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, imageName string, options *ImagesClientGetOptions) (*policy.Request, error) { +func (client *ImagesClient) getCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, imageName string, _ *ImagesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/images/{imageName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/sphere/armsphere/images_client_example_test.go b/sdk/resourcemanager/sphere/armsphere/images_client_example_test.go deleted file mode 100644 index 92f608e3b555..000000000000 --- a/sdk/resourcemanager/sphere/armsphere/images_client_example_test.go +++ /dev/null @@ -1,135 +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 armsphere_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/sphere/armsphere" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetImages.json -func ExampleImagesClient_NewListByCatalogPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewImagesClient().NewListByCatalogPager("MyResourceGroup1", "MyCatalog1", &armsphere.ImagesClientListByCatalogOptions{Filter: nil, - Top: nil, - Skip: nil, - Maxpagesize: 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.ImageListResult = armsphere.ImageListResult{ - // Value: []*armsphere.Image{ - // { - // Name: to.Ptr("MyImage1"), - // ID: to.Ptr("00000000-0000-0000-0000-000000000001"), - // }, - // { - // Name: to.Ptr("MyImage2"), - // ID: to.Ptr("00000000-0000-0000-0000-000000000002"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetImage.json -func ExampleImagesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewImagesClient().Get(ctx, "MyResourceGroup1", "MyCatalog1", "00000000-0000-0000-0000-000000000000", 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.Image = armsphere.Image{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutImage.json -func ExampleImagesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().BeginCreateOrUpdate(ctx, "MyResourceGroup1", "MyCatalog1", "00000000-0000-0000-0000-000000000000", armsphere.Image{ - Properties: &armsphere.ImageProperties{ - Image: to.Ptr("bXliYXNlNjRzdHJpbmc="), - }, - }, 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.Image = armsphere.Image{ - // Name: to.Ptr("MyProduct1"), - // Type: to.Ptr("Microsoft.AzureSphere/catalogs/images"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/images/default"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteImage.json -func ExampleImagesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewImagesClient().BeginDelete(ctx, "MyResourceGroup1", "MyCatalog1", "00000000-0000-0000-0000-000000000000", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/sphere/armsphere/models.go b/sdk/resourcemanager/sphere/armsphere/models.go index 13b001b86d90..ca0831c5f303 100644 --- a/sdk/resourcemanager/sphere/armsphere/models.go +++ b/sdk/resourcemanager/sphere/armsphere/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. @@ -39,7 +36,7 @@ type CatalogListResult struct { // REQUIRED; The Catalog items on this page Value []*Catalog - // READ-ONLY; The link to the next page of items + // The link to the next page of items NextLink *string } @@ -87,7 +84,7 @@ type CertificateListResult struct { // REQUIRED; The Certificate items on this page Value []*Certificate - // READ-ONLY; The link to the next page of items + // The link to the next page of items NextLink *string } @@ -150,7 +147,7 @@ type DeploymentListResult struct { // REQUIRED; The Deployment items on this page Value []*Deployment - // READ-ONLY; The link to the next page of items + // The link to the next page of items NextLink *string } @@ -210,7 +207,7 @@ type DeviceGroupListResult struct { // REQUIRED; The DeviceGroup items on this page Value []*DeviceGroup - // READ-ONLY; The link to the next page of items + // The link to the next page of items NextLink *string } @@ -294,7 +291,7 @@ type DeviceListResult struct { // REQUIRED; The Device items on this page Value []*Device - // READ-ONLY; The link to the next page of items + // The link to the next page of items NextLink *string } @@ -363,7 +360,7 @@ type ImageListResult struct { // REQUIRED; The Image items on this page Value []*Image - // READ-ONLY; The link to the next page of items + // The link to the next page of items NextLink *string } @@ -457,7 +454,7 @@ type PagedDeviceInsight struct { // REQUIRED; The DeviceInsight items on this page Value []*DeviceInsight - // READ-ONLY; The link to the next page of items + // The link to the next page of items NextLink *string } @@ -484,7 +481,7 @@ type ProductListResult struct { // REQUIRED; The Product items on this page Value []*Product - // READ-ONLY; The link to the next page of items + // The link to the next page of items NextLink *string } diff --git a/sdk/resourcemanager/sphere/armsphere/models_serde.go b/sdk/resourcemanager/sphere/armsphere/models_serde.go index c49cec96c9cd..6c5ba1b7f57b 100644 --- a/sdk/resourcemanager/sphere/armsphere/models_serde.go +++ b/sdk/resourcemanager/sphere/armsphere/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. diff --git a/sdk/resourcemanager/sphere/armsphere/operations_client.go b/sdk/resourcemanager/sphere/armsphere/operations_client.go index e0215a5bc98a..94f2ba464e4d 100644 --- a/sdk/resourcemanager/sphere/armsphere/operations_client.go +++ b/sdk/resourcemanager/sphere/armsphere/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. @@ -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.AzureSphere/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { diff --git a/sdk/resourcemanager/sphere/armsphere/operations_client_example_test.go b/sdk/resourcemanager/sphere/armsphere/operations_client_example_test.go deleted file mode 100644 index 40ab897e0e76..000000000000 --- a/sdk/resourcemanager/sphere/armsphere/operations_client_example_test.go +++ /dev/null @@ -1,64 +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 armsphere_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sphere/armsphere" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetOperations.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 := armsphere.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 = armsphere.OperationListResult{ - // Value: []*armsphere.Operation{ - // { - // Name: to.Ptr("Microsoft.AzureSphere/catalogs/Read"), - // Display: &armsphere.OperationDisplay{ - // Description: to.Ptr("Read Azure Sphere catalogs"), - // Operation: to.Ptr("Gets/List catalog"), - // Provider: to.Ptr("Microsoft.AzureSphere"), - // Resource: to.Ptr("catalog"), - // }, - // }, - // { - // Name: to.Ptr("Microsoft.AzureSphere/catalogs/Write"), - // Display: &armsphere.OperationDisplay{ - // Description: to.Ptr("Writes Azure Sphere catalogs"), - // Operation: to.Ptr("Create/Update catalog"), - // Provider: to.Ptr("Microsoft.AzureSphere"), - // Resource: to.Ptr("catalog"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sphere/armsphere/options.go b/sdk/resourcemanager/sphere/armsphere/options.go index b82a998dc3a7..3310b1ec8570 100644 --- a/sdk/resourcemanager/sphere/armsphere/options.go +++ b/sdk/resourcemanager/sphere/armsphere/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. @@ -10,19 +7,19 @@ package armsphere // CatalogsClientBeginCreateOrUpdateOptions contains the optional parameters for the CatalogsClient.BeginCreateOrUpdate method. type CatalogsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // CatalogsClientBeginDeleteOptions contains the optional parameters for the CatalogsClient.BeginDelete method. type CatalogsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // CatalogsClientBeginUploadImageOptions contains the optional parameters for the CatalogsClient.BeginUploadImage method. type CatalogsClientBeginUploadImageOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -151,13 +148,13 @@ type CertificatesClientRetrieveProofOfPossessionNonceOptions struct { // DeploymentsClientBeginCreateOrUpdateOptions contains the optional parameters for the DeploymentsClient.BeginCreateOrUpdate // method. type DeploymentsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // DeploymentsClientBeginDeleteOptions contains the optional parameters for the DeploymentsClient.BeginDelete method. type DeploymentsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -185,26 +182,26 @@ type DeploymentsClientListByDeviceGroupOptions struct { // DeviceGroupsClientBeginClaimDevicesOptions contains the optional parameters for the DeviceGroupsClient.BeginClaimDevices // method. type DeviceGroupsClientBeginClaimDevicesOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // DeviceGroupsClientBeginCreateOrUpdateOptions contains the optional parameters for the DeviceGroupsClient.BeginCreateOrUpdate // method. type DeviceGroupsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // DeviceGroupsClientBeginDeleteOptions contains the optional parameters for the DeviceGroupsClient.BeginDelete method. type DeviceGroupsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // DeviceGroupsClientBeginUpdateOptions contains the optional parameters for the DeviceGroupsClient.BeginUpdate method. type DeviceGroupsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -236,26 +233,26 @@ type DeviceGroupsClientListByProductOptions struct { // DevicesClientBeginCreateOrUpdateOptions contains the optional parameters for the DevicesClient.BeginCreateOrUpdate method. type DevicesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // DevicesClientBeginDeleteOptions contains the optional parameters for the DevicesClient.BeginDelete method. type DevicesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // DevicesClientBeginGenerateCapabilityImageOptions contains the optional parameters for the DevicesClient.BeginGenerateCapabilityImage // method. type DevicesClientBeginGenerateCapabilityImageOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // DevicesClientBeginUpdateOptions contains the optional parameters for the DevicesClient.BeginUpdate method. type DevicesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -272,13 +269,13 @@ type DevicesClientListByDeviceGroupOptions struct { // ImagesClientBeginCreateOrUpdateOptions contains the optional parameters for the ImagesClient.BeginCreateOrUpdate method. type ImagesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ImagesClientBeginDeleteOptions contains the optional parameters for the ImagesClient.BeginDelete method. type ImagesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -309,19 +306,19 @@ type OperationsClientListOptions struct { // ProductsClientBeginCreateOrUpdateOptions contains the optional parameters for the ProductsClient.BeginCreateOrUpdate method. type ProductsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ProductsClientBeginDeleteOptions contains the optional parameters for the ProductsClient.BeginDelete method. type ProductsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ProductsClientBeginUpdateOptions contains the optional parameters for the ProductsClient.BeginUpdate method. type ProductsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } diff --git a/sdk/resourcemanager/sphere/armsphere/products_client.go b/sdk/resourcemanager/sphere/armsphere/products_client.go index f8a2f6a78b4c..ffe18d92a376 100644 --- a/sdk/resourcemanager/sphere/armsphere/products_client.go +++ b/sdk/resourcemanager/sphere/armsphere/products_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. @@ -75,7 +72,7 @@ func (client *ProductsClient) CountDevices(ctx context.Context, resourceGroupNam } // countDevicesCreateRequest creates the CountDevices request. -func (client *ProductsClient) countDevicesCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, options *ProductsClientCountDevicesOptions) (*policy.Request, error) { +func (client *ProductsClient) countDevicesCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, _ *ProductsClientCountDevicesOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/countDevices" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -169,7 +166,7 @@ func (client *ProductsClient) createOrUpdate(ctx context.Context, resourceGroupN } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ProductsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, resource Product, options *ProductsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ProductsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, resource Product, _ *ProductsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -253,7 +250,7 @@ func (client *ProductsClient) deleteOperation(ctx context.Context, resourceGroup } // deleteCreateRequest creates the Delete request. -func (client *ProductsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, options *ProductsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ProductsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, _ *ProductsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -315,7 +312,7 @@ func (client *ProductsClient) NewGenerateDefaultDeviceGroupsPager(resourceGroupN } // generateDefaultDeviceGroupsCreateRequest creates the GenerateDefaultDeviceGroups request. -func (client *ProductsClient) generateDefaultDeviceGroupsCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, options *ProductsClientGenerateDefaultDeviceGroupsOptions) (*policy.Request, error) { +func (client *ProductsClient) generateDefaultDeviceGroupsCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, _ *ProductsClientGenerateDefaultDeviceGroupsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}/generateDefaultDeviceGroups" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -384,7 +381,7 @@ func (client *ProductsClient) Get(ctx context.Context, resourceGroupName string, } // getCreateRequest creates the Get request. -func (client *ProductsClient) getCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, options *ProductsClientGetOptions) (*policy.Request, error) { +func (client *ProductsClient) getCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, _ *ProductsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -453,7 +450,7 @@ func (client *ProductsClient) NewListByCatalogPager(resourceGroupName string, ca } // listByCatalogCreateRequest creates the ListByCatalog request. -func (client *ProductsClient) listByCatalogCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, options *ProductsClientListByCatalogOptions) (*policy.Request, error) { +func (client *ProductsClient) listByCatalogCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, _ *ProductsClientListByCatalogOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -540,7 +537,7 @@ func (client *ProductsClient) update(ctx context.Context, resourceGroupName stri } // updateCreateRequest creates the Update request. -func (client *ProductsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, properties ProductUpdate, options *ProductsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *ProductsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, catalogName string, productName string, properties ProductUpdate, _ *ProductsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureSphere/catalogs/{catalogName}/products/{productName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/sphere/armsphere/products_client_example_test.go b/sdk/resourcemanager/sphere/armsphere/products_client_example_test.go deleted file mode 100644 index d93c3e9cb565..000000000000 --- a/sdk/resourcemanager/sphere/armsphere/products_client_example_test.go +++ /dev/null @@ -1,235 +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 armsphere_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sphere/armsphere" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetProducts.json -func ExampleProductsClient_NewListByCatalogPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProductsClient().NewListByCatalogPager("MyResourceGroup1", "MyCatalog1", 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.ProductListResult = armsphere.ProductListResult{ - // Value: []*armsphere.Product{ - // { - // Name: to.Ptr("MyProduct1"), - // Type: to.Ptr("Microsoft.AzureSphere/catalogs/products"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct1"), - // }, - // { - // Name: to.Ptr("MyProduct2"), - // Type: to.Ptr("Microsoft.AzureSphere/catalogs/products"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct2"), - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/GetProduct.json -func ExampleProductsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProductsClient().Get(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", 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.Product = armsphere.Product{ - // Type: to.Ptr("microsoft.azureSphere/catalogs/products"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct1"), - // Properties: &armsphere.ProductProperties{ - // Description: to.Ptr("product description."), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PutProduct.json -func ExampleProductsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProductsClient().BeginCreateOrUpdate(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", armsphere.Product{}, 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.Product = armsphere.Product{ - // Name: to.Ptr("MyProduct1"), - // Type: to.Ptr("Microsoft.AzureSphere/catalogs/products"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct1"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PatchProduct.json -func ExampleProductsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProductsClient().BeginUpdate(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", armsphere.ProductUpdate{}, 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.Product = armsphere.Product{ - // Type: to.Ptr("microsoft.azureSphere/catalogs/products"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct1"), - // Properties: &armsphere.ProductProperties{ - // Description: to.Ptr("Product description."), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/DeleteProduct.json -func ExampleProductsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProductsClient().BeginDelete(ctx, "MyResourceGroup1", "MyCatalog1", "MyProductName1", 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/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostCountDevicesProduct.json -func ExampleProductsClient_CountDevices() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProductsClient().CountDevices(ctx, "MyResourceGroup1", "MyCatalog1", "MyProduct1", 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.CountDevicesResponse = armsphere.CountDevicesResponse{ - // Value: to.Ptr[int32](3), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/09c37754dac91874ff689ed1e60effb4268c8669/specification/sphere/resource-manager/Microsoft.AzureSphere/stable/2024-04-01/examples/PostGenerateDefaultDeviceGroups.json -func ExampleProductsClient_NewGenerateDefaultDeviceGroupsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsphere.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewProductsClient().NewGenerateDefaultDeviceGroupsPager("MyResourceGroup1", "MyCatalog1", "MyProduct1", 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.DeviceGroupListResult = armsphere.DeviceGroupListResult{ - // Value: []*armsphere.DeviceGroup{ - // { - // Name: to.Ptr("MyDeviceGroup1"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct1/devicegroups/MyDeviceGroup1"), - // Properties: &armsphere.DeviceGroupProperties{ - // Description: to.Ptr("Device group description 1"), - // AllowCrashDumpsCollection: to.Ptr(armsphere.AllowCrashDumpCollectionEnabled), - // OSFeedType: to.Ptr(armsphere.OSFeedTypeRetail), - // UpdatePolicy: to.Ptr(armsphere.UpdatePolicyUpdateAll), - // }, - // }, - // { - // Name: to.Ptr("MyDeviceGroup2"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/MyResourceGroup1/providers/Microsoft.AzureSphere/catalogs/MyCatalog1/products/MyProduct1/devicegroups/MyDeviceGroup2"), - // Properties: &armsphere.DeviceGroupProperties{ - // Description: to.Ptr("Device group description 2"), - // AllowCrashDumpsCollection: to.Ptr(armsphere.AllowCrashDumpCollectionEnabled), - // OSFeedType: to.Ptr(armsphere.OSFeedTypeRetail), - // UpdatePolicy: to.Ptr(armsphere.UpdatePolicyUpdateAll), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/sphere/armsphere/responses.go b/sdk/resourcemanager/sphere/armsphere/responses.go index 99f13c135c0d..11ca38e7a170 100644 --- a/sdk/resourcemanager/sphere/armsphere/responses.go +++ b/sdk/resourcemanager/sphere/armsphere/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. diff --git a/sdk/resourcemanager/sphere/armsphere/time_rfc3339.go b/sdk/resourcemanager/sphere/armsphere/time_rfc3339.go index 924a05acfaa8..ddcd23257cf9 100644 --- a/sdk/resourcemanager/sphere/armsphere/time_rfc3339.go +++ b/sdk/resourcemanager/sphere/armsphere/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. @@ -60,6 +57,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string diff --git a/sdk/resourcemanager/verifiedid/armverifiedid/CHANGELOG.md b/sdk/resourcemanager/verifiedid/armverifiedid/CHANGELOG.md new file mode 100644 index 000000000000..eb87a9c8745e --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2025-04-27) +### Other Changes + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/verifiedid/armverifiedid` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file diff --git a/sdk/resourcemanager/verifiedid/armverifiedid/LICENSE.txt b/sdk/resourcemanager/verifiedid/armverifiedid/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcemanager/verifiedid/armverifiedid/README.md b/sdk/resourcemanager/verifiedid/armverifiedid/README.md new file mode 100644 index 000000000000..b621f5b25fdf --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/README.md @@ -0,0 +1,90 @@ +# Azure Verifiedid Module for Go + +The `armverifiedid` module provides operations for working with Azure Verifiedid. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/verifiedid/armverifiedid) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).) + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Verifiedid module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/verifiedid/armverifiedid +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Verifiedid. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Client Factory + +Azure Verifiedid module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armverifiedid.NewClientFactory(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +clientFactory, err := armverifiedid.NewClientFactory(, cred, &options) +``` + +## Clients + +A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. + +```go +client := clientFactory.NewAuthoritiesClient() +``` + +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Verifiedid` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/sdk/resourcemanager/verifiedid/armverifiedid/authorities_client.go b/sdk/resourcemanager/verifiedid/armverifiedid/authorities_client.go new file mode 100644 index 000000000000..77abadd68dc5 --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/authorities_client.go @@ -0,0 +1,423 @@ +// 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 armverifiedid + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AuthoritiesClient contains the methods for the Authorities group. +// Don't use this type directly, use NewAuthoritiesClient() instead. +type AuthoritiesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAuthoritiesClient creates a new instance of AuthoritiesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAuthoritiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AuthoritiesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AuthoritiesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a Authority +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-26-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - authorityName - The ID of the authority +// - resource - Resource create parameters. +// - options - AuthoritiesClientBeginCreateOrUpdateOptions contains the optional parameters for the AuthoritiesClient.BeginCreateOrUpdate +// method. +func (client *AuthoritiesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, authorityName string, resource Authority, options *AuthoritiesClientBeginCreateOrUpdateOptions) (*runtime.Poller[AuthoritiesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, authorityName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AuthoritiesClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AuthoritiesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a Authority +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-26-preview +func (client *AuthoritiesClient) createOrUpdate(ctx context.Context, resourceGroupName string, authorityName string, resource Authority, options *AuthoritiesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "AuthoritiesClient.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, authorityName, resource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *AuthoritiesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, authorityName string, resource Authority, _ *AuthoritiesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VerifiedId/authorities/{authorityName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if authorityName == "" { + return nil, errors.New("parameter authorityName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorityName}", url.PathEscape(authorityName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-26-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// Delete - Delete a Authority +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-26-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - authorityName - The ID of the authority +// - options - AuthoritiesClientDeleteOptions contains the optional parameters for the AuthoritiesClient.Delete method. +func (client *AuthoritiesClient) Delete(ctx context.Context, resourceGroupName string, authorityName string, options *AuthoritiesClientDeleteOptions) (AuthoritiesClientDeleteResponse, error) { + var err error + const operationName = "AuthoritiesClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, authorityName, options) + if err != nil { + return AuthoritiesClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AuthoritiesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return AuthoritiesClientDeleteResponse{}, err + } + return AuthoritiesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AuthoritiesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, authorityName string, _ *AuthoritiesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VerifiedId/authorities/{authorityName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if authorityName == "" { + return nil, errors.New("parameter authorityName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorityName}", url.PathEscape(authorityName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-26-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a Authority +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-26-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - authorityName - The ID of the authority +// - options - AuthoritiesClientGetOptions contains the optional parameters for the AuthoritiesClient.Get method. +func (client *AuthoritiesClient) Get(ctx context.Context, resourceGroupName string, authorityName string, options *AuthoritiesClientGetOptions) (AuthoritiesClientGetResponse, error) { + var err error + const operationName = "AuthoritiesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, authorityName, options) + if err != nil { + return AuthoritiesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AuthoritiesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AuthoritiesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *AuthoritiesClient) getCreateRequest(ctx context.Context, resourceGroupName string, authorityName string, _ *AuthoritiesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VerifiedId/authorities/{authorityName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if authorityName == "" { + return nil, errors.New("parameter authorityName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorityName}", url.PathEscape(authorityName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-26-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AuthoritiesClient) getHandleResponse(resp *http.Response) (AuthoritiesClientGetResponse, error) { + result := AuthoritiesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Authority); err != nil { + return AuthoritiesClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List Authority resources by resource group +// +// Generated from API version 2024-01-26-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - AuthoritiesClientListByResourceGroupOptions contains the optional parameters for the AuthoritiesClient.NewListByResourceGroupPager +// method. +func (client *AuthoritiesClient) NewListByResourceGroupPager(resourceGroupName string, options *AuthoritiesClientListByResourceGroupOptions) *runtime.Pager[AuthoritiesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[AuthoritiesClientListByResourceGroupResponse]{ + More: func(page AuthoritiesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AuthoritiesClientListByResourceGroupResponse) (AuthoritiesClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AuthoritiesClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return AuthoritiesClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *AuthoritiesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *AuthoritiesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VerifiedId/authorities" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-26-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *AuthoritiesClient) listByResourceGroupHandleResponse(resp *http.Response) (AuthoritiesClientListByResourceGroupResponse, error) { + result := AuthoritiesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AuthorityListResult); err != nil { + return AuthoritiesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List Authority resources by subscription ID +// +// Generated from API version 2024-01-26-preview +// - options - AuthoritiesClientListBySubscriptionOptions contains the optional parameters for the AuthoritiesClient.NewListBySubscriptionPager +// method. +func (client *AuthoritiesClient) NewListBySubscriptionPager(options *AuthoritiesClientListBySubscriptionOptions) *runtime.Pager[AuthoritiesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[AuthoritiesClientListBySubscriptionResponse]{ + More: func(page AuthoritiesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AuthoritiesClientListBySubscriptionResponse) (AuthoritiesClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AuthoritiesClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return AuthoritiesClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *AuthoritiesClient) listBySubscriptionCreateRequest(ctx context.Context, _ *AuthoritiesClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.VerifiedId/authorities" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-26-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *AuthoritiesClient) listBySubscriptionHandleResponse(resp *http.Response) (AuthoritiesClientListBySubscriptionResponse, error) { + result := AuthoritiesClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AuthorityListResult); err != nil { + return AuthoritiesClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - Update a Authority +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-01-26-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - authorityName - The ID of the authority +// - properties - The resource properties to be updated. +// - options - AuthoritiesClientUpdateOptions contains the optional parameters for the AuthoritiesClient.Update method. +func (client *AuthoritiesClient) Update(ctx context.Context, resourceGroupName string, authorityName string, properties AuthorityUpdate, options *AuthoritiesClientUpdateOptions) (AuthoritiesClientUpdateResponse, error) { + var err error + const operationName = "AuthoritiesClient.Update" + 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, authorityName, properties, options) + if err != nil { + return AuthoritiesClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AuthoritiesClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AuthoritiesClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *AuthoritiesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, authorityName string, properties AuthorityUpdate, _ *AuthoritiesClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.VerifiedId/authorities/{authorityName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if authorityName == "" { + return nil, errors.New("parameter authorityName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{authorityName}", url.PathEscape(authorityName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-26-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *AuthoritiesClient) updateHandleResponse(resp *http.Response) (AuthoritiesClientUpdateResponse, error) { + result := AuthoritiesClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Authority); err != nil { + return AuthoritiesClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/verifiedid/armverifiedid/autorest.md b/sdk/resourcemanager/verifiedid/armverifiedid/autorest.md new file mode 100644 index 000000000000..1e7e09284a4b --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/autorest.md @@ -0,0 +1,13 @@ +### AutoRest Configuration + +> see https://aka.ms/autorest + +``` yaml +azure-arm: true +require: +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/verifiedid/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/verifiedid/resource-manager/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 0.1.0 + +``` \ No newline at end of file diff --git a/sdk/resourcemanager/verifiedid/armverifiedid/build.go b/sdk/resourcemanager/verifiedid/armverifiedid/build.go new file mode 100644 index 000000000000..bc25dc340305 --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/build.go @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file enables 'go generate' to regenerate this specific SDK +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -alwaysSetBodyParamRequired -removeUnreferencedTypes resourcemanager/verifiedid/armverifiedid + +package armverifiedid diff --git a/sdk/resourcemanager/verifiedid/armverifiedid/ci.yml b/sdk/resourcemanager/verifiedid/armverifiedid/ci.yml new file mode 100644 index 000000000000..58eb6d686397 --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/ci.yml @@ -0,0 +1,27 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/verifiedid/armverifiedid/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/verifiedid/armverifiedid/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + ServiceDirectory: 'resourcemanager/verifiedid/armverifiedid' diff --git a/sdk/resourcemanager/verifiedid/armverifiedid/client_factory.go b/sdk/resourcemanager/verifiedid/armverifiedid/client_factory.go new file mode 100644 index 000000000000..1c06d9801303 --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/client_factory.go @@ -0,0 +1,49 @@ +// 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 armverifiedid + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + 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. 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) { + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, + internal: internal, + }, nil +} + +// NewAuthoritiesClient creates a new instance of AuthoritiesClient. +func (c *ClientFactory) NewAuthoritiesClient() *AuthoritiesClient { + return &AuthoritiesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + return &OperationsClient{ + internal: c.internal, + } +} diff --git a/sdk/resourcemanager/verifiedid/armverifiedid/constants.go b/sdk/resourcemanager/verifiedid/armverifiedid/constants.go new file mode 100644 index 000000000000..e944c27ba5b3 --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/constants.go @@ -0,0 +1,97 @@ +// 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 armverifiedid + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/verifiedid/armverifiedid" + moduleVersion = "v0.1.0" +) + +// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string + +const ( + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default +// value is "user,system" +type Origin string + +const ( + OriginSystem Origin = "system" + OriginUser Origin = "user" + OriginUserSystem Origin = "user,system" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} + +// ProvisioningState - The status of the current operation. +type ProvisioningState string + +const ( + // ProvisioningStateAccepted - Change accepted for processing + ProvisioningStateAccepted ProvisioningState = "Accepted" + // ProvisioningStateCanceled - Resource creation was canceled. + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateDeleting - Deletion in progress + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed - Resource creation failed. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateProvisioning - Initial provisioning in progress + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + // ProvisioningStateSucceeded - Resource has been created. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating - Update in progress + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCanceled, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateProvisioning, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, + } +} diff --git a/sdk/resourcemanager/verifiedid/armverifiedid/fake/authorities_server.go b/sdk/resourcemanager/verifiedid/armverifiedid/fake/authorities_server.go new file mode 100644 index 000000000000..8a1edf6a7ee6 --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/fake/authorities_server.go @@ -0,0 +1,349 @@ +// 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 ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/verifiedid/armverifiedid" + "net/http" + "net/url" + "regexp" +) + +// AuthoritiesServer is a fake server for instances of the armverifiedid.AuthoritiesClient type. +type AuthoritiesServer struct { + // BeginCreateOrUpdate is the fake for method AuthoritiesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, authorityName string, resource armverifiedid.Authority, options *armverifiedid.AuthoritiesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armverifiedid.AuthoritiesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method AuthoritiesClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, authorityName string, options *armverifiedid.AuthoritiesClientDeleteOptions) (resp azfake.Responder[armverifiedid.AuthoritiesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method AuthoritiesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, authorityName string, options *armverifiedid.AuthoritiesClientGetOptions) (resp azfake.Responder[armverifiedid.AuthoritiesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method AuthoritiesClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armverifiedid.AuthoritiesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armverifiedid.AuthoritiesClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method AuthoritiesClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armverifiedid.AuthoritiesClientListBySubscriptionOptions) (resp azfake.PagerResponder[armverifiedid.AuthoritiesClientListBySubscriptionResponse]) + + // Update is the fake for method AuthoritiesClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, authorityName string, properties armverifiedid.AuthorityUpdate, options *armverifiedid.AuthoritiesClientUpdateOptions) (resp azfake.Responder[armverifiedid.AuthoritiesClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewAuthoritiesServerTransport creates a new instance of AuthoritiesServerTransport with the provided implementation. +// The returned AuthoritiesServerTransport instance is connected to an instance of armverifiedid.AuthoritiesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAuthoritiesServerTransport(srv *AuthoritiesServer) *AuthoritiesServerTransport { + return &AuthoritiesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armverifiedid.AuthoritiesClientCreateOrUpdateResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armverifiedid.AuthoritiesClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armverifiedid.AuthoritiesClientListBySubscriptionResponse]](), + } +} + +// AuthoritiesServerTransport connects instances of armverifiedid.AuthoritiesClient to instances of AuthoritiesServer. +// Don't use this type directly, use NewAuthoritiesServerTransport instead. +type AuthoritiesServerTransport struct { + srv *AuthoritiesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armverifiedid.AuthoritiesClientCreateOrUpdateResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armverifiedid.AuthoritiesClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armverifiedid.AuthoritiesClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for AuthoritiesServerTransport. +func (a *AuthoritiesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return a.dispatchToMethodFake(req, method) +} + +func (a *AuthoritiesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if authoritiesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = authoritiesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AuthoritiesClient.BeginCreateOrUpdate": + res.resp, res.err = a.dispatchBeginCreateOrUpdate(req) + case "AuthoritiesClient.Delete": + res.resp, res.err = a.dispatchDelete(req) + case "AuthoritiesClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AuthoritiesClient.NewListByResourceGroupPager": + res.resp, res.err = a.dispatchNewListByResourceGroupPager(req) + case "AuthoritiesClient.NewListBySubscriptionPager": + res.resp, res.err = a.dispatchNewListBySubscriptionPager(req) + case "AuthoritiesClient.Update": + res.resp, res.err = a.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (a *AuthoritiesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if a.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := a.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.VerifiedId/authorities/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armverifiedid.Authority](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + authorityNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("authorityName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, authorityNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + a.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + a.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + a.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (a *AuthoritiesServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if a.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.VerifiedId/authorities/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + authorityNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("authorityName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Delete(req.Context(), resourceGroupNameParam, authorityNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AuthoritiesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if a.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.VerifiedId/authorities/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + authorityNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("authorityName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, authorityNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Authority, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AuthoritiesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := a.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.VerifiedId/authorities` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := a.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + a.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armverifiedid.AuthoritiesClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + a.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (a *AuthoritiesServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := a.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.VerifiedId/authorities` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := a.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + a.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armverifiedid.AuthoritiesClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + a.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (a *AuthoritiesServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if a.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.VerifiedId/authorities/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armverifiedid.AuthorityUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + authorityNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("authorityName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Update(req.Context(), resourceGroupNameParam, authorityNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Authority, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to AuthoritiesServerTransport +var authoritiesServerTransportInterceptor 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/verifiedid/armverifiedid/fake/internal.go b/sdk/resourcemanager/verifiedid/armverifiedid/fake/internal.go new file mode 100644 index 000000000000..4b65adc76adb --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/fake/internal.go @@ -0,0 +1,66 @@ +// 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 ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "net/http" + "sync" +) + +type result struct { + resp *http.Response + err error +} + +type nonRetriableError struct { + error +} + +func (nonRetriableError) NonRetriable() { + // marker method +} + +func contains[T comparable](s []T, v T) bool { + for _, vv := range s { + if vv == v { + return true + } + } + return false +} + +func newTracker[T any]() *tracker[T] { + return &tracker[T]{ + items: map[string]*T{}, + } +} + +type tracker[T any] struct { + items map[string]*T + mu sync.Mutex +} + +func (p *tracker[T]) get(req *http.Request) *T { + p.mu.Lock() + defer p.mu.Unlock() + if item, ok := p.items[server.SanitizePagerPollerPath(req.URL.Path)]; ok { + return item + } + return nil +} + +func (p *tracker[T]) add(req *http.Request, item *T) { + p.mu.Lock() + defer p.mu.Unlock() + p.items[server.SanitizePagerPollerPath(req.URL.Path)] = item +} + +func (p *tracker[T]) remove(req *http.Request) { + p.mu.Lock() + defer p.mu.Unlock() + delete(p.items, server.SanitizePagerPollerPath(req.URL.Path)) +} diff --git a/sdk/resourcemanager/verifiedid/armverifiedid/fake/operations_server.go b/sdk/resourcemanager/verifiedid/armverifiedid/fake/operations_server.go new file mode 100644 index 000000000000..b8a55a1583cb --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/fake/operations_server.go @@ -0,0 +1,118 @@ +// 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 ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/verifiedid/armverifiedid" + "net/http" +) + +// OperationsServer is a fake server for instances of the armverifiedid.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armverifiedid.OperationsClientListOptions) (resp azfake.PagerResponder[armverifiedid.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of armverifiedid.OperationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { + return &OperationsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armverifiedid.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of armverifiedid.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armverifiedid.OperationsClientListResponse]] +} + +// Do implements the policy.Transporter interface for OperationsServerTransport. +func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return o.dispatchToMethodFake(req, method) +} + +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if 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) + } + + } + 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) { + if o.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := o.newListPager.get(req) + if newListPager == nil { + resp := o.srv.NewListPager(nil) + newListPager = &resp + o.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armverifiedid.OperationsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + o.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + o.newListPager.remove(req) + } + 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/verifiedid/armverifiedid/fake/server_factory.go b/sdk/resourcemanager/verifiedid/armverifiedid/fake/server_factory.go new file mode 100644 index 000000000000..55b84ec3d6b3 --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/fake/server_factory.go @@ -0,0 +1,80 @@ +// 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 ( + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" + "sync" +) + +// ServerFactory is a fake server for instances of the armverifiedid.ClientFactory type. +type ServerFactory struct { + // AuthoritiesServer contains the fakes for client AuthoritiesClient + AuthoritiesServer AuthoritiesServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armverifiedid.ClientFactory via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { + return &ServerFactoryTransport{ + srv: srv, + } +} + +// ServerFactoryTransport connects instances of armverifiedid.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trAuthoritiesServer *AuthoritiesServerTransport + trOperationsServer *OperationsServerTransport +} + +// Do implements the policy.Transporter interface for ServerFactoryTransport. +func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + client := method[:strings.Index(method, ".")] + var resp *http.Response + var err error + + switch client { + case "AuthoritiesClient": + initServer(s, &s.trAuthoritiesServer, func() *AuthoritiesServerTransport { return NewAuthoritiesServerTransport(&s.srv.AuthoritiesServer) }) + resp, err = s.trAuthoritiesServer.Do(req) + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + default: + err = fmt.Errorf("unhandled client %s", client) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { + s.trMu.Lock() + if *dst == nil { + *dst = src() + } + s.trMu.Unlock() +} diff --git a/sdk/resourcemanager/verifiedid/armverifiedid/go.mod b/sdk/resourcemanager/verifiedid/armverifiedid/go.mod new file mode 100644 index 000000000000..45a4b1f27c3f --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/go.mod @@ -0,0 +1,13 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/verifiedid/armverifiedid + +go 1.23.0 + +toolchain go1.23.8 + +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect + golang.org/x/net v0.37.0 // indirect + golang.org/x/text v0.23.0 // indirect +) diff --git a/sdk/resourcemanager/verifiedid/armverifiedid/go.sum b/sdk/resourcemanager/verifiedid/armverifiedid/go.sum new file mode 100644 index 000000000000..cfff861c9769 --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/go.sum @@ -0,0 +1,16 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 h1:DSDNVxqkoXJiko6x8a90zidoYqnYYa6c1MTzDKzKkTo= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1/go.mod h1:zGqV2R4Cr/k8Uye5w+dgQ06WJtEcbQG/8J7BB6hnCr4= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c= +golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= +golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= +golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/verifiedid/armverifiedid/models.go b/sdk/resourcemanager/verifiedid/armverifiedid/models.go new file mode 100644 index 000000000000..70ed856216ea --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/models.go @@ -0,0 +1,123 @@ +// 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 armverifiedid + +import "time" + +// Authority - A VerifiedId authority resource +type Authority struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *AuthorityProperties + + // Resource tags. + Tags map[string]*string + + // 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 + 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 +} + +// AuthorityListResult - The response of a Authority list operation. +type AuthorityListResult struct { + // REQUIRED; The Authority items on this page + Value []*Authority + + // The link to the next page of items + NextLink *string +} + +// AuthorityProperties - Details of the VerifiedId Authority. +type AuthorityProperties struct { + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState +} + +// AuthorityUpdate - The type used for update operations of the Authority. +type AuthorityUpdate struct { + // Resource tags. + Tags map[string]*string +} + +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane + // operations. + IsDataAction *bool + + // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", + // "Microsoft.Compute/virtualMachines/capture/action" + Name *string + + // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + // value is "user,system" + Origin *Origin +} + +// OperationDisplay - Localized display information for this particular operation. +type OperationDisplay struct { + // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. + Description *string + + // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + // Machine", "Restart Virtual Machine". + Operation *string + + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". + Provider *string + + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". + Resource *string +} + +// OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to +// get the next set of results. +type OperationListResult struct { + // READ-ONLY; URL to get the next set of operation list results (if there are any). + NextLink *string + + // READ-ONLY; List of operations supported by the resource provider + Value []*Operation +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time + + // The identity that created the resource. + CreatedBy *string + + // The type of identity that created the resource. + CreatedByType *CreatedByType + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time + + // The identity that last modified the resource. + LastModifiedBy *string + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType +} diff --git a/sdk/resourcemanager/verifiedid/armverifiedid/models_serde.go b/sdk/resourcemanager/verifiedid/armverifiedid/models_serde.go new file mode 100644 index 000000000000..750fb5636bc6 --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/models_serde.go @@ -0,0 +1,329 @@ +// 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 armverifiedid + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type Authority. +func (a Authority) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Authority. +func (a *Authority) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AuthorityListResult. +func (a AuthorityListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorityListResult. +func (a *AuthorityListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AuthorityProperties. +func (a AuthorityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", a.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorityProperties. +func (a *AuthorityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AuthorityUpdate. +func (a AuthorityUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", a.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthorityUpdate. +func (a *AuthorityUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil || string(data) == "null" { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/verifiedid/armverifiedid/operations_client.go b/sdk/resourcemanager/verifiedid/armverifiedid/operations_client.go new file mode 100644 index 000000000000..d9f11705636d --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/operations_client.go @@ -0,0 +1,85 @@ +// 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 armverifiedid + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + internal *arm.Client +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - List the operations for the provider +// +// Generated from API version 2024-01-26-preview +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return OperationsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.VerifiedId/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-01-26-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { + result := OperationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { + return OperationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/verifiedid/armverifiedid/options.go b/sdk/resourcemanager/verifiedid/armverifiedid/options.go new file mode 100644 index 000000000000..67ce4dac0f09 --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/options.go @@ -0,0 +1,45 @@ +// 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 armverifiedid + +// AuthoritiesClientBeginCreateOrUpdateOptions contains the optional parameters for the AuthoritiesClient.BeginCreateOrUpdate +// method. +type AuthoritiesClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// AuthoritiesClientDeleteOptions contains the optional parameters for the AuthoritiesClient.Delete method. +type AuthoritiesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// AuthoritiesClientGetOptions contains the optional parameters for the AuthoritiesClient.Get method. +type AuthoritiesClientGetOptions struct { + // placeholder for future optional parameters +} + +// AuthoritiesClientListByResourceGroupOptions contains the optional parameters for the AuthoritiesClient.NewListByResourceGroupPager +// method. +type AuthoritiesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// AuthoritiesClientListBySubscriptionOptions contains the optional parameters for the AuthoritiesClient.NewListBySubscriptionPager +// method. +type AuthoritiesClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// AuthoritiesClientUpdateOptions contains the optional parameters for the AuthoritiesClient.Update method. +type AuthoritiesClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/verifiedid/armverifiedid/responses.go b/sdk/resourcemanager/verifiedid/armverifiedid/responses.go new file mode 100644 index 000000000000..db11e1f58391 --- /dev/null +++ b/sdk/resourcemanager/verifiedid/armverifiedid/responses.go @@ -0,0 +1,47 @@ +// 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 armverifiedid + +// AuthoritiesClientCreateOrUpdateResponse contains the response from method AuthoritiesClient.BeginCreateOrUpdate. +type AuthoritiesClientCreateOrUpdateResponse struct { + // A VerifiedId authority resource + Authority +} + +// AuthoritiesClientDeleteResponse contains the response from method AuthoritiesClient.Delete. +type AuthoritiesClientDeleteResponse struct { + // placeholder for future response values +} + +// AuthoritiesClientGetResponse contains the response from method AuthoritiesClient.Get. +type AuthoritiesClientGetResponse struct { + // A VerifiedId authority resource + Authority +} + +// AuthoritiesClientListByResourceGroupResponse contains the response from method AuthoritiesClient.NewListByResourceGroupPager. +type AuthoritiesClientListByResourceGroupResponse struct { + // The response of a Authority list operation. + AuthorityListResult +} + +// AuthoritiesClientListBySubscriptionResponse contains the response from method AuthoritiesClient.NewListBySubscriptionPager. +type AuthoritiesClientListBySubscriptionResponse struct { + // The response of a Authority list operation. + AuthorityListResult +} + +// AuthoritiesClientUpdateResponse contains the response from method AuthoritiesClient.Update. +type AuthoritiesClientUpdateResponse struct { + // A VerifiedId authority resource + Authority +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + OperationListResult +} diff --git a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/fake/time_rfc3339.go b/sdk/resourcemanager/verifiedid/armverifiedid/time_rfc3339.go similarity index 97% rename from sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/fake/time_rfc3339.go rename to sdk/resourcemanager/verifiedid/armverifiedid/time_rfc3339.go index 81f308b0d343..2ba29284c9f2 100644 --- a/sdk/resourcemanager/appcomplianceautomation/armappcomplianceautomation/fake/time_rfc3339.go +++ b/sdk/resourcemanager/verifiedid/armverifiedid/time_rfc3339.go @@ -1,12 +1,9 @@ -//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 +package armverifiedid import ( "encoding/json" @@ -60,6 +57,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string diff --git a/sdk/resourcemanager/workloads/sapmonitors/CHANGELOG.md b/sdk/resourcemanager/workloads/sapmonitors/CHANGELOG.md new file mode 100644 index 000000000000..248a37465d77 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2025-04-27) +### Other Changes + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/sapmonitors` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file diff --git a/sdk/resourcemanager/workloads/sapmonitors/LICENSE.txt b/sdk/resourcemanager/workloads/sapmonitors/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcemanager/workloads/sapmonitors/README.md b/sdk/resourcemanager/workloads/sapmonitors/README.md new file mode 100644 index 000000000000..8fcd9b7a4afd --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/README.md @@ -0,0 +1,90 @@ +# Azure Workloads Module for Go + +The `sapmonitors` module provides operations for working with Azure Workloads. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/workloads/sapmonitors) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).) + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Workloads module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/sapmonitors +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Workloads. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Client Factory + +Azure Workloads module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := sapmonitors.NewClientFactory(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +clientFactory, err := sapmonitors.NewClientFactory(, cred, &options) +``` + +## Clients + +A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. + +```go +client := clientFactory.NewAlertTemplatesClient() +``` + +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Workloads` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/sdk/resourcemanager/workloads/sapmonitors/alerts_client.go b/sdk/resourcemanager/workloads/sapmonitors/alerts_client.go new file mode 100644 index 000000000000..dea4fc0ccbfb --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/alerts_client.go @@ -0,0 +1,340 @@ +// 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 sapmonitors + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AlertsClient contains the methods for the Alerts group. +// Don't use this type directly, use NewAlertsClient() instead. +type AlertsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAlertsClient creates a new instance of AlertsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAlertsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AlertsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Creates an alert for the specified subscription, resource group, SAP monitor name, and resource name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - monitorName - Name of the SAP monitor resource. +// - alertName - Name of the SAP monitor alert resource. +// - resource - Request body representing a SAP monitor's alert resource +// - options - AlertsClientBeginCreateOptions contains the optional parameters for the AlertsClient.BeginCreate method. +func (client *AlertsClient) BeginCreate(ctx context.Context, resourceGroupName string, monitorName string, alertName string, resource Alert, options *AlertsClientBeginCreateOptions) (*runtime.Poller[AlertsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, monitorName, alertName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AlertsClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AlertsClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Creates an alert for the specified subscription, resource group, SAP monitor name, and resource name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +func (client *AlertsClient) create(ctx context.Context, resourceGroupName string, monitorName string, alertName string, resource Alert, options *AlertsClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "AlertsClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, monitorName, alertName, resource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *AlertsClient) createCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, alertName string, resource Alert, _ *AlertsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/alerts/{alertName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + if alertName == "" { + return nil, errors.New("parameter alertName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{alertName}", url.PathEscape(alertName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes an alert for the specified subscription, resource group, SAP monitor name, and resource name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - monitorName - Name of the SAP monitor resource. +// - alertName - Name of the SAP monitor alert resource. +// - options - AlertsClientBeginDeleteOptions contains the optional parameters for the AlertsClient.BeginDelete method. +func (client *AlertsClient) BeginDelete(ctx context.Context, resourceGroupName string, monitorName string, alertName string, options *AlertsClientBeginDeleteOptions) (*runtime.Poller[AlertsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, monitorName, alertName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AlertsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AlertsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes an alert for the specified subscription, resource group, SAP monitor name, and resource name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +func (client *AlertsClient) deleteOperation(ctx context.Context, resourceGroupName string, monitorName string, alertName string, options *AlertsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "AlertsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, monitorName, alertName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AlertsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, alertName string, _ *AlertsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/alerts/{alertName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + if alertName == "" { + return nil, errors.New("parameter alertName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{alertName}", url.PathEscape(alertName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets properties of an alert for the specified subscription, resource group, SAP monitor name, and resource name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - monitorName - Name of the SAP monitor resource. +// - alertName - Name of the SAP monitor alert resource. +// - options - AlertsClientGetOptions contains the optional parameters for the AlertsClient.Get method. +func (client *AlertsClient) Get(ctx context.Context, resourceGroupName string, monitorName string, alertName string, options *AlertsClientGetOptions) (AlertsClientGetResponse, error) { + var err error + const operationName = "AlertsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, monitorName, alertName, options) + if err != nil { + return AlertsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AlertsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AlertsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *AlertsClient) getCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, alertName string, _ *AlertsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/alerts/{alertName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + if alertName == "" { + return nil, errors.New("parameter alertName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{alertName}", url.PathEscape(alertName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AlertsClient) getHandleResponse(resp *http.Response) (AlertsClientGetResponse, error) { + result := AlertsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Alert); err != nil { + return AlertsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets a list of alerts in the specified SAP monitor. The operations returns various properties of each alerts. +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - monitorName - Name of the SAP monitor resource. +// - options - AlertsClientListOptions contains the optional parameters for the AlertsClient.NewListPager method. +func (client *AlertsClient) NewListPager(resourceGroupName string, monitorName string, options *AlertsClientListOptions) *runtime.Pager[AlertsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AlertsClientListResponse]{ + More: func(page AlertsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AlertsClientListResponse) (AlertsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AlertsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, monitorName, options) + }, nil) + if err != nil { + return AlertsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *AlertsClient) listCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, _ *AlertsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/alerts" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AlertsClient) listHandleResponse(resp *http.Response) (AlertsClientListResponse, error) { + result := AlertsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AlertListResult); err != nil { + return AlertsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/workloads/sapmonitors/alerttemplates_client.go b/sdk/resourcemanager/workloads/sapmonitors/alerttemplates_client.go new file mode 100644 index 000000000000..b0e856e90a15 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/alerttemplates_client.go @@ -0,0 +1,179 @@ +// 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 sapmonitors + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// AlertTemplatesClient contains the methods for the AlertTemplates group. +// Don't use this type directly, use NewAlertTemplatesClient() instead. +type AlertTemplatesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAlertTemplatesClient creates a new instance of AlertTemplatesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewAlertTemplatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertTemplatesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AlertTemplatesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets properties of an alert template for the specified subscription, resource group, SAP monitor name, and resource +// name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - monitorName - Name of the SAP monitor resource. +// - alertTemplateName - SAP monitor alert template resource name. +// - options - AlertTemplatesClientGetOptions contains the optional parameters for the AlertTemplatesClient.Get method. +func (client *AlertTemplatesClient) Get(ctx context.Context, resourceGroupName string, monitorName string, alertTemplateName string, options *AlertTemplatesClientGetOptions) (AlertTemplatesClientGetResponse, error) { + var err error + const operationName = "AlertTemplatesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, monitorName, alertTemplateName, options) + if err != nil { + return AlertTemplatesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AlertTemplatesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AlertTemplatesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *AlertTemplatesClient) getCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, alertTemplateName string, _ *AlertTemplatesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/alertTemplates/{alertTemplateName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + if alertTemplateName == "" { + return nil, errors.New("parameter alertTemplateName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{alertTemplateName}", url.PathEscape(alertTemplateName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AlertTemplatesClient) getHandleResponse(resp *http.Response) (AlertTemplatesClientGetResponse, error) { + result := AlertTemplatesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AlertTemplate); err != nil { + return AlertTemplatesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets a list of alert templates in the specified SAP monitor. The operations returns various properties of +// each alert template. +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - monitorName - Name of the SAP monitor resource. +// - options - AlertTemplatesClientListOptions contains the optional parameters for the AlertTemplatesClient.NewListPager method. +func (client *AlertTemplatesClient) NewListPager(resourceGroupName string, monitorName string, options *AlertTemplatesClientListOptions) *runtime.Pager[AlertTemplatesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AlertTemplatesClientListResponse]{ + More: func(page AlertTemplatesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AlertTemplatesClientListResponse) (AlertTemplatesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AlertTemplatesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, monitorName, options) + }, nil) + if err != nil { + return AlertTemplatesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *AlertTemplatesClient) listCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, options *AlertTemplatesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/alertTemplates" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01-preview") + if options != nil && options.ProviderType != nil { + reqQP.Set("providerType", *options.ProviderType) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *AlertTemplatesClient) listHandleResponse(resp *http.Response) (AlertTemplatesClientListResponse, error) { + result := AlertTemplatesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AlertTemplateListResult); err != nil { + return AlertTemplatesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/workloads/sapmonitors/autorest.md b/sdk/resourcemanager/workloads/sapmonitors/autorest.md new file mode 100644 index 000000000000..c8f36715e9ba --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/autorest.md @@ -0,0 +1,13 @@ +### AutoRest Configuration + +> see https://aka.ms/autorest + +``` yaml +azure-arm: true +require: +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/workloads/resource-manager/Microsoft.Workloads/monitors/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/workloads/resource-manager/Microsoft.Workloads/monitors/readme.go.md +license-header: MICROSOFT_MIT_NO_VERSION +module-version: 0.1.0 + +``` \ No newline at end of file diff --git a/sdk/resourcemanager/workloads/sapmonitors/build.go b/sdk/resourcemanager/workloads/sapmonitors/build.go new file mode 100644 index 000000000000..a157e30655a9 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/build.go @@ -0,0 +1,7 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. + +// This file enables 'go generate' to regenerate this specific SDK +//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate -alwaysSetBodyParamRequired -removeUnreferencedTypes resourcemanager/workloads/sapmonitors + +package sapmonitors diff --git a/sdk/resourcemanager/workloads/sapmonitors/ci.yml b/sdk/resourcemanager/workloads/sapmonitors/ci.yml new file mode 100644 index 000000000000..88b9eb93356a --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/ci.yml @@ -0,0 +1,27 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/workloads/sapmonitors/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/workloads/sapmonitors/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + ServiceDirectory: 'resourcemanager/workloads/sapmonitors' diff --git a/sdk/resourcemanager/workloads/sapmonitors/client_factory.go b/sdk/resourcemanager/workloads/sapmonitors/client_factory.go new file mode 100644 index 000000000000..fd6e1ebcadcd --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/client_factory.go @@ -0,0 +1,81 @@ +// 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 sapmonitors + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + 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. 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) { + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, + internal: internal, + }, nil +} + +// NewAlertTemplatesClient creates a new instance of AlertTemplatesClient. +func (c *ClientFactory) NewAlertTemplatesClient() *AlertTemplatesClient { + return &AlertTemplatesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewAlertsClient creates a new instance of AlertsClient. +func (c *ClientFactory) NewAlertsClient() *AlertsClient { + return &AlertsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewMonitorsClient creates a new instance of MonitorsClient. +func (c *ClientFactory) NewMonitorsClient() *MonitorsClient { + return &MonitorsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + return &OperationsClient{ + internal: c.internal, + } +} + +// NewProviderInstancesClient creates a new instance of ProviderInstancesClient. +func (c *ClientFactory) NewProviderInstancesClient() *ProviderInstancesClient { + return &ProviderInstancesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewSapLandscapeMonitorClient creates a new instance of SapLandscapeMonitorClient. +func (c *ClientFactory) NewSapLandscapeMonitorClient() *SapLandscapeMonitorClient { + return &SapLandscapeMonitorClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} diff --git a/sdk/resourcemanager/workloads/sapmonitors/constants.go b/sdk/resourcemanager/workloads/sapmonitors/constants.go new file mode 100644 index 000000000000..989a16e3dde1 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/constants.go @@ -0,0 +1,370 @@ +// 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 sapmonitors + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/sapmonitors" + moduleVersion = "v0.1.0" +) + +// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string + +const ( + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + +// AlertAutoMitigate - The value that indicates whether the alert should be automatically resolved or not. The default is +// Disable. +type AlertAutoMitigate string + +const ( + // AlertAutoMitigateDisable - The alert should not be automatically resolved. + AlertAutoMitigateDisable AlertAutoMitigate = "Disable" + // AlertAutoMitigateEnable - The alert should be automatically resolved. + AlertAutoMitigateEnable AlertAutoMitigate = "Enable" +) + +// PossibleAlertAutoMitigateValues returns the possible values for the AlertAutoMitigate const type. +func PossibleAlertAutoMitigateValues() []AlertAutoMitigate { + return []AlertAutoMitigate{ + AlertAutoMitigateDisable, + AlertAutoMitigateEnable, + } +} + +// AlertRuleStatus - The value which indicates whether this scheduled query rule is enabled. Value should be enabled or disabled +type AlertRuleStatus string + +const ( + // AlertRuleStatusDisabled - The scheduled query rule is disabled + AlertRuleStatusDisabled AlertRuleStatus = "Disabled" + // AlertRuleStatusEnabled - The scheduled query rule is enabled + AlertRuleStatusEnabled AlertRuleStatus = "Enabled" +) + +// PossibleAlertRuleStatusValues returns the possible values for the AlertRuleStatus const type. +func PossibleAlertRuleStatusValues() []AlertRuleStatus { + return []AlertRuleStatus{ + AlertRuleStatusDisabled, + AlertRuleStatusEnabled, + } +} + +// AlertTemplateMetricTriggerType - Metric Trigger Type Associated with the Alert Template for Metric Measurement +type AlertTemplateMetricTriggerType string + +const ( + // AlertTemplateMetricTriggerTypeConsecutive - The metric trigger type is consecutive. + AlertTemplateMetricTriggerTypeConsecutive AlertTemplateMetricTriggerType = "Consecutive" + // AlertTemplateMetricTriggerTypeTotal - The metric trigger type is total. + AlertTemplateMetricTriggerTypeTotal AlertTemplateMetricTriggerType = "Total" +) + +// PossibleAlertTemplateMetricTriggerTypeValues returns the possible values for the AlertTemplateMetricTriggerType const type. +func PossibleAlertTemplateMetricTriggerTypeValues() []AlertTemplateMetricTriggerType { + return []AlertTemplateMetricTriggerType{ + AlertTemplateMetricTriggerTypeConsecutive, + AlertTemplateMetricTriggerTypeTotal, + } +} + +// AlertTemplateParameterType - Type of the Query Input Parameter +type AlertTemplateParameterType string + +const ( + // AlertTemplateParameterTypeCustomInput - Custom input parameter + AlertTemplateParameterTypeCustomInput AlertTemplateParameterType = "CustomInput" + // AlertTemplateParameterTypeLogAnalyticsQuery - Log Analytics query parameter + AlertTemplateParameterTypeLogAnalyticsQuery AlertTemplateParameterType = "LogAnalyticsQuery" + // AlertTemplateParameterTypeProviderProperty - Provider property parameter + AlertTemplateParameterTypeProviderProperty AlertTemplateParameterType = "ProviderProperty" +) + +// PossibleAlertTemplateParameterTypeValues returns the possible values for the AlertTemplateParameterType const type. +func PossibleAlertTemplateParameterTypeValues() []AlertTemplateParameterType { + return []AlertTemplateParameterType{ + AlertTemplateParameterTypeCustomInput, + AlertTemplateParameterTypeLogAnalyticsQuery, + AlertTemplateParameterTypeProviderProperty, + } +} + +// AlertTemplateSelectionMode - Selection Mode of the Query Input Parameter +type AlertTemplateSelectionMode string + +const ( + // AlertTemplateSelectionModeMultiple - The selection mode is Multiple. + AlertTemplateSelectionModeMultiple AlertTemplateSelectionMode = "Multiple" + // AlertTemplateSelectionModeSingle - The selection mode is single. + AlertTemplateSelectionModeSingle AlertTemplateSelectionMode = "Single" +) + +// PossibleAlertTemplateSelectionModeValues returns the possible values for the AlertTemplateSelectionMode const type. +func PossibleAlertTemplateSelectionModeValues() []AlertTemplateSelectionMode { + return []AlertTemplateSelectionMode{ + AlertTemplateSelectionModeMultiple, + AlertTemplateSelectionModeSingle, + } +} + +// AppServicePlanTier - The App Service plan tier. +type AppServicePlanTier string + +const ( + // AppServicePlanTierElasticPremium - Elastic Premium plan + AppServicePlanTierElasticPremium AppServicePlanTier = "ElasticPremium" + // AppServicePlanTierPremiumV3 - Dedicated Premium V3 plan + AppServicePlanTierPremiumV3 AppServicePlanTier = "PremiumV3" +) + +// PossibleAppServicePlanTierValues returns the possible values for the AppServicePlanTier const type. +func PossibleAppServicePlanTierValues() []AppServicePlanTier { + return []AppServicePlanTier{ + AppServicePlanTierElasticPremium, + AppServicePlanTierPremiumV3, + } +} + +// ConditionalOperator - Result Condition Evaluation Criteria +type ConditionalOperator string + +const ( + // ConditionalOperatorEqual - The value is equal to the specified value. + ConditionalOperatorEqual ConditionalOperator = "Equal" + // ConditionalOperatorGreaterThan - The value is greater than the specified value. + ConditionalOperatorGreaterThan ConditionalOperator = "GreaterThan" + // ConditionalOperatorGreaterThanOrEqual - The value is greater than or equal to the specified value. + ConditionalOperatorGreaterThanOrEqual ConditionalOperator = "GreaterThanOrEqual" + // ConditionalOperatorLessThan - The value is less than the specified value. + ConditionalOperatorLessThan ConditionalOperator = "LessThan" + // ConditionalOperatorLessThanOrEqual - The value is less than or equal to the specified value. + ConditionalOperatorLessThanOrEqual ConditionalOperator = "LessThanOrEqual" +) + +// PossibleConditionalOperatorValues returns the possible values for the ConditionalOperator const type. +func PossibleConditionalOperatorValues() []ConditionalOperator { + return []ConditionalOperator{ + ConditionalOperatorEqual, + ConditionalOperatorGreaterThan, + ConditionalOperatorGreaterThanOrEqual, + ConditionalOperatorLessThan, + ConditionalOperatorLessThanOrEqual, + } +} + +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// DefaultThresholdInputOption - Is input required for Default Threshold Value Associated with the Alert Template +type DefaultThresholdInputOption string + +const ( + // DefaultThresholdInputOptionNotRequired - The default threshold value is not required. + DefaultThresholdInputOptionNotRequired DefaultThresholdInputOption = "NotRequired" + // DefaultThresholdInputOptionOptional - The default threshold value is optional. + DefaultThresholdInputOptionOptional DefaultThresholdInputOption = "Optional" + // DefaultThresholdInputOptionRequired - The default threshold value is required. + DefaultThresholdInputOptionRequired DefaultThresholdInputOption = "Required" +) + +// PossibleDefaultThresholdInputOptionValues returns the possible values for the DefaultThresholdInputOption const type. +func PossibleDefaultThresholdInputOptionValues() []DefaultThresholdInputOption { + return []DefaultThresholdInputOption{ + DefaultThresholdInputOptionNotRequired, + DefaultThresholdInputOptionOptional, + DefaultThresholdInputOptionRequired, + } +} + +// ManagedServiceIdentityType - Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). +type ManagedServiceIdentityType string + +const ( + ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" + ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" + ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" +) + +// PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type. +func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { + return []ManagedServiceIdentityType{ + ManagedServiceIdentityTypeNone, + ManagedServiceIdentityTypeSystemAssigned, + ManagedServiceIdentityTypeSystemAssignedUserAssigned, + ManagedServiceIdentityTypeUserAssigned, + } +} + +// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default +// value is "user,system" +type Origin string + +const ( + OriginSystem Origin = "system" + OriginUser Origin = "user" + OriginUserSystem Origin = "user,system" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} + +// RoutingPreference - Sets the routing preference of the SAP monitor. +type RoutingPreference string + +const ( + // RoutingPreferenceDefault - Default routing preference. Only RFC1918 traffic is routed to the customer VNET. + RoutingPreferenceDefault RoutingPreference = "Default" + // RoutingPreferenceRouteAll - Route all traffic to the customer VNET. + RoutingPreferenceRouteAll RoutingPreference = "RouteAll" +) + +// PossibleRoutingPreferenceValues returns the possible values for the RoutingPreference const type. +func PossibleRoutingPreferenceValues() []RoutingPreference { + return []RoutingPreference{ + RoutingPreferenceDefault, + RoutingPreferenceRouteAll, + } +} + +// SSLPreference - Gets or sets certificate preference if secure communication is enabled. +type SSLPreference string + +const ( + // SSLPreferenceDisabled - Secure communication is disabled. + SSLPreferenceDisabled SSLPreference = "Disabled" + // SSLPreferenceRootCertificate - Secure communication is enabled with root certificate. + SSLPreferenceRootCertificate SSLPreference = "RootCertificate" + // SSLPreferenceServerCertificate - Secure communication is enabled with server certificate. + SSLPreferenceServerCertificate SSLPreference = "ServerCertificate" +) + +// PossibleSSLPreferenceValues returns the possible values for the SSLPreference const type. +func PossibleSSLPreferenceValues() []SSLPreference { + return []SSLPreference{ + SSLPreferenceDisabled, + SSLPreferenceRootCertificate, + SSLPreferenceServerCertificate, + } +} + +// SapLandscapeMonitorProvisioningState - State of provisioning of the SAP monitor. +type SapLandscapeMonitorProvisioningState string + +const ( + // SapLandscapeMonitorProvisioningStateAccepted - The resource request has been accepted. + SapLandscapeMonitorProvisioningStateAccepted SapLandscapeMonitorProvisioningState = "Accepted" + // SapLandscapeMonitorProvisioningStateCanceled - The resource operation was canceled. + SapLandscapeMonitorProvisioningStateCanceled SapLandscapeMonitorProvisioningState = "Canceled" + // SapLandscapeMonitorProvisioningStateCreated - The resource has been created. + SapLandscapeMonitorProvisioningStateCreated SapLandscapeMonitorProvisioningState = "Created" + // SapLandscapeMonitorProvisioningStateFailed - The resource operation has failed. + SapLandscapeMonitorProvisioningStateFailed SapLandscapeMonitorProvisioningState = "Failed" + // SapLandscapeMonitorProvisioningStateSucceeded - The resource operation has succeeded. + SapLandscapeMonitorProvisioningStateSucceeded SapLandscapeMonitorProvisioningState = "Succeeded" +) + +// PossibleSapLandscapeMonitorProvisioningStateValues returns the possible values for the SapLandscapeMonitorProvisioningState const type. +func PossibleSapLandscapeMonitorProvisioningStateValues() []SapLandscapeMonitorProvisioningState { + return []SapLandscapeMonitorProvisioningState{ + SapLandscapeMonitorProvisioningStateAccepted, + SapLandscapeMonitorProvisioningStateCanceled, + SapLandscapeMonitorProvisioningStateCreated, + SapLandscapeMonitorProvisioningStateFailed, + SapLandscapeMonitorProvisioningStateSucceeded, + } +} + +// WorkloadMonitorProvisioningState - State of provisioning of the SAP monitor. +type WorkloadMonitorProvisioningState string + +const ( + // WorkloadMonitorProvisioningStateAccepted - The resource request has been accepted. + WorkloadMonitorProvisioningStateAccepted WorkloadMonitorProvisioningState = "Accepted" + // WorkloadMonitorProvisioningStateCanceled - The resource operation was canceled. + WorkloadMonitorProvisioningStateCanceled WorkloadMonitorProvisioningState = "Canceled" + // WorkloadMonitorProvisioningStateCreating - The resource is being created. + WorkloadMonitorProvisioningStateCreating WorkloadMonitorProvisioningState = "Creating" + // WorkloadMonitorProvisioningStateDeleting - The resource is being deleted. + WorkloadMonitorProvisioningStateDeleting WorkloadMonitorProvisioningState = "Deleting" + // WorkloadMonitorProvisioningStateFailed - The resource creation failed. + WorkloadMonitorProvisioningStateFailed WorkloadMonitorProvisioningState = "Failed" + // WorkloadMonitorProvisioningStateMigrating - The resource is being migrated. + WorkloadMonitorProvisioningStateMigrating WorkloadMonitorProvisioningState = "Migrating" + // WorkloadMonitorProvisioningStateSucceeded - The resource creation has succeeded. + WorkloadMonitorProvisioningStateSucceeded WorkloadMonitorProvisioningState = "Succeeded" + // WorkloadMonitorProvisioningStateUpdating - The resource is being updated. + WorkloadMonitorProvisioningStateUpdating WorkloadMonitorProvisioningState = "Updating" +) + +// PossibleWorkloadMonitorProvisioningStateValues returns the possible values for the WorkloadMonitorProvisioningState const type. +func PossibleWorkloadMonitorProvisioningStateValues() []WorkloadMonitorProvisioningState { + return []WorkloadMonitorProvisioningState{ + WorkloadMonitorProvisioningStateAccepted, + WorkloadMonitorProvisioningStateCanceled, + WorkloadMonitorProvisioningStateCreating, + WorkloadMonitorProvisioningStateDeleting, + WorkloadMonitorProvisioningStateFailed, + WorkloadMonitorProvisioningStateMigrating, + WorkloadMonitorProvisioningStateSucceeded, + WorkloadMonitorProvisioningStateUpdating, + } +} + +// WorkloadProviderInstanceHealthState - State of health of the provider instance +type WorkloadProviderInstanceHealthState string + +const ( + // WorkloadProviderInstanceHealthStateDegraded - The resource health status is Degraded + WorkloadProviderInstanceHealthStateDegraded WorkloadProviderInstanceHealthState = "Degraded" + // WorkloadProviderInstanceHealthStateHealthy - The resource health status is Healthy + WorkloadProviderInstanceHealthStateHealthy WorkloadProviderInstanceHealthState = "Healthy" + // WorkloadProviderInstanceHealthStateUnavailable - The resource health status is Unavailable + WorkloadProviderInstanceHealthStateUnavailable WorkloadProviderInstanceHealthState = "Unavailable" + // WorkloadProviderInstanceHealthStateUnknown - The resource health status is Unknown + WorkloadProviderInstanceHealthStateUnknown WorkloadProviderInstanceHealthState = "Unknown" +) + +// PossibleWorkloadProviderInstanceHealthStateValues returns the possible values for the WorkloadProviderInstanceHealthState const type. +func PossibleWorkloadProviderInstanceHealthStateValues() []WorkloadProviderInstanceHealthState { + return []WorkloadProviderInstanceHealthState{ + WorkloadProviderInstanceHealthStateDegraded, + WorkloadProviderInstanceHealthStateHealthy, + WorkloadProviderInstanceHealthStateUnavailable, + WorkloadProviderInstanceHealthStateUnknown, + } +} diff --git a/sdk/resourcemanager/workloads/sapmonitors/fake/alerts_server.go b/sdk/resourcemanager/workloads/sapmonitors/fake/alerts_server.go new file mode 100644 index 000000000000..92d67a282d50 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/fake/alerts_server.go @@ -0,0 +1,294 @@ +// 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 ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/sapmonitors" + "net/http" + "net/url" + "regexp" +) + +// AlertsServer is a fake server for instances of the sapmonitors.AlertsClient type. +type AlertsServer struct { + // BeginCreate is the fake for method AlertsClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreate func(ctx context.Context, resourceGroupName string, monitorName string, alertName string, resource sapmonitors.Alert, options *sapmonitors.AlertsClientBeginCreateOptions) (resp azfake.PollerResponder[sapmonitors.AlertsClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method AlertsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, monitorName string, alertName string, options *sapmonitors.AlertsClientBeginDeleteOptions) (resp azfake.PollerResponder[sapmonitors.AlertsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method AlertsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, monitorName string, alertName string, options *sapmonitors.AlertsClientGetOptions) (resp azfake.Responder[sapmonitors.AlertsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method AlertsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, monitorName string, options *sapmonitors.AlertsClientListOptions) (resp azfake.PagerResponder[sapmonitors.AlertsClientListResponse]) +} + +// NewAlertsServerTransport creates a new instance of AlertsServerTransport with the provided implementation. +// The returned AlertsServerTransport instance is connected to an instance of sapmonitors.AlertsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAlertsServerTransport(srv *AlertsServer) *AlertsServerTransport { + return &AlertsServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[sapmonitors.AlertsClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[sapmonitors.AlertsClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[sapmonitors.AlertsClientListResponse]](), + } +} + +// AlertsServerTransport connects instances of sapmonitors.AlertsClient to instances of AlertsServer. +// Don't use this type directly, use NewAlertsServerTransport instead. +type AlertsServerTransport struct { + srv *AlertsServer + beginCreate *tracker[azfake.PollerResponder[sapmonitors.AlertsClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[sapmonitors.AlertsClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[sapmonitors.AlertsClientListResponse]] +} + +// Do implements the policy.Transporter interface for AlertsServerTransport. +func (a *AlertsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return a.dispatchToMethodFake(req, method) +} + +func (a *AlertsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if alertsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = alertsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AlertsClient.BeginCreate": + res.resp, res.err = a.dispatchBeginCreate(req) + case "AlertsClient.BeginDelete": + res.resp, res.err = a.dispatchBeginDelete(req) + case "AlertsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AlertsClient.NewListPager": + res.resp, res.err = a.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (a *AlertsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if a.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := a.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/monitors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/alerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[sapmonitors.Alert](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + monitorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("monitorName")]) + if err != nil { + return nil, err + } + alertNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("alertName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginCreate(req.Context(), resourceGroupNameParam, monitorNameParam, alertNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + a.beginCreate.add(req, beginCreate) + } + + resp, err := server.PollerResponderNext(beginCreate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + a.beginCreate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreate) { + a.beginCreate.remove(req) + } + + return resp, nil +} + +func (a *AlertsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if a.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := a.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/monitors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/alerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + monitorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("monitorName")]) + if err != nil { + return nil, err + } + alertNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("alertName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginDelete(req.Context(), resourceGroupNameParam, monitorNameParam, alertNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + a.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + a.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + a.beginDelete.remove(req) + } + + return resp, nil +} + +func (a *AlertsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if a.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/monitors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/alerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + monitorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("monitorName")]) + if err != nil { + return nil, err + } + alertNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("alertName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, monitorNameParam, alertNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Alert, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AlertsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := a.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/monitors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/alerts` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + monitorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("monitorName")]) + if err != nil { + return nil, err + } + resp := a.srv.NewListPager(resourceGroupNameParam, monitorNameParam, nil) + newListPager = &resp + a.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *sapmonitors.AlertsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + a.newListPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to AlertsServerTransport +var alertsServerTransportInterceptor 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/workloads/sapmonitors/fake/alerttemplates_server.go b/sdk/resourcemanager/workloads/sapmonitors/fake/alerttemplates_server.go new file mode 100644 index 000000000000..e0be6ad6f18a --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/fake/alerttemplates_server.go @@ -0,0 +1,190 @@ +// 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 ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/sapmonitors" + "net/http" + "net/url" + "regexp" +) + +// AlertTemplatesServer is a fake server for instances of the sapmonitors.AlertTemplatesClient type. +type AlertTemplatesServer struct { + // Get is the fake for method AlertTemplatesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, monitorName string, alertTemplateName string, options *sapmonitors.AlertTemplatesClientGetOptions) (resp azfake.Responder[sapmonitors.AlertTemplatesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method AlertTemplatesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, monitorName string, options *sapmonitors.AlertTemplatesClientListOptions) (resp azfake.PagerResponder[sapmonitors.AlertTemplatesClientListResponse]) +} + +// NewAlertTemplatesServerTransport creates a new instance of AlertTemplatesServerTransport with the provided implementation. +// The returned AlertTemplatesServerTransport instance is connected to an instance of sapmonitors.AlertTemplatesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAlertTemplatesServerTransport(srv *AlertTemplatesServer) *AlertTemplatesServerTransport { + return &AlertTemplatesServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[sapmonitors.AlertTemplatesClientListResponse]](), + } +} + +// AlertTemplatesServerTransport connects instances of sapmonitors.AlertTemplatesClient to instances of AlertTemplatesServer. +// Don't use this type directly, use NewAlertTemplatesServerTransport instead. +type AlertTemplatesServerTransport struct { + srv *AlertTemplatesServer + newListPager *tracker[azfake.PagerResponder[sapmonitors.AlertTemplatesClientListResponse]] +} + +// Do implements the policy.Transporter interface for AlertTemplatesServerTransport. +func (a *AlertTemplatesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return a.dispatchToMethodFake(req, method) +} + +func (a *AlertTemplatesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if alertTemplatesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = alertTemplatesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AlertTemplatesClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AlertTemplatesClient.NewListPager": + res.resp, res.err = a.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (a *AlertTemplatesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if a.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/monitors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/alertTemplates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + monitorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("monitorName")]) + if err != nil { + return nil, err + } + alertTemplateNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("alertTemplateName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, monitorNameParam, alertTemplateNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AlertTemplate, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AlertTemplatesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := a.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/monitors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/alertTemplates` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + monitorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("monitorName")]) + if err != nil { + return nil, err + } + providerTypeUnescaped, err := url.QueryUnescape(qp.Get("providerType")) + if err != nil { + return nil, err + } + providerTypeParam := getOptional(providerTypeUnescaped) + var options *sapmonitors.AlertTemplatesClientListOptions + if providerTypeParam != nil { + options = &sapmonitors.AlertTemplatesClientListOptions{ + ProviderType: providerTypeParam, + } + } + resp := a.srv.NewListPager(resourceGroupNameParam, monitorNameParam, options) + newListPager = &resp + a.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *sapmonitors.AlertTemplatesClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + a.newListPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to AlertTemplatesServerTransport +var alertTemplatesServerTransportInterceptor 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/workloads/sapmonitors/fake/internal.go b/sdk/resourcemanager/workloads/sapmonitors/fake/internal.go new file mode 100644 index 000000000000..486a30a014e6 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/fake/internal.go @@ -0,0 +1,74 @@ +// 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 ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "net/http" + "reflect" + "sync" +) + +type result struct { + resp *http.Response + err error +} + +type nonRetriableError struct { + error +} + +func (nonRetriableError) NonRetriable() { + // marker method +} + +func contains[T comparable](s []T, v T) bool { + for _, vv := range s { + if vv == v { + return true + } + } + return false +} + +func getOptional[T any](v T) *T { + if reflect.ValueOf(v).IsZero() { + return nil + } + return &v +} + +func newTracker[T any]() *tracker[T] { + return &tracker[T]{ + items: map[string]*T{}, + } +} + +type tracker[T any] struct { + items map[string]*T + mu sync.Mutex +} + +func (p *tracker[T]) get(req *http.Request) *T { + p.mu.Lock() + defer p.mu.Unlock() + if item, ok := p.items[server.SanitizePagerPollerPath(req.URL.Path)]; ok { + return item + } + return nil +} + +func (p *tracker[T]) add(req *http.Request, item *T) { + p.mu.Lock() + defer p.mu.Unlock() + p.items[server.SanitizePagerPollerPath(req.URL.Path)] = item +} + +func (p *tracker[T]) remove(req *http.Request) { + p.mu.Lock() + defer p.mu.Unlock() + delete(p.items, server.SanitizePagerPollerPath(req.URL.Path)) +} diff --git a/sdk/resourcemanager/workloads/sapmonitors/fake/monitors_server.go b/sdk/resourcemanager/workloads/sapmonitors/fake/monitors_server.go new file mode 100644 index 000000000000..340381f8e920 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/fake/monitors_server.go @@ -0,0 +1,375 @@ +// 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 ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/sapmonitors" + "net/http" + "net/url" + "regexp" +) + +// MonitorsServer is a fake server for instances of the sapmonitors.MonitorsClient type. +type MonitorsServer struct { + // BeginCreate is the fake for method MonitorsClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreate func(ctx context.Context, resourceGroupName string, monitorName string, resource sapmonitors.Monitor, options *sapmonitors.MonitorsClientBeginCreateOptions) (resp azfake.PollerResponder[sapmonitors.MonitorsClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method MonitorsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, monitorName string, options *sapmonitors.MonitorsClientBeginDeleteOptions) (resp azfake.PollerResponder[sapmonitors.MonitorsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method MonitorsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, monitorName string, options *sapmonitors.MonitorsClientGetOptions) (resp azfake.Responder[sapmonitors.MonitorsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method MonitorsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *sapmonitors.MonitorsClientListOptions) (resp azfake.PagerResponder[sapmonitors.MonitorsClientListResponse]) + + // NewListByResourceGroupPager is the fake for method MonitorsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *sapmonitors.MonitorsClientListByResourceGroupOptions) (resp azfake.PagerResponder[sapmonitors.MonitorsClientListByResourceGroupResponse]) + + // BeginUpdate is the fake for method MonitorsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, monitorName string, properties sapmonitors.UpdateMonitorRequest, options *sapmonitors.MonitorsClientBeginUpdateOptions) (resp azfake.PollerResponder[sapmonitors.MonitorsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewMonitorsServerTransport creates a new instance of MonitorsServerTransport with the provided implementation. +// The returned MonitorsServerTransport instance is connected to an instance of sapmonitors.MonitorsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewMonitorsServerTransport(srv *MonitorsServer) *MonitorsServerTransport { + return &MonitorsServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[sapmonitors.MonitorsClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[sapmonitors.MonitorsClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[sapmonitors.MonitorsClientListResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[sapmonitors.MonitorsClientListByResourceGroupResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[sapmonitors.MonitorsClientUpdateResponse]](), + } +} + +// MonitorsServerTransport connects instances of sapmonitors.MonitorsClient to instances of MonitorsServer. +// Don't use this type directly, use NewMonitorsServerTransport instead. +type MonitorsServerTransport struct { + srv *MonitorsServer + beginCreate *tracker[azfake.PollerResponder[sapmonitors.MonitorsClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[sapmonitors.MonitorsClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[sapmonitors.MonitorsClientListResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[sapmonitors.MonitorsClientListByResourceGroupResponse]] + beginUpdate *tracker[azfake.PollerResponder[sapmonitors.MonitorsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for MonitorsServerTransport. +func (m *MonitorsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return m.dispatchToMethodFake(req, method) +} + +func (m *MonitorsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if monitorsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = monitorsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "MonitorsClient.BeginCreate": + res.resp, res.err = m.dispatchBeginCreate(req) + case "MonitorsClient.BeginDelete": + res.resp, res.err = m.dispatchBeginDelete(req) + case "MonitorsClient.Get": + res.resp, res.err = m.dispatchGet(req) + case "MonitorsClient.NewListPager": + res.resp, res.err = m.dispatchNewListPager(req) + case "MonitorsClient.NewListByResourceGroupPager": + res.resp, res.err = m.dispatchNewListByResourceGroupPager(req) + case "MonitorsClient.BeginUpdate": + res.resp, res.err = m.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 (m *MonitorsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if m.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := m.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/monitors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[sapmonitors.Monitor](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + monitorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("monitorName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginCreate(req.Context(), resourceGroupNameParam, monitorNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + m.beginCreate.add(req, beginCreate) + } + + resp, err := server.PollerResponderNext(beginCreate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + m.beginCreate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreate) { + m.beginCreate.remove(req) + } + + return resp, nil +} + +func (m *MonitorsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if m.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := m.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/monitors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + monitorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("monitorName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginDelete(req.Context(), resourceGroupNameParam, monitorNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + m.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + m.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + m.beginDelete.remove(req) + } + + return resp, nil +} + +func (m *MonitorsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if m.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/monitors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + monitorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("monitorName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.Get(req.Context(), resourceGroupNameParam, monitorNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Monitor, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *MonitorsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if m.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := m.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/monitors` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := m.srv.NewListPager(nil) + newListPager = &resp + m.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *sapmonitors.MonitorsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + m.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + m.newListPager.remove(req) + } + return resp, nil +} + +func (m *MonitorsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if m.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := m.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/monitors` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := m.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + m.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *sapmonitors.MonitorsClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + m.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + m.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (m *MonitorsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if m.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := m.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/monitors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[sapmonitors.UpdateMonitorRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + monitorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("monitorName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginUpdate(req.Context(), resourceGroupNameParam, monitorNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + m.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + m.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + m.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to MonitorsServerTransport +var monitorsServerTransportInterceptor 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/workloads/sapmonitors/fake/operations_server.go b/sdk/resourcemanager/workloads/sapmonitors/fake/operations_server.go new file mode 100644 index 000000000000..34089b722bc2 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/fake/operations_server.go @@ -0,0 +1,118 @@ +// 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 ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/sapmonitors" + "net/http" +) + +// OperationsServer is a fake server for instances of the sapmonitors.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *sapmonitors.OperationsClientListOptions) (resp azfake.PagerResponder[sapmonitors.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of sapmonitors.OperationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { + return &OperationsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[sapmonitors.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of sapmonitors.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[sapmonitors.OperationsClientListResponse]] +} + +// Do implements the policy.Transporter interface for OperationsServerTransport. +func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return o.dispatchToMethodFake(req, method) +} + +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if 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) + } + + } + 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) { + if o.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := o.newListPager.get(req) + if newListPager == nil { + resp := o.srv.NewListPager(nil) + newListPager = &resp + o.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *sapmonitors.OperationsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + o.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + o.newListPager.remove(req) + } + 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/workloads/sapmonitors/fake/providerinstances_server.go b/sdk/resourcemanager/workloads/sapmonitors/fake/providerinstances_server.go new file mode 100644 index 000000000000..d18bb9a3716d --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/fake/providerinstances_server.go @@ -0,0 +1,294 @@ +// 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 ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/sapmonitors" + "net/http" + "net/url" + "regexp" +) + +// ProviderInstancesServer is a fake server for instances of the sapmonitors.ProviderInstancesClient type. +type ProviderInstancesServer struct { + // BeginCreate is the fake for method ProviderInstancesClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreate func(ctx context.Context, resourceGroupName string, monitorName string, providerInstanceName string, resource sapmonitors.ProviderInstance, options *sapmonitors.ProviderInstancesClientBeginCreateOptions) (resp azfake.PollerResponder[sapmonitors.ProviderInstancesClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ProviderInstancesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, monitorName string, providerInstanceName string, options *sapmonitors.ProviderInstancesClientBeginDeleteOptions) (resp azfake.PollerResponder[sapmonitors.ProviderInstancesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ProviderInstancesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, monitorName string, providerInstanceName string, options *sapmonitors.ProviderInstancesClientGetOptions) (resp azfake.Responder[sapmonitors.ProviderInstancesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByMonitorPager is the fake for method ProviderInstancesClient.NewListByMonitorPager + // HTTP status codes to indicate success: http.StatusOK + NewListByMonitorPager func(resourceGroupName string, monitorName string, options *sapmonitors.ProviderInstancesClientListByMonitorOptions) (resp azfake.PagerResponder[sapmonitors.ProviderInstancesClientListByMonitorResponse]) +} + +// NewProviderInstancesServerTransport creates a new instance of ProviderInstancesServerTransport with the provided implementation. +// The returned ProviderInstancesServerTransport instance is connected to an instance of sapmonitors.ProviderInstancesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewProviderInstancesServerTransport(srv *ProviderInstancesServer) *ProviderInstancesServerTransport { + return &ProviderInstancesServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[sapmonitors.ProviderInstancesClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[sapmonitors.ProviderInstancesClientDeleteResponse]](), + newListByMonitorPager: newTracker[azfake.PagerResponder[sapmonitors.ProviderInstancesClientListByMonitorResponse]](), + } +} + +// ProviderInstancesServerTransport connects instances of sapmonitors.ProviderInstancesClient to instances of ProviderInstancesServer. +// Don't use this type directly, use NewProviderInstancesServerTransport instead. +type ProviderInstancesServerTransport struct { + srv *ProviderInstancesServer + beginCreate *tracker[azfake.PollerResponder[sapmonitors.ProviderInstancesClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[sapmonitors.ProviderInstancesClientDeleteResponse]] + newListByMonitorPager *tracker[azfake.PagerResponder[sapmonitors.ProviderInstancesClientListByMonitorResponse]] +} + +// Do implements the policy.Transporter interface for ProviderInstancesServerTransport. +func (p *ProviderInstancesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return p.dispatchToMethodFake(req, method) +} + +func (p *ProviderInstancesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if providerInstancesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = providerInstancesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ProviderInstancesClient.BeginCreate": + res.resp, res.err = p.dispatchBeginCreate(req) + case "ProviderInstancesClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "ProviderInstancesClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "ProviderInstancesClient.NewListByMonitorPager": + res.resp, res.err = p.dispatchNewListByMonitorPager(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 (p *ProviderInstancesServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if p.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := p.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/monitors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providerInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[sapmonitors.ProviderInstance](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + monitorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("monitorName")]) + if err != nil { + return nil, err + } + providerInstanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("providerInstanceName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginCreate(req.Context(), resourceGroupNameParam, monitorNameParam, providerInstanceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + p.beginCreate.add(req, beginCreate) + } + + resp, err := server.PollerResponderNext(beginCreate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + p.beginCreate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreate) { + p.beginCreate.remove(req) + } + + return resp, nil +} + +func (p *ProviderInstancesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if p.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := p.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/monitors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providerInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + monitorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("monitorName")]) + if err != nil { + return nil, err + } + providerInstanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("providerInstanceName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, monitorNameParam, providerInstanceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + p.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + p.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + p.beginDelete.remove(req) + } + + return resp, nil +} + +func (p *ProviderInstancesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/monitors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providerInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + monitorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("monitorName")]) + if err != nil { + return nil, err + } + providerInstanceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("providerInstanceName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, monitorNameParam, providerInstanceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ProviderInstance, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *ProviderInstancesServerTransport) dispatchNewListByMonitorPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListByMonitorPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByMonitorPager not implemented")} + } + newListByMonitorPager := p.newListByMonitorPager.get(req) + if newListByMonitorPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/monitors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providerInstances` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + monitorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("monitorName")]) + if err != nil { + return nil, err + } + resp := p.srv.NewListByMonitorPager(resourceGroupNameParam, monitorNameParam, nil) + newListByMonitorPager = &resp + p.newListByMonitorPager.add(req, newListByMonitorPager) + server.PagerResponderInjectNextLinks(newListByMonitorPager, req, func(page *sapmonitors.ProviderInstancesClientListByMonitorResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByMonitorPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListByMonitorPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByMonitorPager) { + p.newListByMonitorPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to ProviderInstancesServerTransport +var providerInstancesServerTransportInterceptor 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/workloads/sapmonitors/fake/saplandscapemonitor_server.go b/sdk/resourcemanager/workloads/sapmonitors/fake/saplandscapemonitor_server.go new file mode 100644 index 000000000000..ef0f130eaef4 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/fake/saplandscapemonitor_server.go @@ -0,0 +1,299 @@ +// 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 ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/sapmonitors" + "net/http" + "net/url" + "regexp" +) + +// SapLandscapeMonitorServer is a fake server for instances of the sapmonitors.SapLandscapeMonitorClient type. +type SapLandscapeMonitorServer struct { + // Create is the fake for method SapLandscapeMonitorClient.Create + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + Create func(ctx context.Context, resourceGroupName string, monitorName string, resource sapmonitors.SapLandscapeMonitorResource, options *sapmonitors.SapLandscapeMonitorClientCreateOptions) (resp azfake.Responder[sapmonitors.SapLandscapeMonitorClientCreateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method SapLandscapeMonitorClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, monitorName string, options *sapmonitors.SapLandscapeMonitorClientDeleteOptions) (resp azfake.Responder[sapmonitors.SapLandscapeMonitorClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SapLandscapeMonitorClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, monitorName string, options *sapmonitors.SapLandscapeMonitorClientGetOptions) (resp azfake.Responder[sapmonitors.SapLandscapeMonitorClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByMonitorPager is the fake for method SapLandscapeMonitorClient.NewListByMonitorPager + // HTTP status codes to indicate success: http.StatusOK + NewListByMonitorPager func(resourceGroupName string, monitorName string, options *sapmonitors.SapLandscapeMonitorClientListByMonitorOptions) (resp azfake.PagerResponder[sapmonitors.SapLandscapeMonitorClientListByMonitorResponse]) + + // Update is the fake for method SapLandscapeMonitorClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, monitorName string, properties sapmonitors.SapLandscapeMonitorResource, options *sapmonitors.SapLandscapeMonitorClientUpdateOptions) (resp azfake.Responder[sapmonitors.SapLandscapeMonitorClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewSapLandscapeMonitorServerTransport creates a new instance of SapLandscapeMonitorServerTransport with the provided implementation. +// The returned SapLandscapeMonitorServerTransport instance is connected to an instance of sapmonitors.SapLandscapeMonitorClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSapLandscapeMonitorServerTransport(srv *SapLandscapeMonitorServer) *SapLandscapeMonitorServerTransport { + return &SapLandscapeMonitorServerTransport{ + srv: srv, + newListByMonitorPager: newTracker[azfake.PagerResponder[sapmonitors.SapLandscapeMonitorClientListByMonitorResponse]](), + } +} + +// SapLandscapeMonitorServerTransport connects instances of sapmonitors.SapLandscapeMonitorClient to instances of SapLandscapeMonitorServer. +// Don't use this type directly, use NewSapLandscapeMonitorServerTransport instead. +type SapLandscapeMonitorServerTransport struct { + srv *SapLandscapeMonitorServer + newListByMonitorPager *tracker[azfake.PagerResponder[sapmonitors.SapLandscapeMonitorClientListByMonitorResponse]] +} + +// Do implements the policy.Transporter interface for SapLandscapeMonitorServerTransport. +func (s *SapLandscapeMonitorServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return s.dispatchToMethodFake(req, method) +} + +func (s *SapLandscapeMonitorServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if sapLandscapeMonitorServerTransportInterceptor != nil { + res.resp, res.err, intercepted = sapLandscapeMonitorServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SapLandscapeMonitorClient.Create": + res.resp, res.err = s.dispatchCreate(req) + case "SapLandscapeMonitorClient.Delete": + res.resp, res.err = s.dispatchDelete(req) + case "SapLandscapeMonitorClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SapLandscapeMonitorClient.NewListByMonitorPager": + res.resp, res.err = s.dispatchNewListByMonitorPager(req) + case "SapLandscapeMonitorClient.Update": + res.resp, res.err = s.dispatchUpdate(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 (s *SapLandscapeMonitorServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { + if s.srv.Create == nil { + return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/monitors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sapLandscapeMonitor/default` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[sapmonitors.SapLandscapeMonitorResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + monitorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("monitorName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Create(req.Context(), resourceGroupNameParam, monitorNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SapLandscapeMonitorResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SapLandscapeMonitorServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if s.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/monitors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sapLandscapeMonitor/default` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + monitorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("monitorName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Delete(req.Context(), resourceGroupNameParam, monitorNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SapLandscapeMonitorServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/monitors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sapLandscapeMonitor/default` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + monitorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("monitorName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, monitorNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SapLandscapeMonitorResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SapLandscapeMonitorServerTransport) dispatchNewListByMonitorPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByMonitorPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByMonitorPager not implemented")} + } + newListByMonitorPager := s.newListByMonitorPager.get(req) + if newListByMonitorPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/monitors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sapLandscapeMonitor` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + monitorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("monitorName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListByMonitorPager(resourceGroupNameParam, monitorNameParam, nil) + newListByMonitorPager = &resp + s.newListByMonitorPager.add(req, newListByMonitorPager) + server.PagerResponderInjectNextLinks(newListByMonitorPager, req, func(page *sapmonitors.SapLandscapeMonitorClientListByMonitorResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByMonitorPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListByMonitorPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByMonitorPager) { + s.newListByMonitorPager.remove(req) + } + return resp, nil +} + +func (s *SapLandscapeMonitorServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if s.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/monitors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sapLandscapeMonitor/default` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[sapmonitors.SapLandscapeMonitorResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + monitorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("monitorName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Update(req.Context(), resourceGroupNameParam, monitorNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SapLandscapeMonitorResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to SapLandscapeMonitorServerTransport +var sapLandscapeMonitorServerTransportInterceptor 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/workloads/sapmonitors/fake/server_factory.go b/sdk/resourcemanager/workloads/sapmonitors/fake/server_factory.go new file mode 100644 index 000000000000..74ff9f780a31 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/fake/server_factory.go @@ -0,0 +1,114 @@ +// 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 ( + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" + "sync" +) + +// ServerFactory is a fake server for instances of the sapmonitors.ClientFactory type. +type ServerFactory struct { + // AlertTemplatesServer contains the fakes for client AlertTemplatesClient + AlertTemplatesServer AlertTemplatesServer + + // AlertsServer contains the fakes for client AlertsClient + AlertsServer AlertsServer + + // MonitorsServer contains the fakes for client MonitorsClient + MonitorsServer MonitorsServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // ProviderInstancesServer contains the fakes for client ProviderInstancesClient + ProviderInstancesServer ProviderInstancesServer + + // SapLandscapeMonitorServer contains the fakes for client SapLandscapeMonitorClient + SapLandscapeMonitorServer SapLandscapeMonitorServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of sapmonitors.ClientFactory via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { + return &ServerFactoryTransport{ + srv: srv, + } +} + +// ServerFactoryTransport connects instances of sapmonitors.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trAlertTemplatesServer *AlertTemplatesServerTransport + trAlertsServer *AlertsServerTransport + trMonitorsServer *MonitorsServerTransport + trOperationsServer *OperationsServerTransport + trProviderInstancesServer *ProviderInstancesServerTransport + trSapLandscapeMonitorServer *SapLandscapeMonitorServerTransport +} + +// Do implements the policy.Transporter interface for ServerFactoryTransport. +func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + client := method[:strings.Index(method, ".")] + var resp *http.Response + var err error + + switch client { + case "AlertTemplatesClient": + initServer(s, &s.trAlertTemplatesServer, func() *AlertTemplatesServerTransport { + return NewAlertTemplatesServerTransport(&s.srv.AlertTemplatesServer) + }) + resp, err = s.trAlertTemplatesServer.Do(req) + case "AlertsClient": + initServer(s, &s.trAlertsServer, func() *AlertsServerTransport { return NewAlertsServerTransport(&s.srv.AlertsServer) }) + resp, err = s.trAlertsServer.Do(req) + case "MonitorsClient": + initServer(s, &s.trMonitorsServer, func() *MonitorsServerTransport { return NewMonitorsServerTransport(&s.srv.MonitorsServer) }) + resp, err = s.trMonitorsServer.Do(req) + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + case "ProviderInstancesClient": + initServer(s, &s.trProviderInstancesServer, func() *ProviderInstancesServerTransport { + return NewProviderInstancesServerTransport(&s.srv.ProviderInstancesServer) + }) + resp, err = s.trProviderInstancesServer.Do(req) + case "SapLandscapeMonitorClient": + initServer(s, &s.trSapLandscapeMonitorServer, func() *SapLandscapeMonitorServerTransport { + return NewSapLandscapeMonitorServerTransport(&s.srv.SapLandscapeMonitorServer) + }) + resp, err = s.trSapLandscapeMonitorServer.Do(req) + default: + err = fmt.Errorf("unhandled client %s", client) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { + s.trMu.Lock() + if *dst == nil { + *dst = src() + } + s.trMu.Unlock() +} diff --git a/sdk/resourcemanager/workloads/sapmonitors/go.mod b/sdk/resourcemanager/workloads/sapmonitors/go.mod new file mode 100644 index 000000000000..eed85e07f3e7 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/go.mod @@ -0,0 +1,13 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/workloads/sapmonitors + +go 1.23.0 + +toolchain go1.23.8 + +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect + golang.org/x/net v0.37.0 // indirect + golang.org/x/text v0.23.0 // indirect +) diff --git a/sdk/resourcemanager/workloads/sapmonitors/go.sum b/sdk/resourcemanager/workloads/sapmonitors/go.sum new file mode 100644 index 000000000000..cfff861c9769 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/go.sum @@ -0,0 +1,16 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 h1:DSDNVxqkoXJiko6x8a90zidoYqnYYa6c1MTzDKzKkTo= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1/go.mod h1:zGqV2R4Cr/k8Uye5w+dgQ06WJtEcbQG/8J7BB6hnCr4= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 h1:ywEEhmNahHBihViHepv3xPBn1663uRv2t2q/ESv9seY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0/go.mod h1:iZDifYGJTIgIIkYRNWPENUnqx6bJ2xnSDFI2tjwZNuY= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c= +golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= +golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= +golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/workloads/sapmonitors/interfaces.go b/sdk/resourcemanager/workloads/sapmonitors/interfaces.go new file mode 100644 index 000000000000..5d42fa6145fc --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/interfaces.go @@ -0,0 +1,17 @@ +// 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 sapmonitors + +// ProviderSpecificPropertiesClassification provides polymorphic access to related types. +// Call the interface's GetProviderSpecificProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *Db2ProviderInstanceProperties, *HanaDbProviderInstanceProperties, *MsSQLServerProviderInstanceProperties, *OracleProviderInstanceProperties, +// - *PrometheusHaClusterProviderInstanceProperties, *PrometheusOsProviderInstanceProperties, *ProviderSpecificProperties, +// - *SapNetWeaverProviderInstanceProperties +type ProviderSpecificPropertiesClassification interface { + // GetProviderSpecificProperties returns the ProviderSpecificProperties content of the underlying type. + GetProviderSpecificProperties() *ProviderSpecificProperties +} diff --git a/sdk/resourcemanager/workloads/sapmonitors/models.go b/sdk/resourcemanager/workloads/sapmonitors/models.go new file mode 100644 index 000000000000..a6b291e1f69d --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/models.go @@ -0,0 +1,854 @@ +// 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 sapmonitors + +import "time" + +// Alert - A alert associated with SAP monitor. +type Alert struct { + // Alert Instance properties + Properties *AlertProperties + + // 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 + 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 +} + +// AlertListResult - The response of a Alert list operation. +type AlertListResult struct { + // REQUIRED; The Alert items on this page + Value []*Alert + + // The link to the next page of items + NextLink *string +} + +// AlertProperties - Describes the properties of an Alert for SAP monitor. +type AlertProperties struct { + // Describes the properties of an alert. + AlertRuleProperties *AlertRuleProperties + + // Name of provider instances associated with the alert. + ProviderNames []*string + + // The provider type for alert. For example, the value can be SapHana. + ProviderType *string + + // Name of the alert template from which it was created. + TemplateName *string + + // READ-ONLY; ID of the alert rule resource created. + AlertRuleResourceID *string + + // READ-ONLY; Defines the alert instance errors. + Errors *ErrorDetail + + // READ-ONLY; State of provisioning of the alert instance + ProvisioningState *WorkloadMonitorProvisioningState +} + +// AlertQueryParameter - Defines the Alert Query Parameter. +type AlertQueryParameter struct { + // The name of the alert query parameter. + Name *string + + // The value of the alert query parameter. + Value *string +} + +// AlertRuleProperties - Describes the properties of an alert. +type AlertRuleProperties struct { + // Action Group resource Ids to invoke when the alert fires + ActionGroups []*string + + // The alert query parameters. + AlertQueryParameters []*AlertQueryParameter + + // The value that indicates whether the alert should be automatically resolved or not. The default is Disable. + AutoMitigate *AlertAutoMitigate + + // Evaluation of metric on a particular column. + Dimension *string + + // How often the scheduled query rule is evaluated. + EvaluationFrequency *int32 + + // The operator for failing periods. + FailingPeriodsOperator *ConditionalOperator + + // The number of failing periods to trigger an alert. + FailingPeriodsToAlert *int32 + + // Mute actions for the chosen period of time after the alert is fired. + MuteActionsDuration *int32 + + // Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. + Severity *int32 + + // Indicates whether the alert is in an enabled state. + Status *AlertRuleStatus + + // The threshold of the alert. + Threshold *int32 + + // The threshold operator of the alert. + ThresholdOperator *ConditionalOperator + + // The period of time on which the Alert query will be executed. + WindowSize *int32 +} + +// AlertTemplate - Concrete proxy resource types can be created by aliasing this type using a specific property type. +type AlertTemplate struct { + // Alert Template properties + Properties *AlertTemplateProperties + + // 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 + 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 +} + +// AlertTemplateListResult - The response of a AlertTemplate list operation. +type AlertTemplateListResult struct { + // REQUIRED; The AlertTemplate items on this page + Value []*AlertTemplate + + // The link to the next page of items + NextLink *string +} + +// AlertTemplateMetricMeasurement - Defines the Alert Template MetricMeasurement Properties. +type AlertTemplateMetricMeasurement struct { + // Frequency (mins) value Associated with the Alert Template for Metric Measurement. + FrequencyInMinutes *int32 + + // Metric Column Associated with the Alert Template for Metric Measurement. + MetricColumn *string + + // Metric Trigger Type Associated with the Alert Template for Metric Measurement. + MetricTriggerType *AlertTemplateMetricTriggerType + + // The Threshold Value Associated with the Alert Template for Metric Measurement. + Threshold *int32 + + // Operator used for threshold comparison. + ThresholdOperator *ConditionalOperator + + // Time Window (mins) Value Associated with the Alert Template for Metric Measurement. + TimeWindowInMinutes *int32 +} + +// AlertTemplateProperties - Describes the properties of an Alert Template for SAP monitor. +type AlertTemplateProperties struct { + // Unit of the alert. + AlertUnit *string + + // Default threshold value. + DefaultThreshold *int32 + + // Input option for the default threshold. + DefaultThresholdInputOption *DefaultThresholdInputOption + + // Description of the template. + Description *string + + // Minimum possible Default Threshold Value Associated with the Alert Template. + LowerBound *int32 + + // Describes the properties for metric measurement in alerts template. + MetricMeasurement *AlertTemplateMetricMeasurement + + // The provider type for alert template. For example, the value can be SapHana. + ProviderType *string + + // Query associated with the alert template. + Query *string + + // Describes the Query Input Parameter properties in alerts template. + QueryInputParameters []*AlertTemplateQueryInputParameter + + // Severity of the alert. Should be an integer between [0-4]. Value of 0 is most severe and value of 4 is least severe. + Severity *int32 + + // Display name of the alert template. + TemplateDisplayName *string + + // Operator used for threshold comparison. + ThresholdOperator *ConditionalOperator + + // Maximum possible Default Threshold Value Associated with the Alert Template. + UpperBound *int32 + + // READ-ONLY; Defines the SAP monitor Alert Template errors. + Errors *ErrorDetail + + // READ-ONLY; State of provisioning of the Alert Template. + ProvisioningState *WorkloadMonitorProvisioningState +} + +// AlertTemplateQueryInputParameter - Describes the Query Input Parameter properties in alerts template. +type AlertTemplateQueryInputParameter struct { + // Default Value of the Query Input Parameter + DefaultValue *string + + // Description of the Query Input Parameter + Description *string + + // Display Name of the Query Input Parameter. + DisplayName *string + + // Log Analytics query associated with the parameter. + LaQuery *string + + // Name of the Query Input Parameter + Name *string + + // Selection mode for the parameter. + SelectionMode *AlertTemplateSelectionMode + + // Type of the Query Input Parameter + Type *AlertTemplateParameterType +} + +// AppServicePlanConfiguration - Configuration details of app service plan +type AppServicePlanConfiguration struct { + // The number of workers in app service plan. If this is not set or set to 0, auto scale will be configured for the app service + // plan, otherwise, instance count is set to this number. + Capacity *int32 + + // The App Service plan tier. + Tier *AppServicePlanTier +} + +// Db2ProviderInstanceProperties - Gets or sets the DB2 provider properties. +type Db2ProviderInstanceProperties struct { + // REQUIRED; The provider type. For example, the value can be SapHana. + ProviderType *string + + // Gets or sets the db2 database name. + DbName *string + + // Gets or sets the db2 database password. + DbPassword *string + + // Gets or sets the key vault URI to secret with the database password. + DbPasswordURI *string + + // Gets or sets the db2 database sql port. + DbPort *string + + // Gets or sets the db2 database user name. + DbUsername *string + + // Gets or sets the target virtual machine name. + Hostname *string + + // Gets or sets the blob URI to SSL certificate for the DB2 Database. + SSLCertificateURI *string + + // Gets or sets certificate preference if secure communication is enabled. + SSLPreference *SSLPreference + + // Gets or sets the SAP System Identifier + SapSid *string +} + +// GetProviderSpecificProperties implements the ProviderSpecificPropertiesClassification interface for type Db2ProviderInstanceProperties. +func (d *Db2ProviderInstanceProperties) GetProviderSpecificProperties() *ProviderSpecificProperties { + return &ProviderSpecificProperties{ + ProviderType: d.ProviderType, + } +} + +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info any + + // READ-ONLY; The additional info type. + Type *string +} + +// ErrorDetail - The error detail. +type ErrorDetail struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo + + // READ-ONLY; The error code. + Code *string + + // READ-ONLY; The error details. + Details []*ErrorDetail + + // READ-ONLY; The error message. + Message *string + + // READ-ONLY; The error target. + Target *string +} + +// HanaDbProviderInstanceProperties - Gets or sets the provider properties. +type HanaDbProviderInstanceProperties struct { + // REQUIRED; The provider type. For example, the value can be SapHana. + ProviderType *string + + // Gets or sets the hana database name. + DbName *string + + // Gets or sets the database password. + DbPassword *string + + // Gets or sets the key vault URI to secret with the database password. + DbPasswordURI *string + + // Gets or sets the database user name. + DbUsername *string + + // Gets or sets the target virtual machine size. + Hostname *string + + // Gets or sets the database instance number. + InstanceNumber *string + + // Gets or sets the database sql port. + SQLPort *string + + // Gets or sets the blob URI to SSL certificate for the DB. + SSLCertificateURI *string + + // Gets or sets the hostname(s) in the SSL certificate. + SSLHostNameInCertificate *string + + // Gets or sets certificate preference if secure communication is enabled. + SSLPreference *SSLPreference + + // Gets or sets the SAP System Identifier. + SapSid *string +} + +// GetProviderSpecificProperties implements the ProviderSpecificPropertiesClassification interface for type HanaDbProviderInstanceProperties. +func (h *HanaDbProviderInstanceProperties) GetProviderSpecificProperties() *ProviderSpecificProperties { + return &ProviderSpecificProperties{ + ProviderType: h.ProviderType, + } +} + +// Health - Resource health details +type Health struct { + // READ-ONLY; Health state of the resource + HealthState *WorkloadProviderInstanceHealthState + + // READ-ONLY; Reasons impacting health state + ImpactingReasons *string +} + +// ManagedResourceGroupConfiguration - Managed resource group configuration +type ManagedResourceGroupConfiguration struct { + // Managed resource group name + Name *string +} + +// ManagedServiceIdentity - Managed service identity (system assigned and/or user assigned identities) +type ManagedServiceIdentity struct { + // REQUIRED; Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + Type *ManagedServiceIdentityType + + // The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM + // resource ids in the form: + // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + // The dictionary values can be empty objects ({}) in + // requests. + UserAssignedIdentities map[string]*UserAssignedIdentity + + // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned + // identity. + PrincipalID *string + + // READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *string +} + +// Monitor - SAP monitor info on Azure (ARM properties and SAP monitor properties) +type Monitor struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The managed service identities assigned to this resource. + Identity *ManagedServiceIdentity + + // The resource-specific properties for this resource. + Properties *MonitorProperties + + // Resource tags. + Tags map[string]*string + + // 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 + 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 +} + +// MonitorListResult - The response of a Monitor list operation. +type MonitorListResult struct { + // REQUIRED; The Monitor items on this page + Value []*Monitor + + // The link to the next page of items + NextLink *string +} + +// MonitorProperties - Describes the properties of a SAP monitor. +type MonitorProperties struct { + // The SAP monitor resources will be deployed in the SAP monitoring region. The subnet region should be same as the SAP monitoring + // region. + AppLocation *string + + // App service plan configuration + AppServicePlanConfiguration *AppServicePlanConfiguration + + // The ARM ID of the Log Analytics Workspace that is used for SAP monitoring. + LogAnalyticsWorkspaceArmID *string + + // Managed resource group configuration + ManagedResourceGroupConfiguration *ManagedResourceGroupConfiguration + + // The subnet which the SAP monitor will be deployed in + MonitorSubnet *string + + // Sets the routing preference of the SAP monitor. By default only RFC1918 traffic is routed to the customer VNET. + RoutingPreference *RoutingPreference + + // Sets the preference for zone redundancy on resources created for the SAP monitor. By default resources will be created + // which do not support zone redundancy. + ZoneRedundancyPreference *string + + // READ-ONLY; Defines the SAP monitor errors. + Errors *ErrorDetail + + // READ-ONLY; The ARM ID of the MSI used for SAP monitoring. + MsiArmID *string + + // READ-ONLY; State of provisioning of the SAP monitor. + ProvisioningState *WorkloadMonitorProvisioningState + + // READ-ONLY; The ARM ID of the Storage account used for SAP monitoring. + StorageAccountArmID *string +} + +// MsSQLServerProviderInstanceProperties - Gets or sets the SQL server provider properties. +type MsSQLServerProviderInstanceProperties struct { + // REQUIRED; The provider type. For example, the value can be SapHana. + ProviderType *string + + // Gets or sets the database password. + DbPassword *string + + // Gets or sets the key vault URI to secret with the database password. + DbPasswordURI *string + + // Gets or sets the database sql port. + DbPort *string + + // Gets or sets the database user name. + DbUsername *string + + // Gets or sets the SQL server host name. + Hostname *string + + // Gets or sets the blob URI to SSL certificate for the SQL Database. + SSLCertificateURI *string + + // Gets or sets certificate preference if secure communication is enabled. + SSLPreference *SSLPreference + + // Gets or sets the SAP System Identifier + SapSid *string +} + +// GetProviderSpecificProperties implements the ProviderSpecificPropertiesClassification interface for type MsSQLServerProviderInstanceProperties. +func (m *MsSQLServerProviderInstanceProperties) GetProviderSpecificProperties() *ProviderSpecificProperties { + return &ProviderSpecificProperties{ + ProviderType: m.ProviderType, + } +} + +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane + // operations. + IsDataAction *bool + + // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", + // "Microsoft.Compute/virtualMachines/capture/action" + Name *string + + // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + // value is "user,system" + Origin *Origin +} + +// OperationDisplay - Localized display information for this particular operation. +type OperationDisplay struct { + // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. + Description *string + + // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + // Machine", "Restart Virtual Machine". + Operation *string + + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". + Provider *string + + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". + Resource *string +} + +// OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to +// get the next set of results. +type OperationListResult struct { + // READ-ONLY; URL to get the next set of operation list results (if there are any). + NextLink *string + + // READ-ONLY; List of operations supported by the resource provider + Value []*Operation +} + +// OracleProviderInstanceProperties - Gets or sets the Oracle provider properties. +type OracleProviderInstanceProperties struct { + // REQUIRED; The provider type. For example, the value can be SapHana. + ProviderType *string + + // Gets or sets the oracle database name. + DbName *string + + // Gets or sets the oracle database password. + DbPassword *string + + // Gets or sets the key vault URI to secret with the database password. + DbPasswordURI *string + + // Gets or sets the oracle database sql port. + DbPort *string + + // Gets or sets the oracle database user name. + DbUsername *string + + // Gets or sets the target virtual machine name. + Hostname *string + + // Gets or sets the blob URI to SSL certificate for the Oracle Database. + SSLCertificateURI *string + + // Gets or sets certificate preference if secure communication is enabled. + SSLPreference *SSLPreference + + // Gets or sets the SAP System Identifier + SapSid *string +} + +// GetProviderSpecificProperties implements the ProviderSpecificPropertiesClassification interface for type OracleProviderInstanceProperties. +func (o *OracleProviderInstanceProperties) GetProviderSpecificProperties() *ProviderSpecificProperties { + return &ProviderSpecificProperties{ + ProviderType: o.ProviderType, + } +} + +// PrometheusHaClusterProviderInstanceProperties - Gets or sets the PrometheusHaCluster provider properties. +type PrometheusHaClusterProviderInstanceProperties struct { + // REQUIRED; The provider type. For example, the value can be SapHana. + ProviderType *string + + // Gets or sets the clusterName. + ClusterName *string + + // Gets or sets the target machine name. + Hostname *string + + // URL of the Node Exporter endpoint. + PrometheusURL *string + + // Gets or sets the blob URI to SSL certificate for the HA cluster exporter. + SSLCertificateURI *string + + // Gets or sets certificate preference if secure communication is enabled. + SSLPreference *SSLPreference + + // Gets or sets the cluster sid. + Sid *string +} + +// GetProviderSpecificProperties implements the ProviderSpecificPropertiesClassification interface for type PrometheusHaClusterProviderInstanceProperties. +func (p *PrometheusHaClusterProviderInstanceProperties) GetProviderSpecificProperties() *ProviderSpecificProperties { + return &ProviderSpecificProperties{ + ProviderType: p.ProviderType, + } +} + +// PrometheusOsProviderInstanceProperties - Gets or sets the PrometheusOS provider properties. +type PrometheusOsProviderInstanceProperties struct { + // REQUIRED; The provider type. For example, the value can be SapHana. + ProviderType *string + + // URL of the Node Exporter endpoint + PrometheusURL *string + + // Gets or sets the blob URI to SSL certificate for the prometheus node exporter. + SSLCertificateURI *string + + // Gets or sets certificate preference if secure communication is enabled. + SSLPreference *SSLPreference + + // Gets or sets the SAP System Identifier + SapSid *string +} + +// GetProviderSpecificProperties implements the ProviderSpecificPropertiesClassification interface for type PrometheusOsProviderInstanceProperties. +func (p *PrometheusOsProviderInstanceProperties) GetProviderSpecificProperties() *ProviderSpecificProperties { + return &ProviderSpecificProperties{ + ProviderType: p.ProviderType, + } +} + +// ProviderInstance - A provider instance associated with SAP monitor. +type ProviderInstance struct { + // The resource-specific properties for this resource. + Properties *ProviderInstanceProperties + + // 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 + 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 +} + +// ProviderInstanceListResult - The response of a ProviderInstance list operation. +type ProviderInstanceListResult struct { + // REQUIRED; The ProviderInstance items on this page + Value []*ProviderInstance + + // The link to the next page of items + NextLink *string +} + +// ProviderInstanceProperties - Describes the properties of a provider instance. +type ProviderInstanceProperties struct { + // Defines the provider specific properties. + ProviderSettings ProviderSpecificPropertiesClassification + + // READ-ONLY; Defines the provider instance errors. + Errors *ErrorDetail + + // READ-ONLY; Resource health details + Health *Health + + // READ-ONLY; State of provisioning of the provider instance + ProvisioningState *WorkloadMonitorProvisioningState +} + +// ProviderSpecificProperties - Gets or sets the provider specific properties. +type ProviderSpecificProperties struct { + // REQUIRED; The provider type. For example, the value can be SapHana. + ProviderType *string +} + +// GetProviderSpecificProperties implements the ProviderSpecificPropertiesClassification interface for type ProviderSpecificProperties. +func (p *ProviderSpecificProperties) GetProviderSpecificProperties() *ProviderSpecificProperties { + return p +} + +// SapLandscapeMonitorMetricThresholds - Gets or sets the Threshold Values for Top Metrics Health. +type SapLandscapeMonitorMetricThresholds struct { + // Gets or sets the threshold value for Green. + Green *float32 + + // Gets or sets the name of the threshold. + Name *string + + // Gets or sets the threshold value for Red. + Red *float32 + + // Gets or sets the threshold value for Yellow. + Yellow *float32 +} + +// SapLandscapeMonitorProperties - Gets or sets the properties for Sap Landscape Monitor Dashboard. +type SapLandscapeMonitorProperties struct { + // Gets or sets the SID groupings by landscape and Environment. + Grouping *SapLandscapeMonitorPropertiesGrouping + + // Gets or sets the list Top Metric Thresholds for SAP Landscape Monitor Dashboard + TopMetricsThresholds []*SapLandscapeMonitorMetricThresholds + + // READ-ONLY; State of provisioning of the SAP monitor. + ProvisioningState *SapLandscapeMonitorProvisioningState +} + +// SapLandscapeMonitorPropertiesGrouping - Gets or sets the SID groupings by landscape and Environment. +type SapLandscapeMonitorPropertiesGrouping struct { + // Gets or sets the list of landscape to SID mappings. + Landscape []*SapLandscapeMonitorSidMapping + + // Gets or sets the list of Sap Applications to SID mappings. + SapApplication []*SapLandscapeMonitorSidMapping +} + +// SapLandscapeMonitorResource - configuration associated with SAP Landscape Monitor Dashboard. +type SapLandscapeMonitorResource struct { + // The resource-specific properties for this resource. + Properties *SapLandscapeMonitorProperties + + // 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 + 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 +} + +// SapLandscapeMonitorResourceListResult - The response of a SapLandscapeMonitorResource list operation. +type SapLandscapeMonitorResourceListResult struct { + // REQUIRED; The SapLandscapeMonitorResource items on this page + Value []*SapLandscapeMonitorResource + + // The link to the next page of items + NextLink *string +} + +// SapLandscapeMonitorSidMapping - Gets or sets the mapping for SID to Environment/Applications. +type SapLandscapeMonitorSidMapping struct { + // Gets or sets the name of the grouping. + Name *string + + // Gets or sets the list of SID's. + TopSid []*string +} + +// SapNetWeaverProviderInstanceProperties - Gets or sets the provider properties. +type SapNetWeaverProviderInstanceProperties struct { + // REQUIRED; The provider type. For example, the value can be SapHana. + ProviderType *string + + // Gets or sets the blob URI to SSL certificate for the SAP system. + SSLCertificateURI *string + + // Gets or sets certificate preference if secure communication is enabled. + SSLPreference *SSLPreference + + // Gets or sets the SAP Client ID. + SapClientID *string + + // Gets or sets the list of HostFile Entries + SapHostFileEntries []*string + + // Gets or sets the target virtual machine IP Address/FQDN. + SapHostname *string + + // Gets or sets the instance number of SAP NetWeaver. + SapInstanceNr *string + + // Sets the SAP password. + SapPassword *string + + // Gets or sets the key vault URI to secret with the SAP password. + SapPasswordURI *string + + // Gets or sets the SAP HTTP port number. + SapPortNumber *string + + // Gets or sets the SAP System Identifier + SapSid *string + + // Gets or sets the SAP user name. + SapUsername *string +} + +// GetProviderSpecificProperties implements the ProviderSpecificPropertiesClassification interface for type SapNetWeaverProviderInstanceProperties. +func (s *SapNetWeaverProviderInstanceProperties) GetProviderSpecificProperties() *ProviderSpecificProperties { + return &ProviderSpecificProperties{ + ProviderType: s.ProviderType, + } +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time + + // The identity that created the resource. + CreatedBy *string + + // The type of identity that created the resource. + CreatedByType *CreatedByType + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time + + // The identity that last modified the resource. + LastModifiedBy *string + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType +} + +// UpdateMonitorRequest - Defines the request body for updating SAP monitor resource. +type UpdateMonitorRequest struct { + // The managed service identities assigned to this resource. + Identity *ManagedServiceIdentity + + // Resource tags. + Tags map[string]*string +} + +// UserAssignedIdentity - User assigned identity properties +type UserAssignedIdentity struct { + // READ-ONLY; The client ID of the assigned identity. + ClientID *string + + // READ-ONLY; The principal ID of the assigned identity. + PrincipalID *string +} diff --git a/sdk/resourcemanager/workloads/sapmonitors/models_serde.go b/sdk/resourcemanager/workloads/sapmonitors/models_serde.go new file mode 100644 index 000000000000..0bc9fcafdc64 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/models_serde.go @@ -0,0 +1,1877 @@ +// 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 sapmonitors + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type Alert. +func (a Alert) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Alert. +func (a *Alert) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AlertListResult. +func (a AlertListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertListResult. +func (a *AlertListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AlertProperties. +func (a AlertProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "alertRuleProperties", a.AlertRuleProperties) + populate(objectMap, "alertRuleResourceId", a.AlertRuleResourceID) + populate(objectMap, "errors", a.Errors) + populate(objectMap, "providerNames", a.ProviderNames) + populate(objectMap, "providerType", a.ProviderType) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "templateName", a.TemplateName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertProperties. +func (a *AlertProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertRuleProperties": + err = unpopulate(val, "AlertRuleProperties", &a.AlertRuleProperties) + delete(rawMsg, key) + case "alertRuleResourceId": + err = unpopulate(val, "AlertRuleResourceID", &a.AlertRuleResourceID) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &a.Errors) + delete(rawMsg, key) + case "providerNames": + err = unpopulate(val, "ProviderNames", &a.ProviderNames) + delete(rawMsg, key) + case "providerType": + err = unpopulate(val, "ProviderType", &a.ProviderType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "templateName": + err = unpopulate(val, "TemplateName", &a.TemplateName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AlertQueryParameter. +func (a AlertQueryParameter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", a.Name) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertQueryParameter. +func (a *AlertQueryParameter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AlertRuleProperties. +func (a AlertRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionGroups", a.ActionGroups) + populate(objectMap, "alertQueryParameters", a.AlertQueryParameters) + populate(objectMap, "autoMitigate", a.AutoMitigate) + populate(objectMap, "dimension", a.Dimension) + populate(objectMap, "evaluationFrequency", a.EvaluationFrequency) + populate(objectMap, "failingPeriodsOperator", a.FailingPeriodsOperator) + populate(objectMap, "failingPeriodsToAlert", a.FailingPeriodsToAlert) + populate(objectMap, "muteActionsDuration", a.MuteActionsDuration) + populate(objectMap, "severity", a.Severity) + populate(objectMap, "status", a.Status) + populate(objectMap, "threshold", a.Threshold) + populate(objectMap, "thresholdOperator", a.ThresholdOperator) + populate(objectMap, "windowSize", a.WindowSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleProperties. +func (a *AlertRuleProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionGroups": + err = unpopulate(val, "ActionGroups", &a.ActionGroups) + delete(rawMsg, key) + case "alertQueryParameters": + err = unpopulate(val, "AlertQueryParameters", &a.AlertQueryParameters) + delete(rawMsg, key) + case "autoMitigate": + err = unpopulate(val, "AutoMitigate", &a.AutoMitigate) + delete(rawMsg, key) + case "dimension": + err = unpopulate(val, "Dimension", &a.Dimension) + delete(rawMsg, key) + case "evaluationFrequency": + err = unpopulate(val, "EvaluationFrequency", &a.EvaluationFrequency) + delete(rawMsg, key) + case "failingPeriodsOperator": + err = unpopulate(val, "FailingPeriodsOperator", &a.FailingPeriodsOperator) + delete(rawMsg, key) + case "failingPeriodsToAlert": + err = unpopulate(val, "FailingPeriodsToAlert", &a.FailingPeriodsToAlert) + delete(rawMsg, key) + case "muteActionsDuration": + err = unpopulate(val, "MuteActionsDuration", &a.MuteActionsDuration) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &a.Severity) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &a.Status) + delete(rawMsg, key) + case "threshold": + err = unpopulate(val, "Threshold", &a.Threshold) + delete(rawMsg, key) + case "thresholdOperator": + err = unpopulate(val, "ThresholdOperator", &a.ThresholdOperator) + delete(rawMsg, key) + case "windowSize": + err = unpopulate(val, "WindowSize", &a.WindowSize) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AlertTemplate. +func (a AlertTemplate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertTemplate. +func (a *AlertTemplate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AlertTemplateListResult. +func (a AlertTemplateListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertTemplateListResult. +func (a *AlertTemplateListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AlertTemplateMetricMeasurement. +func (a AlertTemplateMetricMeasurement) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "frequencyInMinutes", a.FrequencyInMinutes) + populate(objectMap, "metricColumn", a.MetricColumn) + populate(objectMap, "metricTriggerType", a.MetricTriggerType) + populate(objectMap, "threshold", a.Threshold) + populate(objectMap, "thresholdOperator", a.ThresholdOperator) + populate(objectMap, "timeWindowInMinutes", a.TimeWindowInMinutes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertTemplateMetricMeasurement. +func (a *AlertTemplateMetricMeasurement) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "frequencyInMinutes": + err = unpopulate(val, "FrequencyInMinutes", &a.FrequencyInMinutes) + delete(rawMsg, key) + case "metricColumn": + err = unpopulate(val, "MetricColumn", &a.MetricColumn) + delete(rawMsg, key) + case "metricTriggerType": + err = unpopulate(val, "MetricTriggerType", &a.MetricTriggerType) + delete(rawMsg, key) + case "threshold": + err = unpopulate(val, "Threshold", &a.Threshold) + delete(rawMsg, key) + case "thresholdOperator": + err = unpopulate(val, "ThresholdOperator", &a.ThresholdOperator) + delete(rawMsg, key) + case "timeWindowInMinutes": + err = unpopulate(val, "TimeWindowInMinutes", &a.TimeWindowInMinutes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AlertTemplateProperties. +func (a AlertTemplateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "alertUnit", a.AlertUnit) + populate(objectMap, "defaultThreshold", a.DefaultThreshold) + populate(objectMap, "defaultThresholdInputOption", a.DefaultThresholdInputOption) + populate(objectMap, "description", a.Description) + populate(objectMap, "errors", a.Errors) + populate(objectMap, "lowerBound", a.LowerBound) + populate(objectMap, "metricMeasurement", a.MetricMeasurement) + populate(objectMap, "providerType", a.ProviderType) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "query", a.Query) + populate(objectMap, "queryInputParameters", a.QueryInputParameters) + populate(objectMap, "severity", a.Severity) + populate(objectMap, "templateDisplayName", a.TemplateDisplayName) + populate(objectMap, "thresholdOperator", a.ThresholdOperator) + populate(objectMap, "upperBound", a.UpperBound) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertTemplateProperties. +func (a *AlertTemplateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertUnit": + err = unpopulate(val, "AlertUnit", &a.AlertUnit) + delete(rawMsg, key) + case "defaultThreshold": + err = unpopulate(val, "DefaultThreshold", &a.DefaultThreshold) + delete(rawMsg, key) + case "defaultThresholdInputOption": + err = unpopulate(val, "DefaultThresholdInputOption", &a.DefaultThresholdInputOption) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &a.Errors) + delete(rawMsg, key) + case "lowerBound": + err = unpopulate(val, "LowerBound", &a.LowerBound) + delete(rawMsg, key) + case "metricMeasurement": + err = unpopulate(val, "MetricMeasurement", &a.MetricMeasurement) + delete(rawMsg, key) + case "providerType": + err = unpopulate(val, "ProviderType", &a.ProviderType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "query": + err = unpopulate(val, "Query", &a.Query) + delete(rawMsg, key) + case "queryInputParameters": + err = unpopulate(val, "QueryInputParameters", &a.QueryInputParameters) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &a.Severity) + delete(rawMsg, key) + case "templateDisplayName": + err = unpopulate(val, "TemplateDisplayName", &a.TemplateDisplayName) + delete(rawMsg, key) + case "thresholdOperator": + err = unpopulate(val, "ThresholdOperator", &a.ThresholdOperator) + delete(rawMsg, key) + case "upperBound": + err = unpopulate(val, "UpperBound", &a.UpperBound) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AlertTemplateQueryInputParameter. +func (a AlertTemplateQueryInputParameter) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "defaultValue", a.DefaultValue) + populate(objectMap, "description", a.Description) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "laQuery", a.LaQuery) + populate(objectMap, "name", a.Name) + populate(objectMap, "selectionMode", a.SelectionMode) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertTemplateQueryInputParameter. +func (a *AlertTemplateQueryInputParameter) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "defaultValue": + err = unpopulate(val, "DefaultValue", &a.DefaultValue) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "laQuery": + err = unpopulate(val, "LaQuery", &a.LaQuery) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "selectionMode": + err = unpopulate(val, "SelectionMode", &a.SelectionMode) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AppServicePlanConfiguration. +func (a AppServicePlanConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capacity", a.Capacity) + populate(objectMap, "tier", a.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AppServicePlanConfiguration. +func (a *AppServicePlanConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capacity": + err = unpopulate(val, "Capacity", &a.Capacity) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &a.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Db2ProviderInstanceProperties. +func (d Db2ProviderInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dbName", d.DbName) + populate(objectMap, "dbPassword", d.DbPassword) + populate(objectMap, "dbPasswordUri", d.DbPasswordURI) + populate(objectMap, "dbPort", d.DbPort) + populate(objectMap, "dbUsername", d.DbUsername) + populate(objectMap, "hostname", d.Hostname) + objectMap["providerType"] = "Db2" + populate(objectMap, "sslCertificateUri", d.SSLCertificateURI) + populate(objectMap, "sslPreference", d.SSLPreference) + populate(objectMap, "sapSid", d.SapSid) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Db2ProviderInstanceProperties. +func (d *Db2ProviderInstanceProperties) 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", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dbName": + err = unpopulate(val, "DbName", &d.DbName) + delete(rawMsg, key) + case "dbPassword": + err = unpopulate(val, "DbPassword", &d.DbPassword) + delete(rawMsg, key) + case "dbPasswordUri": + err = unpopulate(val, "DbPasswordURI", &d.DbPasswordURI) + delete(rawMsg, key) + case "dbPort": + err = unpopulate(val, "DbPort", &d.DbPort) + delete(rawMsg, key) + case "dbUsername": + err = unpopulate(val, "DbUsername", &d.DbUsername) + delete(rawMsg, key) + case "hostname": + err = unpopulate(val, "Hostname", &d.Hostname) + delete(rawMsg, key) + case "providerType": + err = unpopulate(val, "ProviderType", &d.ProviderType) + delete(rawMsg, key) + case "sslCertificateUri": + err = unpopulate(val, "SSLCertificateURI", &d.SSLCertificateURI) + delete(rawMsg, key) + case "sslPreference": + err = unpopulate(val, "SSLPreference", &d.SSLPreference) + delete(rawMsg, key) + case "sapSid": + err = unpopulate(val, "SapSid", &d.SapSid) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateAny(objectMap, "info", e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetail. +func (e *ErrorDetail) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalInfo": + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HanaDbProviderInstanceProperties. +func (h HanaDbProviderInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dbName", h.DbName) + populate(objectMap, "dbPassword", h.DbPassword) + populate(objectMap, "dbPasswordUri", h.DbPasswordURI) + populate(objectMap, "dbUsername", h.DbUsername) + populate(objectMap, "hostname", h.Hostname) + populate(objectMap, "instanceNumber", h.InstanceNumber) + objectMap["providerType"] = "SapHana" + populate(objectMap, "sqlPort", h.SQLPort) + populate(objectMap, "sslCertificateUri", h.SSLCertificateURI) + populate(objectMap, "sslHostNameInCertificate", h.SSLHostNameInCertificate) + populate(objectMap, "sslPreference", h.SSLPreference) + populate(objectMap, "sapSid", h.SapSid) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HanaDbProviderInstanceProperties. +func (h *HanaDbProviderInstanceProperties) 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", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dbName": + err = unpopulate(val, "DbName", &h.DbName) + delete(rawMsg, key) + case "dbPassword": + err = unpopulate(val, "DbPassword", &h.DbPassword) + delete(rawMsg, key) + case "dbPasswordUri": + err = unpopulate(val, "DbPasswordURI", &h.DbPasswordURI) + delete(rawMsg, key) + case "dbUsername": + err = unpopulate(val, "DbUsername", &h.DbUsername) + delete(rawMsg, key) + case "hostname": + err = unpopulate(val, "Hostname", &h.Hostname) + delete(rawMsg, key) + case "instanceNumber": + err = unpopulate(val, "InstanceNumber", &h.InstanceNumber) + delete(rawMsg, key) + case "providerType": + err = unpopulate(val, "ProviderType", &h.ProviderType) + delete(rawMsg, key) + case "sqlPort": + err = unpopulate(val, "SQLPort", &h.SQLPort) + delete(rawMsg, key) + case "sslCertificateUri": + err = unpopulate(val, "SSLCertificateURI", &h.SSLCertificateURI) + delete(rawMsg, key) + case "sslHostNameInCertificate": + err = unpopulate(val, "SSLHostNameInCertificate", &h.SSLHostNameInCertificate) + delete(rawMsg, key) + case "sslPreference": + err = unpopulate(val, "SSLPreference", &h.SSLPreference) + delete(rawMsg, key) + case "sapSid": + err = unpopulate(val, "SapSid", &h.SapSid) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Health. +func (h Health) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "healthState", h.HealthState) + populate(objectMap, "impactingReasons", h.ImpactingReasons) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Health. +func (h *Health) 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", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "healthState": + err = unpopulate(val, "HealthState", &h.HealthState) + delete(rawMsg, key) + case "impactingReasons": + err = unpopulate(val, "ImpactingReasons", &h.ImpactingReasons) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedResourceGroupConfiguration. +func (m ManagedResourceGroupConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", m.Name) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedResourceGroupConfiguration. +func (m *ManagedResourceGroupConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. +func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", m.PrincipalID) + populate(objectMap, "tenantId", m.TenantID) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServiceIdentity. +func (m *ManagedServiceIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &m.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Monitor. +func (m Monitor) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", m.ID) + populate(objectMap, "identity", m.Identity) + populate(objectMap, "location", m.Location) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Monitor. +func (m *Monitor) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &m.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &m.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &m.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MonitorListResult. +func (m MonitorListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MonitorListResult. +func (m *MonitorListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &m.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MonitorProperties. +func (m MonitorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "appLocation", m.AppLocation) + populate(objectMap, "appServicePlanConfiguration", m.AppServicePlanConfiguration) + populate(objectMap, "errors", m.Errors) + populate(objectMap, "logAnalyticsWorkspaceArmId", m.LogAnalyticsWorkspaceArmID) + populate(objectMap, "managedResourceGroupConfiguration", m.ManagedResourceGroupConfiguration) + populate(objectMap, "monitorSubnet", m.MonitorSubnet) + populate(objectMap, "msiArmId", m.MsiArmID) + populate(objectMap, "provisioningState", m.ProvisioningState) + populate(objectMap, "routingPreference", m.RoutingPreference) + populate(objectMap, "storageAccountArmId", m.StorageAccountArmID) + populate(objectMap, "zoneRedundancyPreference", m.ZoneRedundancyPreference) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MonitorProperties. +func (m *MonitorProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "appLocation": + err = unpopulate(val, "AppLocation", &m.AppLocation) + delete(rawMsg, key) + case "appServicePlanConfiguration": + err = unpopulate(val, "AppServicePlanConfiguration", &m.AppServicePlanConfiguration) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &m.Errors) + delete(rawMsg, key) + case "logAnalyticsWorkspaceArmId": + err = unpopulate(val, "LogAnalyticsWorkspaceArmID", &m.LogAnalyticsWorkspaceArmID) + delete(rawMsg, key) + case "managedResourceGroupConfiguration": + err = unpopulate(val, "ManagedResourceGroupConfiguration", &m.ManagedResourceGroupConfiguration) + delete(rawMsg, key) + case "monitorSubnet": + err = unpopulate(val, "MonitorSubnet", &m.MonitorSubnet) + delete(rawMsg, key) + case "msiArmId": + err = unpopulate(val, "MsiArmID", &m.MsiArmID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &m.ProvisioningState) + delete(rawMsg, key) + case "routingPreference": + err = unpopulate(val, "RoutingPreference", &m.RoutingPreference) + delete(rawMsg, key) + case "storageAccountArmId": + err = unpopulate(val, "StorageAccountArmID", &m.StorageAccountArmID) + delete(rawMsg, key) + case "zoneRedundancyPreference": + err = unpopulate(val, "ZoneRedundancyPreference", &m.ZoneRedundancyPreference) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MsSQLServerProviderInstanceProperties. +func (m MsSQLServerProviderInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dbPassword", m.DbPassword) + populate(objectMap, "dbPasswordUri", m.DbPasswordURI) + populate(objectMap, "dbPort", m.DbPort) + populate(objectMap, "dbUsername", m.DbUsername) + populate(objectMap, "hostname", m.Hostname) + objectMap["providerType"] = "MsSqlServer" + populate(objectMap, "sslCertificateUri", m.SSLCertificateURI) + populate(objectMap, "sslPreference", m.SSLPreference) + populate(objectMap, "sapSid", m.SapSid) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MsSQLServerProviderInstanceProperties. +func (m *MsSQLServerProviderInstanceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dbPassword": + err = unpopulate(val, "DbPassword", &m.DbPassword) + delete(rawMsg, key) + case "dbPasswordUri": + err = unpopulate(val, "DbPasswordURI", &m.DbPasswordURI) + delete(rawMsg, key) + case "dbPort": + err = unpopulate(val, "DbPort", &m.DbPort) + delete(rawMsg, key) + case "dbUsername": + err = unpopulate(val, "DbUsername", &m.DbUsername) + delete(rawMsg, key) + case "hostname": + err = unpopulate(val, "Hostname", &m.Hostname) + delete(rawMsg, key) + case "providerType": + err = unpopulate(val, "ProviderType", &m.ProviderType) + delete(rawMsg, key) + case "sslCertificateUri": + err = unpopulate(val, "SSLCertificateURI", &m.SSLCertificateURI) + delete(rawMsg, key) + case "sslPreference": + err = unpopulate(val, "SSLPreference", &m.SSLPreference) + delete(rawMsg, key) + case "sapSid": + err = unpopulate(val, "SapSid", &m.SapSid) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OracleProviderInstanceProperties. +func (o OracleProviderInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dbName", o.DbName) + populate(objectMap, "dbPassword", o.DbPassword) + populate(objectMap, "dbPasswordUri", o.DbPasswordURI) + populate(objectMap, "dbPort", o.DbPort) + populate(objectMap, "dbUsername", o.DbUsername) + populate(objectMap, "hostname", o.Hostname) + objectMap["providerType"] = "Oracle" + populate(objectMap, "sslCertificateUri", o.SSLCertificateURI) + populate(objectMap, "sslPreference", o.SSLPreference) + populate(objectMap, "sapSid", o.SapSid) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OracleProviderInstanceProperties. +func (o *OracleProviderInstanceProperties) 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) + } + for key, val := range rawMsg { + var err error + switch key { + case "dbName": + err = unpopulate(val, "DbName", &o.DbName) + delete(rawMsg, key) + case "dbPassword": + err = unpopulate(val, "DbPassword", &o.DbPassword) + delete(rawMsg, key) + case "dbPasswordUri": + err = unpopulate(val, "DbPasswordURI", &o.DbPasswordURI) + delete(rawMsg, key) + case "dbPort": + err = unpopulate(val, "DbPort", &o.DbPort) + delete(rawMsg, key) + case "dbUsername": + err = unpopulate(val, "DbUsername", &o.DbUsername) + delete(rawMsg, key) + case "hostname": + err = unpopulate(val, "Hostname", &o.Hostname) + delete(rawMsg, key) + case "providerType": + err = unpopulate(val, "ProviderType", &o.ProviderType) + delete(rawMsg, key) + case "sslCertificateUri": + err = unpopulate(val, "SSLCertificateURI", &o.SSLCertificateURI) + delete(rawMsg, key) + case "sslPreference": + err = unpopulate(val, "SSLPreference", &o.SSLPreference) + delete(rawMsg, key) + case "sapSid": + err = unpopulate(val, "SapSid", &o.SapSid) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrometheusHaClusterProviderInstanceProperties. +func (p PrometheusHaClusterProviderInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clusterName", p.ClusterName) + populate(objectMap, "hostname", p.Hostname) + populate(objectMap, "prometheusUrl", p.PrometheusURL) + objectMap["providerType"] = "PrometheusHaCluster" + populate(objectMap, "sslCertificateUri", p.SSLCertificateURI) + populate(objectMap, "sslPreference", p.SSLPreference) + populate(objectMap, "sid", p.Sid) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrometheusHaClusterProviderInstanceProperties. +func (p *PrometheusHaClusterProviderInstanceProperties) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clusterName": + err = unpopulate(val, "ClusterName", &p.ClusterName) + delete(rawMsg, key) + case "hostname": + err = unpopulate(val, "Hostname", &p.Hostname) + delete(rawMsg, key) + case "prometheusUrl": + err = unpopulate(val, "PrometheusURL", &p.PrometheusURL) + delete(rawMsg, key) + case "providerType": + err = unpopulate(val, "ProviderType", &p.ProviderType) + delete(rawMsg, key) + case "sslCertificateUri": + err = unpopulate(val, "SSLCertificateURI", &p.SSLCertificateURI) + delete(rawMsg, key) + case "sslPreference": + err = unpopulate(val, "SSLPreference", &p.SSLPreference) + delete(rawMsg, key) + case "sid": + err = unpopulate(val, "Sid", &p.Sid) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrometheusOsProviderInstanceProperties. +func (p PrometheusOsProviderInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "prometheusUrl", p.PrometheusURL) + objectMap["providerType"] = "PrometheusOS" + populate(objectMap, "sslCertificateUri", p.SSLCertificateURI) + populate(objectMap, "sslPreference", p.SSLPreference) + populate(objectMap, "sapSid", p.SapSid) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrometheusOsProviderInstanceProperties. +func (p *PrometheusOsProviderInstanceProperties) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "prometheusUrl": + err = unpopulate(val, "PrometheusURL", &p.PrometheusURL) + delete(rawMsg, key) + case "providerType": + err = unpopulate(val, "ProviderType", &p.ProviderType) + delete(rawMsg, key) + case "sslCertificateUri": + err = unpopulate(val, "SSLCertificateURI", &p.SSLCertificateURI) + delete(rawMsg, key) + case "sslPreference": + err = unpopulate(val, "SSLPreference", &p.SSLPreference) + delete(rawMsg, key) + case "sapSid": + err = unpopulate(val, "SapSid", &p.SapSid) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProviderInstance. +func (p ProviderInstance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProviderInstance. +func (p *ProviderInstance) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProviderInstanceListResult. +func (p ProviderInstanceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProviderInstanceListResult. +func (p *ProviderInstanceListResult) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProviderInstanceProperties. +func (p ProviderInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "errors", p.Errors) + populate(objectMap, "health", p.Health) + populate(objectMap, "providerSettings", p.ProviderSettings) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProviderInstanceProperties. +func (p *ProviderInstanceProperties) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "errors": + err = unpopulate(val, "Errors", &p.Errors) + delete(rawMsg, key) + case "health": + err = unpopulate(val, "Health", &p.Health) + delete(rawMsg, key) + case "providerSettings": + p.ProviderSettings, err = unmarshalProviderSpecificPropertiesClassification(val) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProviderSpecificProperties. +func (p ProviderSpecificProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["providerType"] = p.ProviderType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProviderSpecificProperties. +func (p *ProviderSpecificProperties) 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", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "providerType": + err = unpopulate(val, "ProviderType", &p.ProviderType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SapLandscapeMonitorMetricThresholds. +func (s SapLandscapeMonitorMetricThresholds) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "green", s.Green) + populate(objectMap, "name", s.Name) + populate(objectMap, "red", s.Red) + populate(objectMap, "yellow", s.Yellow) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SapLandscapeMonitorMetricThresholds. +func (s *SapLandscapeMonitorMetricThresholds) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "green": + err = unpopulate(val, "Green", &s.Green) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "red": + err = unpopulate(val, "Red", &s.Red) + delete(rawMsg, key) + case "yellow": + err = unpopulate(val, "Yellow", &s.Yellow) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SapLandscapeMonitorProperties. +func (s SapLandscapeMonitorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "grouping", s.Grouping) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "topMetricsThresholds", s.TopMetricsThresholds) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SapLandscapeMonitorProperties. +func (s *SapLandscapeMonitorProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "grouping": + err = unpopulate(val, "Grouping", &s.Grouping) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "topMetricsThresholds": + err = unpopulate(val, "TopMetricsThresholds", &s.TopMetricsThresholds) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SapLandscapeMonitorPropertiesGrouping. +func (s SapLandscapeMonitorPropertiesGrouping) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "landscape", s.Landscape) + populate(objectMap, "sapApplication", s.SapApplication) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SapLandscapeMonitorPropertiesGrouping. +func (s *SapLandscapeMonitorPropertiesGrouping) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "landscape": + err = unpopulate(val, "Landscape", &s.Landscape) + delete(rawMsg, key) + case "sapApplication": + err = unpopulate(val, "SapApplication", &s.SapApplication) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SapLandscapeMonitorResource. +func (s SapLandscapeMonitorResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SapLandscapeMonitorResource. +func (s *SapLandscapeMonitorResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SapLandscapeMonitorResourceListResult. +func (s SapLandscapeMonitorResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SapLandscapeMonitorResourceListResult. +func (s *SapLandscapeMonitorResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SapLandscapeMonitorSidMapping. +func (s SapLandscapeMonitorSidMapping) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", s.Name) + populate(objectMap, "topSid", s.TopSid) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SapLandscapeMonitorSidMapping. +func (s *SapLandscapeMonitorSidMapping) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "topSid": + err = unpopulate(val, "TopSid", &s.TopSid) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SapNetWeaverProviderInstanceProperties. +func (s SapNetWeaverProviderInstanceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["providerType"] = "SapNetWeaver" + populate(objectMap, "sslCertificateUri", s.SSLCertificateURI) + populate(objectMap, "sslPreference", s.SSLPreference) + populate(objectMap, "sapClientId", s.SapClientID) + populate(objectMap, "sapHostFileEntries", s.SapHostFileEntries) + populate(objectMap, "sapHostname", s.SapHostname) + populate(objectMap, "sapInstanceNr", s.SapInstanceNr) + populate(objectMap, "sapPassword", s.SapPassword) + populate(objectMap, "sapPasswordUri", s.SapPasswordURI) + populate(objectMap, "sapPortNumber", s.SapPortNumber) + populate(objectMap, "sapSid", s.SapSid) + populate(objectMap, "sapUsername", s.SapUsername) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SapNetWeaverProviderInstanceProperties. +func (s *SapNetWeaverProviderInstanceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "providerType": + err = unpopulate(val, "ProviderType", &s.ProviderType) + delete(rawMsg, key) + case "sslCertificateUri": + err = unpopulate(val, "SSLCertificateURI", &s.SSLCertificateURI) + delete(rawMsg, key) + case "sslPreference": + err = unpopulate(val, "SSLPreference", &s.SSLPreference) + delete(rawMsg, key) + case "sapClientId": + err = unpopulate(val, "SapClientID", &s.SapClientID) + delete(rawMsg, key) + case "sapHostFileEntries": + err = unpopulate(val, "SapHostFileEntries", &s.SapHostFileEntries) + delete(rawMsg, key) + case "sapHostname": + err = unpopulate(val, "SapHostname", &s.SapHostname) + delete(rawMsg, key) + case "sapInstanceNr": + err = unpopulate(val, "SapInstanceNr", &s.SapInstanceNr) + delete(rawMsg, key) + case "sapPassword": + err = unpopulate(val, "SapPassword", &s.SapPassword) + delete(rawMsg, key) + case "sapPasswordUri": + err = unpopulate(val, "SapPasswordURI", &s.SapPasswordURI) + delete(rawMsg, key) + case "sapPortNumber": + err = unpopulate(val, "SapPortNumber", &s.SapPortNumber) + delete(rawMsg, key) + case "sapSid": + err = unpopulate(val, "SapSid", &s.SapSid) + delete(rawMsg, key) + case "sapUsername": + err = unpopulate(val, "SapUsername", &s.SapUsername) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UpdateMonitorRequest. +func (u UpdateMonitorRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", u.Identity) + populate(objectMap, "tags", u.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateMonitorRequest. +func (u *UpdateMonitorRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identity": + err = unpopulate(val, "Identity", &u.Identity) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &u.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentity. +func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity. +func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func populateAny(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil || string(data) == "null" { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/workloads/sapmonitors/monitors_client.go b/sdk/resourcemanager/workloads/sapmonitors/monitors_client.go new file mode 100644 index 000000000000..41c67cbccf56 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/monitors_client.go @@ -0,0 +1,456 @@ +// 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 sapmonitors + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// MonitorsClient contains the methods for the Monitors group. +// Don't use this type directly, use NewMonitorsClient() instead. +type MonitorsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewMonitorsClient creates a new instance of MonitorsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewMonitorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MonitorsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &MonitorsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Creates a SAP monitor for the specified subscription, resource group, and resource name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - monitorName - Name of the SAP monitor resource. +// - resource - Request body representing a SAP monitor +// - options - MonitorsClientBeginCreateOptions contains the optional parameters for the MonitorsClient.BeginCreate method. +func (client *MonitorsClient) BeginCreate(ctx context.Context, resourceGroupName string, monitorName string, resource Monitor, options *MonitorsClientBeginCreateOptions) (*runtime.Poller[MonitorsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, monitorName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MonitorsClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[MonitorsClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Creates a SAP monitor for the specified subscription, resource group, and resource name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +func (client *MonitorsClient) create(ctx context.Context, resourceGroupName string, monitorName string, resource Monitor, options *MonitorsClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "MonitorsClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, monitorName, resource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *MonitorsClient) createCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, resource Monitor, _ *MonitorsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a SAP monitor with the specified subscription, resource group, and SAP monitor name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - monitorName - Name of the SAP monitor resource. +// - options - MonitorsClientBeginDeleteOptions contains the optional parameters for the MonitorsClient.BeginDelete method. +func (client *MonitorsClient) BeginDelete(ctx context.Context, resourceGroupName string, monitorName string, options *MonitorsClientBeginDeleteOptions) (*runtime.Poller[MonitorsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, monitorName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MonitorsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[MonitorsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a SAP monitor with the specified subscription, resource group, and SAP monitor name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +func (client *MonitorsClient) deleteOperation(ctx context.Context, resourceGroupName string, monitorName string, options *MonitorsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "MonitorsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, monitorName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *MonitorsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, _ *MonitorsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets properties of a SAP monitor for the specified subscription, resource group, and resource name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - monitorName - Name of the SAP monitor resource. +// - options - MonitorsClientGetOptions contains the optional parameters for the MonitorsClient.Get method. +func (client *MonitorsClient) Get(ctx context.Context, resourceGroupName string, monitorName string, options *MonitorsClientGetOptions) (MonitorsClientGetResponse, error) { + var err error + const operationName = "MonitorsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, monitorName, options) + if err != nil { + return MonitorsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MonitorsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MonitorsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *MonitorsClient) getCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, _ *MonitorsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *MonitorsClient) getHandleResponse(resp *http.Response) (MonitorsClientGetResponse, error) { + result := MonitorsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Monitor); err != nil { + return MonitorsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets a list of SAP monitors in the specified subscription. The operations returns various properties of +// each SAP monitor. +// +// Generated from API version 2024-02-01-preview +// - options - MonitorsClientListOptions contains the optional parameters for the MonitorsClient.NewListPager method. +func (client *MonitorsClient) NewListPager(options *MonitorsClientListOptions) *runtime.Pager[MonitorsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[MonitorsClientListResponse]{ + More: func(page MonitorsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *MonitorsClientListResponse) (MonitorsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MonitorsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return MonitorsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *MonitorsClient) listCreateRequest(ctx context.Context, _ *MonitorsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Workloads/monitors" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *MonitorsClient) listHandleResponse(resp *http.Response) (MonitorsClientListResponse, error) { + result := MonitorsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MonitorListResult); err != nil { + return MonitorsClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Gets a list of SAP monitors in the specified resource group. +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - MonitorsClientListByResourceGroupOptions contains the optional parameters for the MonitorsClient.NewListByResourceGroupPager +// method. +func (client *MonitorsClient) NewListByResourceGroupPager(resourceGroupName string, options *MonitorsClientListByResourceGroupOptions) *runtime.Pager[MonitorsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[MonitorsClientListByResourceGroupResponse]{ + More: func(page MonitorsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *MonitorsClientListByResourceGroupResponse) (MonitorsClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MonitorsClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return MonitorsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *MonitorsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *MonitorsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *MonitorsClient) listByResourceGroupHandleResponse(resp *http.Response) (MonitorsClientListByResourceGroupResponse, error) { + result := MonitorsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MonitorListResult); err != nil { + return MonitorsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// BeginUpdate - Patches the Tags field of a SAP monitor for the specified subscription, resource group, and SAP monitor name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - monitorName - Name of the SAP monitor resource. +// - properties - The Update SAP workload monitor request body. +// - options - MonitorsClientBeginUpdateOptions contains the optional parameters for the MonitorsClient.BeginUpdate method. +func (client *MonitorsClient) BeginUpdate(ctx context.Context, resourceGroupName string, monitorName string, properties UpdateMonitorRequest, options *MonitorsClientBeginUpdateOptions) (*runtime.Poller[MonitorsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, monitorName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MonitorsClientUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[MonitorsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Patches the Tags field of a SAP monitor for the specified subscription, resource group, and SAP monitor name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +func (client *MonitorsClient) update(ctx context.Context, resourceGroupName string, monitorName string, properties UpdateMonitorRequest, options *MonitorsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "MonitorsClient.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, monitorName, properties, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// updateCreateRequest creates the Update request. +func (client *MonitorsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, properties UpdateMonitorRequest, _ *MonitorsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} diff --git a/sdk/resourcemanager/monitor/armmonitor/operations_client.go b/sdk/resourcemanager/workloads/sapmonitors/operations_client.go similarity index 61% rename from sdk/resourcemanager/monitor/armmonitor/operations_client.go rename to sdk/resourcemanager/workloads/sapmonitors/operations_client.go index 1db6ae81d207..090965be2b73 100644 --- a/sdk/resourcemanager/monitor/armmonitor/operations_client.go +++ b/sdk/resourcemanager/workloads/sapmonitors/operations_client.go @@ -1,12 +1,9 @@ -//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 armmonitor +package sapmonitors import ( "context" @@ -37,42 +34,42 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO return client, nil } -// List - Lists all of the available operations from Microsoft.Insights provider. -// If the operation fails it returns an *azcore.ResponseError type. +// NewListPager - List the operations for the provider // -// Generated from API version 2015-04-01 -// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. -func (client *OperationsClient) List(ctx context.Context, options *OperationsClientListOptions) (OperationsClientListResponse, error) { - var err error - const operationName = "OperationsClient.List" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listCreateRequest(ctx, options) - if err != nil { - return OperationsClientListResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return OperationsClientListResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return OperationsClientListResponse{}, err - } - resp, err := client.listHandleResponse(httpResp) - return resp, err +// Generated from API version 2024-02-01-preview +// - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return OperationsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) } // listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { - urlPath := "/providers/Microsoft.Insights/operations" +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Workloads/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-04-01") + reqQP.Set("api-version", "2024-02-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/workloads/sapmonitors/options.go b/sdk/resourcemanager/workloads/sapmonitors/options.go new file mode 100644 index 000000000000..8c61d6ae1ddc --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/options.go @@ -0,0 +1,129 @@ +// 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 sapmonitors + +// AlertTemplatesClientGetOptions contains the optional parameters for the AlertTemplatesClient.Get method. +type AlertTemplatesClientGetOptions struct { + // placeholder for future optional parameters +} + +// AlertTemplatesClientListOptions contains the optional parameters for the AlertTemplatesClient.NewListPager method. +type AlertTemplatesClientListOptions struct { + // The provider type for filtering alert templates. + ProviderType *string +} + +// AlertsClientBeginCreateOptions contains the optional parameters for the AlertsClient.BeginCreate method. +type AlertsClientBeginCreateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// AlertsClientBeginDeleteOptions contains the optional parameters for the AlertsClient.BeginDelete method. +type AlertsClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// AlertsClientGetOptions contains the optional parameters for the AlertsClient.Get method. +type AlertsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AlertsClientListOptions contains the optional parameters for the AlertsClient.NewListPager method. +type AlertsClientListOptions struct { + // placeholder for future optional parameters +} + +// MonitorsClientBeginCreateOptions contains the optional parameters for the MonitorsClient.BeginCreate method. +type MonitorsClientBeginCreateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// MonitorsClientBeginDeleteOptions contains the optional parameters for the MonitorsClient.BeginDelete method. +type MonitorsClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// MonitorsClientBeginUpdateOptions contains the optional parameters for the MonitorsClient.BeginUpdate method. +type MonitorsClientBeginUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// MonitorsClientGetOptions contains the optional parameters for the MonitorsClient.Get method. +type MonitorsClientGetOptions struct { + // placeholder for future optional parameters +} + +// MonitorsClientListByResourceGroupOptions contains the optional parameters for the MonitorsClient.NewListByResourceGroupPager +// method. +type MonitorsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// MonitorsClientListOptions contains the optional parameters for the MonitorsClient.NewListPager method. +type MonitorsClientListOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// ProviderInstancesClientBeginCreateOptions contains the optional parameters for the ProviderInstancesClient.BeginCreate +// method. +type ProviderInstancesClientBeginCreateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// ProviderInstancesClientBeginDeleteOptions contains the optional parameters for the ProviderInstancesClient.BeginDelete +// method. +type ProviderInstancesClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// ProviderInstancesClientGetOptions contains the optional parameters for the ProviderInstancesClient.Get method. +type ProviderInstancesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ProviderInstancesClientListByMonitorOptions contains the optional parameters for the ProviderInstancesClient.NewListByMonitorPager +// method. +type ProviderInstancesClientListByMonitorOptions struct { + // placeholder for future optional parameters +} + +// SapLandscapeMonitorClientCreateOptions contains the optional parameters for the SapLandscapeMonitorClient.Create method. +type SapLandscapeMonitorClientCreateOptions struct { + // placeholder for future optional parameters +} + +// SapLandscapeMonitorClientDeleteOptions contains the optional parameters for the SapLandscapeMonitorClient.Delete method. +type SapLandscapeMonitorClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// SapLandscapeMonitorClientGetOptions contains the optional parameters for the SapLandscapeMonitorClient.Get method. +type SapLandscapeMonitorClientGetOptions struct { + // placeholder for future optional parameters +} + +// SapLandscapeMonitorClientListByMonitorOptions contains the optional parameters for the SapLandscapeMonitorClient.NewListByMonitorPager +// method. +type SapLandscapeMonitorClientListByMonitorOptions struct { + // placeholder for future optional parameters +} + +// SapLandscapeMonitorClientUpdateOptions contains the optional parameters for the SapLandscapeMonitorClient.Update method. +type SapLandscapeMonitorClientUpdateOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/workloads/sapmonitors/polymorphic_helpers.go b/sdk/resourcemanager/workloads/sapmonitors/polymorphic_helpers.go new file mode 100644 index 000000000000..dd3e039f9e76 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/polymorphic_helpers.go @@ -0,0 +1,41 @@ +// 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 sapmonitors + +import "encoding/json" + +func unmarshalProviderSpecificPropertiesClassification(rawMsg json.RawMessage) (ProviderSpecificPropertiesClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b ProviderSpecificPropertiesClassification + switch m["providerType"] { + case "Db2": + b = &Db2ProviderInstanceProperties{} + case "MsSqlServer": + b = &MsSQLServerProviderInstanceProperties{} + case "Oracle": + b = &OracleProviderInstanceProperties{} + case "PrometheusHaCluster": + b = &PrometheusHaClusterProviderInstanceProperties{} + case "PrometheusOS": + b = &PrometheusOsProviderInstanceProperties{} + case "SapHana": + b = &HanaDbProviderInstanceProperties{} + case "SapNetWeaver": + b = &SapNetWeaverProviderInstanceProperties{} + default: + b = &ProviderSpecificProperties{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} diff --git a/sdk/resourcemanager/workloads/sapmonitors/providerinstances_client.go b/sdk/resourcemanager/workloads/sapmonitors/providerinstances_client.go new file mode 100644 index 000000000000..033f5938e4d8 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/providerinstances_client.go @@ -0,0 +1,347 @@ +// 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 sapmonitors + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ProviderInstancesClient contains the methods for the ProviderInstances group. +// Don't use this type directly, use NewProviderInstancesClient() instead. +type ProviderInstancesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewProviderInstancesClient creates a new instance of ProviderInstancesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewProviderInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProviderInstancesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ProviderInstancesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Creates a provider instance for the specified subscription, resource group, SAP monitor name, and resource +// name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - monitorName - Name of the SAP monitor resource. +// - providerInstanceName - Name of the provider instance. +// - resource - Request body representing a provider instance associated with a SAP monitor. +// - options - ProviderInstancesClientBeginCreateOptions contains the optional parameters for the ProviderInstancesClient.BeginCreate +// method. +func (client *ProviderInstancesClient) BeginCreate(ctx context.Context, resourceGroupName string, monitorName string, providerInstanceName string, resource ProviderInstance, options *ProviderInstancesClientBeginCreateOptions) (*runtime.Poller[ProviderInstancesClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, monitorName, providerInstanceName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProviderInstancesClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ProviderInstancesClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Creates a provider instance for the specified subscription, resource group, SAP monitor name, and resource name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +func (client *ProviderInstancesClient) create(ctx context.Context, resourceGroupName string, monitorName string, providerInstanceName string, resource ProviderInstance, options *ProviderInstancesClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "ProviderInstancesClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, monitorName, providerInstanceName, resource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *ProviderInstancesClient) createCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, providerInstanceName string, resource ProviderInstance, _ *ProviderInstancesClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + if providerInstanceName == "" { + return nil, errors.New("parameter providerInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{providerInstanceName}", url.PathEscape(providerInstanceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes a provider instance for the specified subscription, resource group, SAP monitor name, and resource +// name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - monitorName - Name of the SAP monitor resource. +// - providerInstanceName - Name of the provider instance. +// - options - ProviderInstancesClientBeginDeleteOptions contains the optional parameters for the ProviderInstancesClient.BeginDelete +// method. +func (client *ProviderInstancesClient) BeginDelete(ctx context.Context, resourceGroupName string, monitorName string, providerInstanceName string, options *ProviderInstancesClientBeginDeleteOptions) (*runtime.Poller[ProviderInstancesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, monitorName, providerInstanceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProviderInstancesClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ProviderInstancesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a provider instance for the specified subscription, resource group, SAP monitor name, and resource name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +func (client *ProviderInstancesClient) deleteOperation(ctx context.Context, resourceGroupName string, monitorName string, providerInstanceName string, options *ProviderInstancesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "ProviderInstancesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, monitorName, providerInstanceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ProviderInstancesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, providerInstanceName string, _ *ProviderInstancesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + if providerInstanceName == "" { + return nil, errors.New("parameter providerInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{providerInstanceName}", url.PathEscape(providerInstanceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets properties of a provider instance for the specified subscription, resource group, SAP monitor name, and resource +// name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - monitorName - Name of the SAP monitor resource. +// - providerInstanceName - Name of the provider instance. +// - options - ProviderInstancesClientGetOptions contains the optional parameters for the ProviderInstancesClient.Get method. +func (client *ProviderInstancesClient) Get(ctx context.Context, resourceGroupName string, monitorName string, providerInstanceName string, options *ProviderInstancesClientGetOptions) (ProviderInstancesClientGetResponse, error) { + var err error + const operationName = "ProviderInstancesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, monitorName, providerInstanceName, options) + if err != nil { + return ProviderInstancesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProviderInstancesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProviderInstancesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ProviderInstancesClient) getCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, providerInstanceName string, _ *ProviderInstancesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances/{providerInstanceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + if providerInstanceName == "" { + return nil, errors.New("parameter providerInstanceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{providerInstanceName}", url.PathEscape(providerInstanceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ProviderInstancesClient) getHandleResponse(resp *http.Response) (ProviderInstancesClientGetResponse, error) { + result := ProviderInstancesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProviderInstance); err != nil { + return ProviderInstancesClientGetResponse{}, err + } + return result, nil +} + +// NewListByMonitorPager - Gets a list of provider instances in the specified SAP monitor. The operations returns various +// properties of each provider instances. +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - monitorName - Name of the SAP monitor resource. +// - options - ProviderInstancesClientListByMonitorOptions contains the optional parameters for the ProviderInstancesClient.NewListByMonitorPager +// method. +func (client *ProviderInstancesClient) NewListByMonitorPager(resourceGroupName string, monitorName string, options *ProviderInstancesClientListByMonitorOptions) *runtime.Pager[ProviderInstancesClientListByMonitorResponse] { + return runtime.NewPager(runtime.PagingHandler[ProviderInstancesClientListByMonitorResponse]{ + More: func(page ProviderInstancesClientListByMonitorResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ProviderInstancesClientListByMonitorResponse) (ProviderInstancesClientListByMonitorResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ProviderInstancesClient.NewListByMonitorPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByMonitorCreateRequest(ctx, resourceGroupName, monitorName, options) + }, nil) + if err != nil { + return ProviderInstancesClientListByMonitorResponse{}, err + } + return client.listByMonitorHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByMonitorCreateRequest creates the ListByMonitor request. +func (client *ProviderInstancesClient) listByMonitorCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, _ *ProviderInstancesClientListByMonitorOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/providerInstances" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByMonitorHandleResponse handles the ListByMonitor response. +func (client *ProviderInstancesClient) listByMonitorHandleResponse(resp *http.Response) (ProviderInstancesClientListByMonitorResponse, error) { + result := ProviderInstancesClientListByMonitorResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProviderInstanceListResult); err != nil { + return ProviderInstancesClientListByMonitorResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/workloads/sapmonitors/responses.go b/sdk/resourcemanager/workloads/sapmonitors/responses.go new file mode 100644 index 000000000000..ccf66e7ceb5f --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/responses.go @@ -0,0 +1,134 @@ +// 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 sapmonitors + +// AlertTemplatesClientGetResponse contains the response from method AlertTemplatesClient.Get. +type AlertTemplatesClientGetResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. + AlertTemplate +} + +// AlertTemplatesClientListResponse contains the response from method AlertTemplatesClient.NewListPager. +type AlertTemplatesClientListResponse struct { + // The response of a AlertTemplate list operation. + AlertTemplateListResult +} + +// AlertsClientCreateResponse contains the response from method AlertsClient.BeginCreate. +type AlertsClientCreateResponse struct { + // A alert associated with SAP monitor. + Alert +} + +// AlertsClientDeleteResponse contains the response from method AlertsClient.BeginDelete. +type AlertsClientDeleteResponse struct { + // placeholder for future response values +} + +// AlertsClientGetResponse contains the response from method AlertsClient.Get. +type AlertsClientGetResponse struct { + // A alert associated with SAP monitor. + Alert +} + +// AlertsClientListResponse contains the response from method AlertsClient.NewListPager. +type AlertsClientListResponse struct { + // The response of a Alert list operation. + AlertListResult +} + +// MonitorsClientCreateResponse contains the response from method MonitorsClient.BeginCreate. +type MonitorsClientCreateResponse struct { + // SAP monitor info on Azure (ARM properties and SAP monitor properties) + Monitor +} + +// MonitorsClientDeleteResponse contains the response from method MonitorsClient.BeginDelete. +type MonitorsClientDeleteResponse struct { + // placeholder for future response values +} + +// MonitorsClientGetResponse contains the response from method MonitorsClient.Get. +type MonitorsClientGetResponse struct { + // SAP monitor info on Azure (ARM properties and SAP monitor properties) + Monitor +} + +// MonitorsClientListByResourceGroupResponse contains the response from method MonitorsClient.NewListByResourceGroupPager. +type MonitorsClientListByResourceGroupResponse struct { + // The response of a Monitor list operation. + MonitorListResult +} + +// MonitorsClientListResponse contains the response from method MonitorsClient.NewListPager. +type MonitorsClientListResponse struct { + // The response of a Monitor list operation. + MonitorListResult +} + +// MonitorsClientUpdateResponse contains the response from method MonitorsClient.BeginUpdate. +type MonitorsClientUpdateResponse struct { + // SAP monitor info on Azure (ARM properties and SAP monitor properties) + Monitor +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + OperationListResult +} + +// ProviderInstancesClientCreateResponse contains the response from method ProviderInstancesClient.BeginCreate. +type ProviderInstancesClientCreateResponse struct { + // A provider instance associated with SAP monitor. + ProviderInstance +} + +// ProviderInstancesClientDeleteResponse contains the response from method ProviderInstancesClient.BeginDelete. +type ProviderInstancesClientDeleteResponse struct { + // placeholder for future response values +} + +// ProviderInstancesClientGetResponse contains the response from method ProviderInstancesClient.Get. +type ProviderInstancesClientGetResponse struct { + // A provider instance associated with SAP monitor. + ProviderInstance +} + +// ProviderInstancesClientListByMonitorResponse contains the response from method ProviderInstancesClient.NewListByMonitorPager. +type ProviderInstancesClientListByMonitorResponse struct { + // The response of a ProviderInstance list operation. + ProviderInstanceListResult +} + +// SapLandscapeMonitorClientCreateResponse contains the response from method SapLandscapeMonitorClient.Create. +type SapLandscapeMonitorClientCreateResponse struct { + // configuration associated with SAP Landscape Monitor Dashboard. + SapLandscapeMonitorResource +} + +// SapLandscapeMonitorClientDeleteResponse contains the response from method SapLandscapeMonitorClient.Delete. +type SapLandscapeMonitorClientDeleteResponse struct { + // placeholder for future response values +} + +// SapLandscapeMonitorClientGetResponse contains the response from method SapLandscapeMonitorClient.Get. +type SapLandscapeMonitorClientGetResponse struct { + // configuration associated with SAP Landscape Monitor Dashboard. + SapLandscapeMonitorResource +} + +// SapLandscapeMonitorClientListByMonitorResponse contains the response from method SapLandscapeMonitorClient.NewListByMonitorPager. +type SapLandscapeMonitorClientListByMonitorResponse struct { + // The response of a SapLandscapeMonitorResource list operation. + SapLandscapeMonitorResourceListResult +} + +// SapLandscapeMonitorClientUpdateResponse contains the response from method SapLandscapeMonitorClient.Update. +type SapLandscapeMonitorClientUpdateResponse struct { + // configuration associated with SAP Landscape Monitor Dashboard. + SapLandscapeMonitorResource +} diff --git a/sdk/resourcemanager/workloads/sapmonitors/saplandscapemonitor_client.go b/sdk/resourcemanager/workloads/sapmonitors/saplandscapemonitor_client.go new file mode 100644 index 000000000000..74b9a652da60 --- /dev/null +++ b/sdk/resourcemanager/workloads/sapmonitors/saplandscapemonitor_client.go @@ -0,0 +1,365 @@ +// 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 sapmonitors + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SapLandscapeMonitorClient contains the methods for the SapLandscapeMonitor group. +// Don't use this type directly, use NewSapLandscapeMonitorClient() instead. +type SapLandscapeMonitorClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSapLandscapeMonitorClient creates a new instance of SapLandscapeMonitorClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSapLandscapeMonitorClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SapLandscapeMonitorClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SapLandscapeMonitorClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Creates a SAP Landscape Monitor Dashboard for the specified subscription, resource group, and resource name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - monitorName - Name of the SAP monitor resource. +// - resource - Request body representing a configuration for Sap Landscape Monitor Dashboard +// - options - SapLandscapeMonitorClientCreateOptions contains the optional parameters for the SapLandscapeMonitorClient.Create +// method. +func (client *SapLandscapeMonitorClient) Create(ctx context.Context, resourceGroupName string, monitorName string, resource SapLandscapeMonitorResource, options *SapLandscapeMonitorClientCreateOptions) (SapLandscapeMonitorClientCreateResponse, error) { + var err error + const operationName = "SapLandscapeMonitorClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, monitorName, resource, options) + if err != nil { + return SapLandscapeMonitorClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SapLandscapeMonitorClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return SapLandscapeMonitorClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *SapLandscapeMonitorClient) createCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, resource SapLandscapeMonitorResource, _ *SapLandscapeMonitorClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *SapLandscapeMonitorClient) createHandleResponse(resp *http.Response) (SapLandscapeMonitorClientCreateResponse, error) { + result := SapLandscapeMonitorClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SapLandscapeMonitorResource); err != nil { + return SapLandscapeMonitorClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Deletes a SAP Landscape Monitor Dashboard with the specified subscription, resource group, and SAP monitor name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - monitorName - Name of the SAP monitor resource. +// - options - SapLandscapeMonitorClientDeleteOptions contains the optional parameters for the SapLandscapeMonitorClient.Delete +// method. +func (client *SapLandscapeMonitorClient) Delete(ctx context.Context, resourceGroupName string, monitorName string, options *SapLandscapeMonitorClientDeleteOptions) (SapLandscapeMonitorClientDeleteResponse, error) { + var err error + const operationName = "SapLandscapeMonitorClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, monitorName, options) + if err != nil { + return SapLandscapeMonitorClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SapLandscapeMonitorClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return SapLandscapeMonitorClientDeleteResponse{}, err + } + return SapLandscapeMonitorClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SapLandscapeMonitorClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, _ *SapLandscapeMonitorClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets configuration values for Single Pane Of Glass for SAP monitor for the specified subscription, resource group, +// and resource name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - monitorName - Name of the SAP monitor resource. +// - options - SapLandscapeMonitorClientGetOptions contains the optional parameters for the SapLandscapeMonitorClient.Get method. +func (client *SapLandscapeMonitorClient) Get(ctx context.Context, resourceGroupName string, monitorName string, options *SapLandscapeMonitorClientGetOptions) (SapLandscapeMonitorClientGetResponse, error) { + var err error + const operationName = "SapLandscapeMonitorClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, monitorName, options) + if err != nil { + return SapLandscapeMonitorClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SapLandscapeMonitorClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SapLandscapeMonitorClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SapLandscapeMonitorClient) getCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, _ *SapLandscapeMonitorClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SapLandscapeMonitorClient) getHandleResponse(resp *http.Response) (SapLandscapeMonitorClientGetResponse, error) { + result := SapLandscapeMonitorClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SapLandscapeMonitorResource); err != nil { + return SapLandscapeMonitorClientGetResponse{}, err + } + return result, nil +} + +// NewListByMonitorPager - Gets configuration values for Single Pane Of Glass for SAP monitor for the specified subscription, +// resource group, and resource name. +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - monitorName - Name of the SAP monitor resource. +// - options - SapLandscapeMonitorClientListByMonitorOptions contains the optional parameters for the SapLandscapeMonitorClient.NewListByMonitorPager +// method. +func (client *SapLandscapeMonitorClient) NewListByMonitorPager(resourceGroupName string, monitorName string, options *SapLandscapeMonitorClientListByMonitorOptions) *runtime.Pager[SapLandscapeMonitorClientListByMonitorResponse] { + return runtime.NewPager(runtime.PagingHandler[SapLandscapeMonitorClientListByMonitorResponse]{ + More: func(page SapLandscapeMonitorClientListByMonitorResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SapLandscapeMonitorClientListByMonitorResponse) (SapLandscapeMonitorClientListByMonitorResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SapLandscapeMonitorClient.NewListByMonitorPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByMonitorCreateRequest(ctx, resourceGroupName, monitorName, options) + }, nil) + if err != nil { + return SapLandscapeMonitorClientListByMonitorResponse{}, err + } + return client.listByMonitorHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByMonitorCreateRequest creates the ListByMonitor request. +func (client *SapLandscapeMonitorClient) listByMonitorCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, _ *SapLandscapeMonitorClientListByMonitorOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByMonitorHandleResponse handles the ListByMonitor response. +func (client *SapLandscapeMonitorClient) listByMonitorHandleResponse(resp *http.Response) (SapLandscapeMonitorClientListByMonitorResponse, error) { + result := SapLandscapeMonitorClientListByMonitorResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SapLandscapeMonitorResourceListResult); err != nil { + return SapLandscapeMonitorClientListByMonitorResponse{}, err + } + return result, nil +} + +// Update - Patches the SAP Landscape Monitor Dashboard for the specified subscription, resource group, and SAP monitor name. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - monitorName - Name of the SAP monitor resource. +// - properties - Request body representing a configuration for Sap Landscape Monitor Dashboard +// - options - SapLandscapeMonitorClientUpdateOptions contains the optional parameters for the SapLandscapeMonitorClient.Update +// method. +func (client *SapLandscapeMonitorClient) Update(ctx context.Context, resourceGroupName string, monitorName string, properties SapLandscapeMonitorResource, options *SapLandscapeMonitorClientUpdateOptions) (SapLandscapeMonitorClientUpdateResponse, error) { + var err error + const operationName = "SapLandscapeMonitorClient.Update" + 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, monitorName, properties, options) + if err != nil { + return SapLandscapeMonitorClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SapLandscapeMonitorClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SapLandscapeMonitorClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *SapLandscapeMonitorClient) updateCreateRequest(ctx context.Context, resourceGroupName string, monitorName string, properties SapLandscapeMonitorResource, _ *SapLandscapeMonitorClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Workloads/monitors/{monitorName}/sapLandscapeMonitor/default" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if monitorName == "" { + return nil, errors.New("parameter monitorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{monitorName}", url.PathEscape(monitorName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *SapLandscapeMonitorClient) updateHandleResponse(resp *http.Response) (SapLandscapeMonitorClientUpdateResponse, error) { + result := SapLandscapeMonitorClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SapLandscapeMonitorResource); err != nil { + return SapLandscapeMonitorClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/astro/armastro/fake/time_rfc3339.go b/sdk/resourcemanager/workloads/sapmonitors/time_rfc3339.go similarity index 98% rename from sdk/resourcemanager/astro/armastro/fake/time_rfc3339.go rename to sdk/resourcemanager/workloads/sapmonitors/time_rfc3339.go index 81f308b0d343..70b0506d3afc 100644 --- a/sdk/resourcemanager/astro/armastro/fake/time_rfc3339.go +++ b/sdk/resourcemanager/workloads/sapmonitors/time_rfc3339.go @@ -1,12 +1,9 @@ -//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 +package sapmonitors import ( "encoding/json" @@ -60,6 +57,9 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string